我已经将Asprise下载到我的系统中,但我无法在自己的代码中实现OCR。在运行之前,我没有收到任何错误。
我现在得到的错误是:错误:无法找到或加载主类
有没有人尝试过在自己的代码中实现OCR,如果是,是如何实现的?
我遵循了Asprise中的开发人员指南,但没有成功
测试代码:导入com.asprise.ocr.Ocr;导入java.io.*;
公共类OCRTester {
public static void main(String[] args) {
Ocr.setUp(); // one time setup
Ocr ocr = new Ocr();
ocr.startEngine("eng", Ocr.SPEED_FASTEST);
String s = ocr.recognize(new File[] { new File("images\test.png") }, Ocr.RECOGNIZE_TYPE_ALL,
Ocr.OUTPUT_FORMAT_PLAINTEXT, 0, null);
System.out.println("RESULT: " + s);
ocr.stopEngine();
}}
发布于 2017-02-23 18:11:55
I have extracted OCR from images using tesseract library
[please go through this link][1]
[1]: https://github.com/tesseract-ocr/tesseract
public class Test{
public static void main(String[] args) {
File inputFile=new File(filePath);
System.out.println("processing file ...."+inputFile.getName());
Tesseract instance = Tesseract.getInstance(); //
instance.setLanguage("hin+eng");
BufferedImage bufferedImage=ImageIO.read(inputFile);
String ocrText = instance.doOCR(ImageHelper.convertImageToGrayscale(bufferedImage));
System.out.println(ocrText);
}
}https://stackoverflow.com/questions/42412623
复制相似问题