I am developing OCR application for two different platforms.
- Android
- Windows
I am using android studio for android application development using Tess-two library version 5.4.1. Following is my code that I am using for text recognition from image.
myBitmap = BitmapFactory.decodeFile(imagePaths[i]);
TessBaseApi tessApi = new TessBaseAPI();
tessApi.init(dirPathSDCard, "eng");
tessApi.setImage(myBitmap);
returnedText = tessApi.getUTF8Text();
Log.e("Returned Text", returnedText)
tessApi.end()
for pc I am using java programming language with Eclipse IDE. i am using Tess4j for my java application. Following is my code which shows how i get recognized text from the image
public static void main(String args[]) throws IOException{
try {
ITesseract instance = new Tesseract();
instance.setDatapath("tessdata");
String result = instance.doOCR(imgFile);
System.out.println(result);
}
catch(TesseractException e) {
System.err.println(e.getMessage());}
}
my question is I believe both of these wrapper classes are based on the Tesserect OCR engine written in c/c++. Sometimes I get accurate text from android application but java program does not return accurate result for the same image. And sometimes I get accurate result from java program but android app does not return accurate text for that image. if the core libraries for both the wrapper classes are same then why does both of them produce different results. I am testing the following image for which android app returns accurate text but java program does not.
is it possible to get same result from both of these programs. any help would be appreciated. Thank you very much for your time and assistance in this matter.