0
如何从包含英文文本的图像中获取数字值。我正在使用tesseract引擎。Tesseract从文本中读取数字
这是代码:
public static String tesseractOCR(String imgPath, Rectangle rect) {
File imageFile = new File(imgPath);
Tesseract instance = Tesseract.getInstance(); // JNA Interface Mapping
// Tesseract1 instance = new Tesseract1(); // JNA Direct Mapping
String result = "";
try {
result = instance.doOCR(imageFile, rect);//, new Rectangle(50, 128, 405 - 50, 228 - 128)
} catch (TesseractException e) {
System.err.println(e.getMessage());
}
return result;
}