使用Tesseract和Java从图像提取文本时出错

问题描述

enter image description here

**

**

> import net.sourceforge.tess4j.*;
> 
> import java.io.File;
> 
> public class imageTest {
> 
>     public static void main(String[] args) {
> 
>         Tesseract tesseract = new Tesseract();
>         try {
>             tesseract.setDatapath("tessdata/");
>             String text = tesseract.doOCR(new File("images/01_image.png"));
>             System.out.print(text);
>         }
> 
>         catch (TesseractException e) {
>             e.printstacktrace();
>         }
>     } }

**

**: read_params_file:找不到参数:enable_new_segsearch

解决方法

签出https://github.com/tesseract-ocr/tesseract/issues/1620 概括地说,他们说,当您使用新版本的Tesseract和旧版本的受训数据时,就会发生这种情况。检查两个版本是否相同