gxrxrdx/tesseract-ocr

Error: Illegal min or max specification!

Closed this issue · 7 comments

What steps will reproduce the problem?
1. Did the "sudo apt-get install tesseract-ocr"
2. Create a project on Eclipse Luna with de example code of Tess4J, with all 
the libraries imported on the classpath
3. Setted programatically the DataPath, the Tesseract didn't recognized the 
TESSDATA_PREFIX from the .bashrc

What is the expected output? What do you see instead?
I was expecting a text from the image but I got this:

Error: Illegal min or max specification!
"Fatal error encountered!" == NULL:Error:Assert failed:in file globaloc.cpp, 
line 75
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f95513d533a, pid=3856, tid=140279829837568
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 
compressed oops)
# Problematic frame:
# C  [libtesseract.so.3.0.3+0x22533a]  ERRCODE::error(char const*, 
TessErrorLogCode, char const*, ...) const+0x16a
#
# Core dump written. Default location: 
/home/gsouza/Dev/workspace/ocr/tess4j/core or core.3856
#
# An error report file with more information is saved as:
# /home/gsouza/Dev/workspace/ocr/tess4j/hs_err_pid3856.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.
#

What version of the product are you using? On what operating system?
LinuxMint 17.1
Eclipse Luna
Tesseract 3.03
Leptonica 1.72

Please provide any additional information below.

Original issue reported on code.google.com by gso...@reglare.com.br on 29 Apr 2015 at 8:17

Forgot the code : 
public class OCR {

    public static void main(String[] args) {
            File arquivo = new File("/home/gsouza/Desktop/imagemocr.jpg");
            Tesseract tesseract = Tesseract.getInstance();
            tesseract.setDatapath("/usr/share/tesseract-ocr/");

        try {
            String result = tesseract.doOCR(arquivo);

            System.out.println(result);
        } catch(TesseractException e) {
            e.printStackTrace();
        }
    }

}

Original comment by gso...@reglare.com.br on 29 Apr 2015 at 8:20

https://code.google.com/p/tesseract-ocr/wiki/FAQ#Rules_and_advices

Original comment by zde...@gmail.com on 30 Apr 2015 at 6:23

  • Changed state: Invalid
I have already set the LC_NUMERIC=C through the terminal. But the error pesists.

Original comment by gso...@reglare.com.br on 30 Apr 2015 at 12:26

I have tried setting the LC_NUMERIC using setTessVariable but it isn't working 
either :
public class OCR {

    public static void main(String[] args) {
            File arquivo = new File("/home/gsouza/Desktop/imagemocr.jpg");
            Tesseract tesseract = Tesseract.getInstance();
            tesseract.setDatapath("/usr/share/tesseract-ocr/");
            tesseract.setTessVariable("LC_NUMERIC", "C");

        try {
            String result = tesseract.doOCR(arquivo);

            System.out.println(result);
        } catch(TesseractException e) {
            e.printStackTrace();
        }
    }

}

Original comment by gso...@reglare.com.br on 30 Apr 2015 at 12:32

Issue 1469 has been merged into this issue.

Original comment by zde...@gmail.com on 1 May 2015 at 7:21

I confirm this issue. It recently crashes Java VM on my Mac (OS X 10.7) in just 
the same way.

What's really annoying about this is the fact we've been discussing this issue 
several times for a very long period of time (> 1 year IIRC), see here: 
https://code.google.com/p/tesseract-ocr/issues/detail?id=910

Finally, a fix has been provided, see here: 
https://code.google.com/p/tesseract-ocr/source/detail?r=3a5f69901310e26a958c6cb6
395174368b44c99c

IIRC, the above mentioned fix replaces fscanf with another version that ignores 
locale settings.

Moreover, I remember that Tesseract 3.03 RC1 has been already worked fine with 
this fix in my Ubuntu for 2-3 months. Therefore, I have no idea what does 
trigger the issue this time.

BTW, you cannot change your locale from inside Java. You HAVE to run the whole 
JVM with a proper locale from the command line...

Best regards
Max

Original comment by maximums...@googlemail.com on 25 Jun 2015 at 11:30

First of all - we do not provide support for java wrapper.
Next: you need to provide test case with tesseract executable[1] (or simple cpp 
example that use tesseract library) so we can try to reproduce problem. 
Otherwise your confirmation of issue is useless.
And you forget to specified what tesseract version you use... This is more 
important than you version of Mac OS

[1] https://code.google.com/p/tesseract-ocr/wiki/FAQ#Rules_and_advices

Original comment by zde...@gmail.com on 26 Jun 2015 at 9:12