Call via command line against JNI

I need to call Tesseract OCR (its open source C ++ library that does optical character recognition) from a Java application server. Currently, it is fairly easy to run an executable using Runtime.exec (). Basic logic would be

  • Save the image that is currently stored in memory for the file (a.tif)
  • pass the image file name to the tesseract command-line program.
  • read in a text output file with Java using FileReader.

How much performance improvement can I get by writing a JNI wrapper for Tesseract? Unfortunately, there is no open source JNI shell that runs on Linux. I would have to do it myself, and I wonder if it’s worth the development cost.

+3
source share
3 answers

It's hard to say if it's worth it. If you assume that if it is executed in the process via JNI, the OCR code can directly access image data without having to write it to a file, then it will certainly remove any disk I / O limitations.

I would recommend switching to a simpler approach and only run the JNI option if performance is unacceptable. At least then you can conduct a comparative analysis and evaluate the performance gain that you could realize.

+4
source

, JNA. "" , Java, , JNI, . JNA .

+4

twaakt. JNI, . , JNI, - JNI OCR. , ( , ).

+1

All Articles