我正在分析ocr-reader示例项目:https://github.com/googlesamples/android-vision/tree/master/visionSamples/ocr-reader
我的目标是用Android Vision取代我为Android(使用OpenCV和Tesseract)定制的"文本到图像"实现。
我找不到任何方法为OCR处理器应用高级配置。例如,在我的应用程序中,只允许使用一组预定义的符号。为此,我在我的应用程序中使用以下代码:
api.SetVariable("tessedit_char_whitelist", "ABJOKEA1234");
这有助于避免混淆例如0和O。
有办法做到这一点与android视觉?在构建texttrecognizer时,我没有看到任何选项:
TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();
一般来说,Google计划扩展库的可配置性吗?例如:- 裁剪源图像
- 提供自定义OCR培训文件
还是应该保持一个简单的库,只有常见的功能?
谢谢你的帮助!
我也在努力,我正试图使一个具有移动视觉的名片阅读器,到目前为止,当检测到文本时,我正在使用使用实时生成的字符串的条件检查。
if (mText == null) {
return;
}
if(mText.getValue().contains("@") && mText.getValue().contains(".") && !mText.getValue().equals(mText.getValue().toUpperCase())){
Log.e("mTextemail",mText.getValue());
email=mText.getValue();
}
if (mText.getValue().startsWith("+")|| mText.getValue().startsWith("0")&& mText.getValue().contains("+-0123456789/-#")&& !mText.getValue().contains("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")){
Log.e("mTextphone",mText.getValue());
phone=mText.getValue();
}
if (!mText.getValue().contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ")&& !mText.getValue().contains("0123456789-/#") && !mText.getValue().contains("abcdefghijklmnopqrstuvwxyz")){
Log.e("mTextcompanyName",mText.getValue());
companyName=mText.getValue();
}if(mText.getValue().startsWith("ABCDEFGHIJKLMNOPQRSTUVWXYZ" )&& mText.getValue().endsWith("abcdefghijklmnopqrstuvwxyz")){
name=mText.getValue();
}
if(name ==null){
name="Was not specified";
}
if(email ==null){
email="Was not specified";
}
if(phone ==null){
phone="Was not specified";
}
if(companyName ==null){
companyName="Was not specified";
}
它以70%的精度打印日志,也许我们可以互相帮助,我也希望这些正确的日志显示在我使用的界面,但它不工作的活动。如果你有任何你发现的技巧或技巧,请分享。