我尝试使用下面的图像使用Aspose OCR库提取文本内容,遗憾的是结果不正确。
OcrEngine.getText()
会返回如下内容:
run:
HEY: + it^7--+i-*l?/r]-*+\>/
m
^s^us^^stm?s^
M\-i-/!$~-
BUILD SUCCESSFUL (total time: 1 minute 38 seconds)
这是我的代码:
import com.aspose.ocr.core.publicapi.*;
import com.aspose.ocr.core.publicapi.pal.PalFontFamily;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException{
String imagePath = "hi.jpg";
String etalonFile = "englishStandarts.xml";
String fontFile = "arialAndTimesAndCourierRegular.xml";
String resourcePath = "resources.zip";
OcrEngine ocr = new OcrEngine(resourcePath, new int[] {4, 5, 6, 7 }, etalonFile, fontFile);
ocr.getConfig().setNeedRotationCorrection(false);
File image = new File(imagePath);
ocr.setImage(image);
ILanguage language = Language.load("english");
ocr.getLanguages().addLanguage(language);
try{
if(ocr.process()){
System.out.println("HEY: "+ocr.getText());
}
}catch(Exception e){
System.err.println(e);
}
}
}
答案 0 :(得分:1)
从这张图片中读取文字似乎有问题。即使最新版本也不起作用。请在Aspose论坛http://www.aspose.com/community/forums/aspose.ocr-product-family/493/showforum.aspx报告此问题。
我与Aspose一起担任开发者布道者。