Tess4J:内存访问无效 [英] Tess4J: Invalid memory access

查看:613
本文介绍了Tess4J:内存访问无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的项目中使用Tess4J从图像中提取文本。当我尝试运行OCR时出现以下错误:
线程main中的异常java.lang.Error:无效的内存访问

I am trying to use Tess4J in my project to extract text from an image. I am getting the following error when I try run the OCR: Exception in thread "main" java.lang.Error: Invalid memory access

    try {
        File imageFile = new File("example4.jpg");
        Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping
        //Tesseract1 instance = new Tesseract1();
        String result = instance.doOCR(imageFile);
        System.out.println(result);
    } catch (Exception e) {
        e.printStackTrace();
    }   


推荐答案

你可以设置数据路径当我设置问题解决的数据路径时,我遇到同样的问题

尝试尝试这个

you can set the data path i am getting same problem when i set the data path that problem is solved
try try this

instance1.setDatapath(D:// Hotel_project //Tess4J-1.2-src//Tess4J//tessdata);

instance1.setDatapath("D://Hotel_project//Tess4J-1.2-src//Tess4J//tessdata");

这篇关于Tess4J:内存访问无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆