Tesseract Api崩溃

时间:2017-07-14 04:08:38

标签: java ocr tesseract

我正在使用tesseract。我使用2个队列将图像转换为文本。当我运行多个进程时,我的tesseract api失败并发出致命错误。

错误1 :::

Error in pixCreateNoInit: pix_malloc fail for data
Error in pixCreate: pixd not made
Error in pixGetData: pix not defined
Error in pixGetWpl: pix not defined
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fcc74e6245f, pid=7113, tid=0x00007fcc77be2700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# 09:50:22.551 [pool-4-thread-5] INFO  o.a.p.pdmodel.font.PDCIDFontType2 - OpenType Layout tables used in font Arial are not implemented in PDFBox and will be ignored
C  [libtesseract.so.3.0.3+0xe145f]  tesseract::ImageThresholder::SetImage(unsigned char const*, int, int, int, int)+0x9f
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid7113.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Error in pixCreateNoInit: pix_malloc fail for data
Error in pixCreate: pixd not made
Error in pixGetData: pix not defined
Error in pixGetWpl: pix not defined
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fcc74e6245f, pid=7113, tid=0x00007fcc77be2700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_101-b13) (build 1.8.0_101-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# 09:50:22.551 [pool-4-thread-5] INFO  o.a.p.pdmodel.font.PDCIDFontType2 - OpenType Layout tables used in font Arial are not implemented in PDFBox and will be ignored
C  [libtesseract.so.3.0.3+0xe145f]  tesseract::ImageThresholder::SetImage(unsigned char const*, int, int, int, int)+0x9f
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid7113.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bugSuccessfully launced OCR workers

当我去#ttt /hs_err_pid7113.log

我找到了::

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  com.sun.jna.Native.invokeVoid(JI[Ljava/lang/Object;)V+0
j  com.sun.jna.Function.invoke([Ljava/lang/Object;Ljava/lang/Class;Z)Ljava/lang/Object;+30
J 11588 C1 com.sun.jna.Function.invoke(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object; (538 bytes) @ 0x00007f7ff2343c9c [0x00007f7ff23427a0+0x14fc]
J 11587 C1 com.sun.jna.Library$Handler.invoke(Ljava/lang/Object;Ljava/lang/reflect/Method;[Ljava/lang/Object;)Ljava/lang/Object; (320 bytes) @ 0x00007f7ff20b4c34 [0x00007f7ff20b2f80+0x1cb4]
j  com.sun.proxy.$Proxy6.TessBaseAPISetImage(Lnet/sourceforge/tess4j/ITessAPI$TessBaseAPI;Ljava/nio/ByteBuffer;IIII)V+52
j  net.sourceforge.tess4j.Tesseract.setImage(IILjava/nio/ByteBuffer;Ljava/awt/Rectangle;I)V+37
j  net.sourceforge.tess4j.Tesseract.setImage(Ljava/awt/image/RenderedImage;Ljava/awt/Rectangle;)V+27
j  net.sourceforge.tess4j.Tesseract.doOCR(Ljava/util/List;Ljava/lang/String;Ljava/awt/Rectangle;)Ljava/lang/String;+60
j  net.sourceforge.tess4j.Tesseract.doOCR(Ljava/util/List;Ljava/awt/Rectangle;)Ljava/lang/String;+4
j  net.sourceforge.tess4j.Tesseract.doOCR(Ljava/awt/image/BufferedImage;Ljava/awt/Rectangle;)Ljava/lang/String;+6
j  net.sourceforge.tess4j.Tesseract.doOCR(Ljava/awt/image/BufferedImage;)Ljava/lang/String;+3
j 

1 个答案:

答案 0 :(得分:0)

我有类似的问题。如果您使用doOCR()作为输入参数而不是File来应用BufferedImage,那么问题就会消失。