背景:项目需要扫描识别技术,比较了微软(智能识别技术)和谷歌的(Tess4J),决定使用这个开源的东东。
建议:
1、可以到GitHub找相关的Tess4J项目
一、项目结构:使用eclipse 构建java项目,下图为项目结构
构建TestTess4j.java,(勾选作为main函数)
public class TestTess4j {
public static void main(String args[]) {
File imageFile = new File("eurotext.tif");
Tesseract instance = Tesseract.getInstance();
try {
String result = instance.doOCR(imageFile);
System.out.println(result);
} catch (Exception e) {
System.err.println(e.getCause());
}
}
}
右击运行,java applicatio