it almost drive me crazy....i wish to find a reliable offline ocr to finish my app,in csdn,a java project shows the way it uses the Tesseract(an open source project)to implement the offline ocr...since the B4A is based on java...i wonder if i can use the way too..
in his code
the tess4j is a Java JNA Encapsulates object which contains the Tesseract ocr
in his code
<!-- Tess4Jdepend -->
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>5.4.0</version>
</dependency>
i would be pay for it if any i can help me to do this....// do OCR
private void execute(BufferedImage targetImage) {
try {
File tempFile = new File(tempImage);
if (tempFile == null) {
tempFile.mkdirs();
}
tempFile.mkdirs();
ImageIO.write(targetImage, "jpg", tempFile);
} catch (IOException e) {
e.printStackTrace();
}
File file = new File(tempImage);
ITesseract instance = new Tesseract();
// set the position of the language data
instance.setDatapath("src/main/resources/data");
// set language
instance.setLanguage(language);
Thread thread = new Thread() {
public void run() {
String result = null;
try {
result = instance.doOCR(file);
} catch (Exception e) {
e.printStackTrace();
}
resultArea.setText(result);
}
};
ProgressBar.show(this, thread, "please wait....the ocr is ready", "finish", "cancel");
}