Tess4j不使用它的tessdata文件夹 [英] Tess4j doesn't use it's tessdata folder

查看:1903
本文介绍了Tess4j不使用它的tessdata文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用tess4j,Tesseract的java包装器。我也安装了正常的Tesseract。我不确定tess4j是如何工作的,但由于它附带了一个tessdata文件夹,我可以假设您将语言数据文件放在那里。但是,tess4j仅在语言数据文件位于真实tessdata文件夹(tesseract附带的文件夹,而不是tess4j)中时才起作用。如果我删除该文件夹,我收到此错误消息:

I am using tess4j, the java wrapper of Tesseract. I also have the normal Tesseract installed. I am not exactly sure how tess4j is meant to work, but since it comes with a tessdata folder, I can assume that you would put the language data files there. However, tess4j is only working if the language data files are in the "real" tessdata folder (the one that comes with tesseract, not tess4j). If I remove that folder, I get this error message:

Error opening data file C:\Program Files\Tesseract-OCR\tessdata/jpn.trained
data
Please make sure the TESSDATA_PREFIX environment variable is set to the par
ent directory of your "tessdata" directory.
Failed loading language 'jpn'
Tesseract couldn't load any languages!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x631259dc, pid=5108, tid=
10148
#
# JRE version: 7.0_06-b24
# Java VM: Java HotSpot(TM) Client VM (23.2-b09 mixed mode, sharing windows
-x86 )
# Problematic frame:
# C  [libtesseract302.dll+0x59dc]  STRING::strdup+0x467c
#
# Failed to write core dump. Minidumps are not enabled by default on client
 versions of Windows
#
# An error report file with more information is saved as:
# D:\School\Programs\OCRTest\v1.0.0\hs_err_pid5108.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

这是否意味着我需要安装Tesseract才能使用tess4j?为什么?或者maby我的tess4j tessdata文件夹位于错误的位置(目前我的.java文件中,tess4j jars位于我设置了类路径的lib文件夹中)。

Does this mean I need to have Tesseract installed to use tess4j? Why? Or maby my tess4j tessdata folder is in the wrong place (It is currently with my .java files, the tess4j jars are in a lib folder to which I have set a classpath).

推荐答案

让你的 TESSDATA_PREFIX环境变量指向你的Tess4j的tessdata文件夹。

Let your TESSDATA_PREFIX environment variable point to the tessdata folder of your Tess4j.

通常在系统安装期间设置这些变量,但您可以在此找到解决方案:如何从Java设置环境变量?

Usually you set up these variable during an installation on the system, but you maybe find a solution here: How do I set environment variables from Java?

您必须在运行应用程序的系统上执行此操作因为tessdata .dll s取决于此环境变量。

You have to do it on the system which runs your app because the tessdata .dlls depend on this enviroment variable.

这篇关于Tess4j不使用它的tessdata文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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