java tessdata训练,Tess4j不使用它的tessdata文件夹

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.

#

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).

解决方案

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

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?

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值