[英]Implementing Asprise OCR into your own code
我已经将Asprise OCR SDK下载到我的系统,但是我无法在自己的代码中实现OCR。 直到运行时我才收到任何错误。
我现在得到的错误是:错误:无法找到或加载主类
有没有人试图在自己的代码中实现OCR,如果有的话怎么样?
我跟随Asprise的开发者指南,但一直没有成功
测试代码:import com.asprise.ocr.Ocr; import 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();
}
}
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);
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.