Tesseract works with other languages, but not Tess4J

1

we are trying to run Tess4J tests that are provided here: http://tess4j.sourceforge.net/

Tests works fine with English but when I changed language preferences to Turkish they crash. The code that I am changing is:

public void testTessBaseAPIRect() throws Exception {
        System.out.println("TessBaseAPIRect");
        String expResult = expOCRResult;
        String lang = "tur"; //this line is changed from "eng" to "tur"
        File tiff = new File("testTur.png");
        BufferedImage image = ImageIO.read(tiff); // require jai-imageio lib to read TIFF
        ByteBuffer buf = ImageIOHelper.convertImageData(image);
        int bpp = image.getColorModel().getPixelSize();
        int bytespp = bpp / 8;
        int bytespl = (int) Math.ceil(image.getWidth() * bpp / 8.0);
        TessAPI1.TessBaseAPIInit3(handle, "tessdata", lang);
        TessAPI1.TessBaseAPISetPageSegMode(handle, TessAPI1.TessPageSegMode.PSM_AUTO);
        Pointer utf8Text = TessAPI1.TessBaseAPIRect(handle, buf, bytespp, bytespl, 0, 0, 1024, 800);
        String result = utf8Text.getString(0);
        TessAPI1.TessDeleteText(utf8Text);
        System.out.println(result);
        assertEquals(expResult, result.substring(0, expResult.length()));
    }

stack trace of the error is:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  net.sourceforge.tess4j.TessAPI1.TessBaseAPIRect(Lnet/sourceforge/tess4j/TessAPI1$TessBaseAPI;Ljava/nio/ByteBuffer;IIIIII)Lcom/sun/jna/Pointer;+0
j  net.sourceforge.tess4j.TessAPI1Test.testTessBaseAPIRect()V+112
v  ~StubRoutines::call_stub
j  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j  sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j  sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+57
j  org.junit.runners.model.FrameworkMethod$1.runReflectiveCall()Ljava/lang/Object;+15
j  org.junit.internal.runners.model.ReflectiveCallable.run()Ljava/lang/Object;+1
j  org.junit.runners.model.FrameworkMethod.invokeExplosively(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+10
j  org.junit.internal.runners.statements.InvokeMethod.evaluate()V+12
j  org.junit.internal.runners.statements.RunBefores.evaluate()V+49
j  org.junit.internal.runners.statements.RunAfters.evaluate()V+12
j  org.junit.runners.ParentRunner.runLeaf(Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;Lorg/junit/runner/notification/RunNotifier;)V+17
j  org.junit.runners.BlockJUnit4ClassRunner.runChild(Lorg/junit/runners/model/FrameworkMethod;Lorg/junit/runner/notification/RunNotifier;)V+32
j  org.junit.runners.BlockJUnit4ClassRunner.runChild(Ljava/lang/Object;Lorg/junit/runner/notification/RunNotifier;)V+6
j  org.junit.runners.ParentRunner$3.run()V+12
j  org.junit.runners.ParentRunner$1.schedule(Ljava/lang/Runnable;)V+1
j  org.junit.runners.ParentRunner.runChildren(Lorg/junit/runner/notification/RunNotifier;)V+40
j  org.junit.runners.ParentRunner.access$000(Lorg/junit/runners/ParentRunner;Lorg/junit/runner/notification/RunNotifier;)V+2
j  org.junit.runners.ParentRunner$2.evaluate()V+8
j  org.junit.internal.runners.statements.RunBefores.evaluate()V+49
j  org.junit.internal.runners.statements.RunAfters.evaluate()V+12
j  org.junit.runners.ParentRunner.run(Lorg/junit/runner/notification/RunNotifier;)V+20
j  junit.framework.JUnit4TestAdapter.run(Ljunit/framework/TestResult;)V+13
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run()V+707
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(Lorg/apache/tools/ant/taskdefs/optional/junit/JUnitTest;[Ljava/lang/String;ZZZZZZ)I+41
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main([Ljava/lang/String;)V+918
v  ~StubRoutines::call_stub

I moved tur.traineddata under Tess4J's tesseract folder. Also it works fine with tesseract when I run tesseract from the commandline. Thanks in advance.

EDIT: I added the file that I am trying to test Turkish.

enter image description here

EDIT 2: Full stack trace:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x646a2e00, pid=3256, tid=5948
#
# JRE version: 7.0_25-b17
# Java VM: Java HotSpot(TM) Client VM (23.25-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [libtesseract302.dll+0xf2e00]  STRING::split+0x27cf0
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# 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.
#

---------------  T H R E A D  ---------------

Current thread (0x0115c000):  JavaThread "main" [_thread_in_native, id=5948, stack(0x00930000,0x00980000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x05e1d000

Registers:
EAX=0x05e1d002, EBX=0x0680a020, ECX=0x00000280, EDX=0x00000400
ESP=0x0097e03c, EBP=0x00000000, ESI=0x06030de0, EDI=0x05e1c600
EIP=0x646a2e00, EFLAGS=0x00010283

Top of Stack: (sp=0x0097e03c)
0x0097e03c:   cf9c9600 056b73d0 06030de0 64c06870
0x0097e04c:   056b73d0 00001000 0097e08c 02673ab9
0x0097e05c:   00000000 29d140e0 29ce9ad8 00000000
0x0097e06c:   0097e06c 386f7e82 0097e0a8 390fa4f0
0x0097e07c:   65626100 61616562 00000000 0097e0a0
0x0097e08c:   cedf1e2c 0097e0d0 674c744a 0097e0b0
0x0097e09c:   64a628f8 00000000 0097e8f0 64a628f8
0x0097e0ac:   0097e8fc 0097e114 0097e8ac 646c89f0 

Instructions: (pc=0x646a2e00)
0x646a2de0:   88 00 00 00 00 00 00 00 7e 5d 8b 56 30 03 c0 03
0x646a2df0:   c0 89 44 24 14 33 c9 85 d2 7e 31 8d 47 02 8b ff
0x646a2e00:   0f b6 50 fe 0f b6 68 ff c1 e2 08 0b d5 0f b6 28
0x646a2e10:   c1 e2 08 0b d5 0f b6 68 01 c1 e2 08 0b d5 89 14 


Register to memory mapping:

EAX=0x05e1d002 is an unknown value
EBX=0x0680a020 is an unknown value
ECX=0x00000280 is an unknown value
EDX=0x00000400 is an unknown value
ESP=0x0097e03c is pointing into the stack for thread: 0x0115c000
EBP=0x00000000 is an unknown value
ESI=0x06030de0 is an unknown value
EDI=0x05e1c600 is an unknown value


Stack: [0x00930000,0x00980000],  sp=0x0097e03c,  free space=312k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libtesseract302.dll+0xf2e00]  STRING::split+0x27cf0

[error occurred during error reporting (printing native stack), id 0xc0000005]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  net.sourceforge.tess4j.TessAPI1.TessBaseAPIGetUTF8Text(Lnet/sourceforge/tess4j/TessAPI1$TessBaseAPI;)Lcom/sun/jna/Pointer;+0
j  net.sourceforge.tess4j.TessAPI1Test.testTessBaseAPIGetUTF8Text()V+143
v  ~StubRoutines::call_stub
j  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0
j  sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+87
j  sun.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+57
j  org.junit.runners.model.FrameworkMethod$1.runReflectiveCall()Ljava/lang/Object;+15
j  org.junit.internal.runners.model.ReflectiveCallable.run()Ljava/lang/Object;+1
j  org.junit.runners.model.FrameworkMethod.invokeExplosively(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+10
j  org.junit.internal.runners.statements.InvokeMethod.evaluate()V+12
j  org.junit.internal.runners.statements.RunBefores.evaluate()V+49
j  org.junit.internal.runners.statements.RunAfters.evaluate()V+12
j  org.junit.runners.ParentRunner.runLeaf(Lorg/junit/runners/model/Statement;Lorg/junit/runner/Description;Lorg/junit/runner/notification/RunNotifier;)V+17
j  org.junit.runners.BlockJUnit4ClassRunner.runChild(Lorg/junit/runners/model/FrameworkMethod;Lorg/junit/runner/notification/RunNotifier;)V+32
j  org.junit.runners.BlockJUnit4ClassRunner.runChild(Ljava/lang/Object;Lorg/junit/runner/notification/RunNotifier;)V+6
j  org.junit.runners.ParentRunner$3.run()V+12
j  org.junit.runners.ParentRunner$1.schedule(Ljava/lang/Runnable;)V+1
j  org.junit.runners.ParentRunner.runChildren(Lorg/junit/runner/notification/RunNotifier;)V+40
j  org.junit.runners.ParentRunner.access$000(Lorg/junit/runners/ParentRunner;Lorg/junit/runner/notification/RunNotifier;)V+2
j  org.junit.runners.ParentRunner$2.evaluate()V+8
j  org.junit.internal.runners.statements.RunBefores.evaluate()V+49
j  org.junit.internal.runners.statements.RunAfters.evaluate()V+12
j  org.junit.runners.ParentRunner.run(Lorg/junit/runner/notification/RunNotifier;)V+20
j  junit.framework.JUnit4TestAdapter.run(Ljunit/framework/TestResult;)V+13
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run()V+707
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(Lorg/apache/tools/ant/taskdefs/optional/junit/JUnitTest;[Ljava/lang/String;ZZZZZZ)I+41
j  org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main([Ljava/lang/String;)V+918
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x04ec0000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=784, stack(0x051b0000,0x05200000)]
  0x01069c00 JavaThread "Service Thread" daemon [_thread_blocked, id=4172, stack(0x04c90000,0x04ce0000)]
  0x01060800 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=3552, stack(0x04bf0000,0x04c40000)]
  0x0105f400 JavaThread "Attach Listener" daemon [_thread_blocked, id=4164, stack(0x010e0000,0x01130000)]
  0x0105c400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=4124, stack(0x049e0000,0x04a30000)]
  0x01045800 JavaThread "Finalizer" daemon [_thread_blocked, id=3604, stack(0x048e0000,0x04930000)]
  0x01044000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5824, stack(0x04850000,0x048a0000)]
=>0x0115c000 JavaThread "main" [_thread_in_native, id=5948, stack(0x00930000,0x00980000)]

Other Threads:
  0x01042400 VMThread [stack: 0x046e0000,0x04730000] [id=2280]
  0x0108d800 WatcherThread [stack: 0x04a40000,0x04a90000] [id=5332]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 4928K, used 485K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K,   3% used [0x246f0000, 0x24719c48, 0x24b40000)
  from space 512K,  62% used [0x24bc0000, 0x24c0f7e0, 0x24c40000)
  to   space 512K,   0% used [0x24b40000, 0x24b40000, 0x24bc0000)
 tenured generation   total 10944K, used 3308K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,  30% used [0x29c40000, 0x29f7b1b0, 0x29f7b200, 0x2a6f0000)
 compacting perm gen  total 12288K, used 2764K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  22% used [0x346f0000, 0x349a33e0, 0x349a3400, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)

Card table byte_map: [0x00ac0000,0x00b70000] byte_map_base: 0x0099c880

Polling page: 0x00210000

Code Cache  [0x02670000, 0x02750000, 0x04670000)
 total_blobs=357 nmethods=176 adapters=116 free_code_cache=31891Kb largest_free_block=32657280

Compilation events (10 events):
Event: 3.683 Thread 0x01060800  172             java.util.zip.Inflater::ensureOpen (47 bytes)
Event: 3.683 Thread 0x01060800 nmethod 172 0x02748ac8 code [0x02748bd0, 0x02748cdc]
Event: 3.691 Thread 0x01060800  173   !         java.util.zip.InflaterInputStream::read (138 bytes)
Event: 3.692 Thread 0x01060800 nmethod 173 0x02749048 code [0x027491f0, 0x02749a54]
Event: 3.692 Thread 0x01060800  174   !         java.util.zip.Inflater::inflate (74 bytes)
Event: 3.692 Thread 0x01060800 nmethod 174 0x0274a148 code [0x0274a280, 0x0274a5f0]
Event: 3.692 Thread 0x01060800  176             java.util.zip.InflaterInputStream::ensureOpen (18 bytes)
Event: 3.692 Thread 0x01060800 nmethod 176 0x0274a848 code [0x0274a950, 0x0274aa4c]
Event: 3.695 Thread 0x01060800  177             java.io.DataInputStream::readFully (63 bytes)
Event: 3.695 Thread 0x01060800 nmethod 177 0x0274aac8 code [0x0274abf0, 0x0274add4]

GC Heap History (6 events):
Event: 0.590 GC heap before
{Heap before GC invocations=0 (full 0):
 def new generation   total 4928K, used 4416K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K, 100% used [0x246f0000, 0x24b40000, 0x24b40000)
  from space 512K,   0% used [0x24b40000, 0x24b40000, 0x24bc0000)
  to   space 512K,   0% used [0x24bc0000, 0x24bc0000, 0x24c40000)
 tenured generation   total 10944K, used 0K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,   0% used [0x29c40000, 0x29c40000, 0x29c40200, 0x2a6f0000)
 compacting perm gen  total 12288K, used 1564K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  12% used [0x346f0000, 0x34877068, 0x34877200, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
Event: 0.593 GC heap after
Heap after GC invocations=1 (full 0):
 def new generation   total 4928K, used 512K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K,   0% used [0x246f0000, 0x246f0000, 0x24b40000)
  from space 512K, 100% used [0x24bc0000, 0x24c40000, 0x24c40000)
  to   space 512K,   0% used [0x24b40000, 0x24b40000, 0x24bc0000)
 tenured generation   total 10944K, used 676K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,   6% used [0x29c40000, 0x29ce9128, 0x29ce9200, 0x2a6f0000)
 compacting perm gen  total 12288K, used 1564K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  12% used [0x346f0000, 0x34877068, 0x34877200, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
}
Event: 3.279 GC heap before
{Heap before GC invocations=1 (full 0):
 def new generation   total 4928K, used 4928K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K, 100% used [0x246f0000, 0x24b40000, 0x24b40000)
  from space 512K, 100% used [0x24bc0000, 0x24c40000, 0x24c40000)
  to   space 512K,   0% used [0x24b40000, 0x24b40000, 0x24bc0000)
 tenured generation   total 10944K, used 676K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,   6% used [0x29c40000, 0x29ce9128, 0x29ce9200, 0x2a6f0000)
 compacting perm gen  total 12288K, used 2370K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  19% used [0x346f0000, 0x34940a48, 0x34940c00, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
Event: 3.283 GC heap after
Heap after GC invocations=2 (full 0):
 def new generation   total 4928K, used 511K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K,   0% used [0x246f0000, 0x246f0000, 0x24b40000)
  from space 512K,  99% used [0x24b40000, 0x24bbfff8, 0x24bc0000)
  to   space 512K,   0% used [0x24bc0000, 0x24bc0000, 0x24c40000)
 tenured generation   total 10944K, used 1391K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,  12% used [0x29c40000, 0x29d9bef0, 0x29d9c000, 0x2a6f0000)
 compacting perm gen  total 12288K, used 2370K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  19% used [0x346f0000, 0x34940a48, 0x34940c00, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
}
Event: 3.695 GC heap before
{Heap before GC invocations=2 (full 0):
 def new generation   total 4928K, used 4927K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K,  99% used [0x246f0000, 0x24b3fc18, 0x24b40000)
  from space 512K,  99% used [0x24b40000, 0x24bbfff8, 0x24bc0000)
  to   space 512K,   0% used [0x24bc0000, 0x24bc0000, 0x24c40000)
 tenured generation   total 10944K, used 1391K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,  12% used [0x29c40000, 0x29d9bef0, 0x29d9c000, 0x2a6f0000)
 compacting perm gen  total 12288K, used 2745K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  22% used [0x346f0000, 0x3499e548, 0x3499e600, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
Event: 3.699 GC heap after
Heap after GC invocations=3 (full 0):
 def new generation   total 4928K, used 317K [0x246f0000, 0x24c40000, 0x29c40000)
  eden space 4416K,   0% used [0x246f0000, 0x246f0000, 0x24b40000)
  from space 512K,  62% used [0x24bc0000, 0x24c0f7e0, 0x24c40000)
  to   space 512K,   0% used [0x24b40000, 0x24b40000, 0x24bc0000)
 tenured generation   total 10944K, used 3308K [0x29c40000, 0x2a6f0000, 0x346f0000)
   the space 10944K,  30% used [0x29c40000, 0x29f7b1b0, 0x29f7b200, 0x2a6f0000)
 compacting perm gen  total 12288K, used 2745K [0x346f0000, 0x352f0000, 0x386f0000)
   the space 12288K,  22% used [0x346f0000, 0x3499e548, 0x3499e600, 0x352f0000)
    ro space 10240K,  45% used [0x386f0000, 0x38b79b28, 0x38b79c00, 0x390f0000)
    rw space 12288K,  54% used [0x390f0000, 0x3977d0e8, 0x3977d200, 0x39cf0000)
}

Deoptimization events (0 events):
No events

Internal exceptions (10 events):
Event: 3.331 Thread 0x0115c000 Threw 0x24773480 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.332 Thread 0x0115c000 Threw 0x247818c0 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.333 Thread 0x0115c000 Threw 0x2478aba0 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.365 Thread 0x0115c000 Threw 0x247969c0 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.366 Thread 0x0115c000 Threw 0x2479a270 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.367 Thread 0x0115c000 Threw 0x247a6eb0 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.368 Thread 0x0115c000 Threw 0x247aad48 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.428 Thread 0x0115c000 Threw 0x247e0b28 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.701 Thread 0x0115c000 Threw 0x2470a000 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235
Event: 3.782 Thread 0x0115c000 Threw 0x24711a70 at C:\jdk7u2_32P\jdk7u25\hotspot\src\share\vm\prims\jvm.cpp:1235

Events (10 events):
Event: 3.675 loading class 0x04ea54f0
Event: 3.675 loading class 0x04ea54f0 done
Event: 3.695 Executing VM operation: GenCollectForAllocation
Event: 3.699 Executing VM operation: GenCollectForAllocation done
Event: 3.701 loading class 0x04d821b0
Event: 3.701 loading class 0x04d821b0 done
Event: 3.782 loading class 0x04e8de40
Event: 3.782 loading class 0x04e8de40 done
Event: 3.782 loading class 0x04eb9db8
Event: 3.782 loading class 0x04eb9db8 done


Dynamic libraries:
0x01240000 - 0x0126f000     C:\Program Files (x86)\Java\jdk1.7.0_25\bin\java.exe
0x77960000 - 0x77ae0000     C:\Windows\SysWOW64\ntdll.dll
0x705f0000 - 0x7062f000     C:\Program Files\AVAST Software\Avast Business\snxhk.dll
0x773a0000 - 0x774b0000     C:\Windows\syswow64\KERNEL32.dll
0x77350000 - 0x77397000     C:\Windows\syswow64\KERNELBASE.dll
0x772b0000 - 0x77350000     C:\Windows\syswow64\ADVAPI32.dll
0x774b0000 - 0x7755c000     C:\Windows\syswow64\msvcrt.dll
0x75e80000 - 0x75e99000     C:\Windows\SysWOW64\sechost.dll
0x75ee0000 - 0x75fd0000     C:\Windows\syswow64\RPCRT4.dll
0x753b0000 - 0x75410000     C:\Windows\syswow64\SspiCli.dll
0x753a0000 - 0x753ac000     C:\Windows\syswow64\CRYPTBASE.dll
0x75720000 - 0x75820000     C:\Windows\syswow64\USER32.dll
0x75490000 - 0x75520000     C:\Windows\syswow64\GDI32.dll
0x75fe0000 - 0x75fea000     C:\Windows\syswow64\LPK.dll
0x75670000 - 0x7570d000     C:\Windows\syswow64\USP10.dll
0x73340000 - 0x734de000     C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll
0x75430000 - 0x75487000     C:\Windows\syswow64\SHLWAPI.dll
0x75e20000 - 0x75e80000     C:\Windows\system32\IMM32.DLL
0x75520000 - 0x755ec000     C:\Windows\syswow64\MSCTF.dll
0x742d0000 - 0x74305000     c:\windows\syswow64\nvinit.dll
0x67460000 - 0x6751e000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\msvcr100.dll
0x647d0000 - 0x64b12000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\client\jvm.dll
0x73f60000 - 0x73f67000     C:\Windows\system32\WSOCK32.dll
0x75ea0000 - 0x75ed5000     C:\Windows\syswow64\WS2_32.dll
0x76260000 - 0x76266000     C:\Windows\syswow64\NSI.dll
0x73ef0000 - 0x73f22000     C:\Windows\system32\WINMM.dll
0x75710000 - 0x75715000     C:\Windows\syswow64\PSAPI.DLL
0x71570000 - 0x7157c000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\verify.dll
0x6b4f0000 - 0x6b510000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\java.dll
0x6b4d0000 - 0x6b4e3000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\zip.dll
0x6b4b0000 - 0x6b4c4000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\net.dll
0x73bf0000 - 0x73c2c000     C:\Windows\system32\mswsock.dll
0x70af0000 - 0x70af6000     C:\Windows\System32\wship6.dll
0x71580000 - 0x7158f000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\nio.dll
0x70a80000 - 0x70a90000     C:\Windows\system32\NLAapi.dll
0x70a70000 - 0x70a80000     C:\Windows\system32\napinsp.dll
0x70a50000 - 0x70a62000     C:\Windows\system32\pnrpnsp.dll
0x70a00000 - 0x70a44000     C:\Windows\system32\DNSAPI.dll
0x709f0000 - 0x709f8000     C:\Windows\System32\winrnr.dll
0x709e0000 - 0x709ed000     C:\Windows\system32\wshbth.dll
0x709b0000 - 0x709d7000     C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
0x73be0000 - 0x73be5000     C:\Windows\System32\wshtcpip.dll
0x737b0000 - 0x737cc000     C:\Windows\system32\IPHLPAPI.DLL
0x73690000 - 0x73697000     C:\Windows\system32\WINNSI.DLL
0x70960000 - 0x70966000     C:\Windows\system32\rasadhlp.dll
0x70970000 - 0x709a8000     C:\Windows\System32\fwpuclnt.dll
0x64d20000 - 0x64e64000     C:\Program Files (x86)\Java\jdk1.7.0_25\jre\bin\awt.dll
0x770c0000 - 0x7714f000     C:\Windows\syswow64\OLEAUT32.dll
0x75aa0000 - 0x75bfc000     C:\Windows\syswow64\ole32.dll
0x728b0000 - 0x728c6000     C:\Windows\system32\CRYPTSP.dll
0x72870000 - 0x728ab000     C:\Windows\system32\rsaenh.dll
0x74320000 - 0x74337000     C:\Windows\system32\USERENV.dll
0x74310000 - 0x7431b000     C:\Windows\system32\profapi.dll
0x10000000 - 0x1003d000     C:\Users\deniz\AppData\Local\Temp\jna-deniz\jna2263007016168316943.dll
0x645b0000 - 0x647ca000     C:\Users\deniz\Documents\NetBeansProjects\Tess4J-1.1-src\Tess4J\libtesseract302.dll
0x64b80000 - 0x64d1c000     C:\Users\deniz\Documents\NetBeansProjects\Tess4J-1.1-src\Tess4J\liblept168.dll
0x741f0000 - 0x74293000     C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCR90.dll
0x72f60000 - 0x72fee000     C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\MSVCP90.dll
0x72c70000 - 0x72d5b000     C:\Windows\system32\dbghelp.dll

EDIT 3: This is the final version of testTessBaseAPIRect:

@Test
    public void testTessBaseAPIRect() throws Exception {
        System.out.println("TessBaseAPIRect");
        String expResult = expOCRResult;
        String lang = "tur";
        File tiff = new File("testTur.tif");
        BufferedImage image = ImageIO.read(tiff); // require jai-imageio lib to read TIFF
        ByteBuffer buf = ImageIOHelper.convertImageData(image);
        int bpp = image.getColorModel().getPixelSize();
        int bytespp = bpp / 8;
        int bytespl = (int) Math.ceil(image.getWidth() * bpp / 8.0);
        TessAPI1.TessBaseAPIInit3(handle, "tessdata", lang);
        TessAPI1.TessBaseAPISetPageSegMode(handle, TessAPI1.TessPageSegMode.PSM_AUTO);
        Pointer utf8Text = TessAPI1.TessBaseAPIRect(handle, buf, bytespp, bytespl, 0, 0, 2048, 1600);
        String result = utf8Text.getString(0);
        TessAPI1.TessDeleteText(utf8Text);
        System.out.println(result);
//        assertEquals(expResult, result.substring(0, expResult.length()));
    }
java
tesseract
asked on Stack Overflow Aug 7, 2013 by lamostreta • edited Aug 11, 2013 by lamostreta

1 Answer

1

TessBaseAPIRect specifies a region on the image. If the region is larger than the image, exceptions will be thrown. Either specify a smaller region or use TessBaseAPIGetUTF8Text for the whole image.

answered on Stack Overflow Aug 7, 2013 by nguyenq

User contributions licensed under CC BY-SA 3.0