Tess4j中文语言包chi-sim.traineddata 点击下载

简单示例

引入依赖

获取依赖 https://mvnrepository.com/search?q=tess4j

<dependency>
    <groupId>net.sourceforge.tess4j</groupId>
    <artifactId>tess4j</artifactId>
    <version>5.13.0</version>
</dependency>

测试图片

测试代码

public class OcrTest {
    public static void main(String[] args) throws TesseractException {
        File file = new File("C:/ocr-test/nihao123.jpg");

        Tesseract tesseract = new Tesseract();
        tesseract.setDatapath("C:/ocr-test/data");
        tesseract.setLanguage("chi_sim");
        String s = tesseract.doOCR(file);
        System.out.println(s);
    }
}

输出结果

你好世界123456

深度学习

深度学习推荐文章 https://blog.51cto.com/u_14344/9796178