TABLE OF CONTENTS
- GENERAL PRODUCT DOCUMENTATION
- CURRENT VERSION
- SYSTEM REQUIREMENTS AND PRE-REQUISITES
- PREPARATION FOR USAGE
- USING THE LIBRARY
- RECOGNITION RESULTS
GENERAL PRODUCT DOCUMENTATION
CURRENT VERSION
2020.12 – released December 2020
SYSTEM REQUIREMENTS AND PRE-REQUISITES
- Debian 8 and above (x86 and x64) 32bit and 64bit.
- Ubuntu 16.04 and above (x86, x64, ARM Cortex A53, and ARM Cortex A72) 32bit and 64bit.
- Raspbian 10 (Buster) and above (ARM Cortex A53, and ARM Cortex A72) 32bit.
- Windows WSL 1.0 (Ubuntu 16.04 and above) 64bit
- JRE (Java Runtime Environment) should be installed and configured.
PREPARATION FOR USAGE
- The .jar file, the OCR engine library (*.so file), and the text file named “keys”, without extension, should be placed into the same directory.
- The “keys” file should be updated with the provided API and License keys.
Example of content for “keys” file:
{ "api_key": "88888888-8888-8888-8888-888888888888", "license_key": "88888888-8888-8888-8888-888888888888" }
USING THE LIBRARY
There are two ways of using the wrapper: A library in Java application or a standalone command-line tool.
Example of usage as a command-line tool on x86 and x64 architecture
Example of command
java -jar conpds_ocrengine_java_wrapper.jar /tmp/MSKU3824534_2017-04-15_213657.jpg
Example of usage as a command-line tool on ARM architecture
Example of command
java -Xss400k -jar conpds_ocrengine_java_wrapper.jar /tmp/MSKU3824534_2017-04-15_213657.jpg
Example of usage as a java library
- Include conpds_ocrengine_java_wrapper.jar into the application as a library.
- Import class Wrapper from dk.itx.ocrengine package.
- There are two static methods “recognize” in Wrapper class.
- Process from file. Provide an absolute path to the image as the argument to the method.
- Process image data from memory. The method receives an array of bytes from an image. This function can process single frames from a camera or video stream without saving images as a file first.
Note: If running on ARM architecture, use the -Xss 400 parameter to set thread stack size.
Example with a path to file
String result = Wrapper.recognize(“/tmp/MSKU3824534_2017-04-15_213657.jpg”);
Example with bytes array
Path path = Paths.get("/tmp/MSKU3824534_2017-04-15_213657.jpg"); byte[] bytes = Files.readAllBytes(path); String result = Wrapper.recognize(bytes);
License checking errors
- invalidServerPublicKey: Invalid server public key
- invalidJSONResponse: Invalid JSON response
- invalidResponse: Invalid response from server
- invalidURL: Invalid server URL
- invalidDevicId: Error while getting device ID
- timeOut: Request timeout.
- invalidAPIKey: Invalid API key
RECOGNITION RESULTS
If recognition is successful, it contains JSON response with the objects documented in the article OCR ENGINE OUTPUT.