【问题标题】:Implementing Asprise OCR into your own code在您自己的代码中实现 Asprise OCR
【发布时间】:2017-02-23 10:08:47
【问题描述】:

我已将 Asprise OCR SDK 下载到我的系统,但我无法在自己的代码中实现 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();

}

}

【问题讨论】:

    标签: java ocr implementation


    【解决方案1】:
    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);
        }
    }
    

    【讨论】:

    • 是的......但这就像我想知道如何制作苹果汁但你告诉我关于煮汤的事情。 :~
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-10
    • 1970-01-01
    • 2017-04-02
    相关资源
    最近更新 更多