Spring Boot 配置 tess4j

没有用最新版本tess4j用了3.4.7

使用maven在pom.xml中添加dependency


    net.sourceforge.tess4j
    tess4j
    3.4.7

tessdata目录中有需要的训练数据,但是似乎只能指定绝对路径,或者设置环境变量。打包在jar中好像访问不到。

代码中通过以下代码来设置路径

Tesseract instance = new Tesseract();

instance.setDatapath(“D:/”);

instance.doOCR(imageFile);


你可能感兴趣的:(spring)