|
|
@@ -1,5 +1,7 @@
|
|
|
import cn.reghao.tnb.file.app.zdisk.model.vo.FileTree;
|
|
|
import cn.reghao.tnb.oss.api.constant.ObjectType;
|
|
|
+import net.sourceforge.tess4j.Tesseract;
|
|
|
+import org.junit.jupiter.api.Test;
|
|
|
import org.mockito.junit.MockitoJUnitRunner;
|
|
|
|
|
|
import java.io.File;
|
|
|
@@ -86,4 +88,19 @@ public class DiskUnitTest {
|
|
|
});
|
|
|
System.out.println("main-thread goto sleep...");*/
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void ocrTest() throws Exception {
|
|
|
+ Tesseract tess = new Tesseract();
|
|
|
+ // 字库位置
|
|
|
+ tess.setDatapath("/home/reghao/Downloads/tess");
|
|
|
+ // 中英文混合
|
|
|
+ tess.setLanguage("eng+chi_sim");
|
|
|
+ //tess.setLanguage("chi_sim");
|
|
|
+// tess.setLanguage("eng");
|
|
|
+
|
|
|
+ String imagePath = "/home/reghao/Downloads/1620438.png";
|
|
|
+ String result = tess.doOCR(new File(imagePath));
|
|
|
+ System.out.println(result);
|
|
|
+ }
|
|
|
}
|