简体   繁体   English

Android-使用tesseract

[英]Android - using tesseract

I'm using tess-two API and it works fine when I have a white paper with black words on it. 我使用的是tess-two API,当我有一张上面有黑色文字的白皮书时,它可以正常工作。 My main problem is it gets some random text when the picture I captured doesn't contain any text. 我的主要问题是,当我捕获的图片不包含任何文本时,它会得到一些随机文本。 I've been searching around but didn't find anything useful. 我一直在搜索,但没有发现任何有用的信息。 Is there any built-in methods to decide if it finds any text or I should use something else? 是否有任何内置方法来确定是否找到任何文本或我应该使用其他内容?

TessBaseAPI baseApi = new TessBaseAPI();
baseApi.init(Environment.getExternalStorageDirectory() + "/tesseract", "eng");
baseApi.setImage(bitmap);
String recognizedText = baseApi.getUTF8Text();
baseApi.end();

Try the HydrogenTextDetector class in the eyes-two project. 在“两眼”项目中尝试HydrogenTextDetector类。

You should already have the source code because you have tess-two, but there is another build step you'll need to run to build the eyes-two project . 您应该已经拥有源代码,因为您有tess-two,但是还需要执行另一个构建步骤来构建“ eyes-two”项目

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM