改善与OpenCV的Andr​​oid上的tesseract性能 [英] improve Tesseract performance with OpenCV on Android

查看:815
本文介绍了改善与OpenCV的Andr​​oid上的tesseract性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用实时OCR一个Android应用程序。我使用OpenCV中的tesseract和图书馆。但性能非常差,甚至在我的Galaxy SIII。有任何改善性能的方法?这是我的code:

I am working on a Android application using real-time OCR. I using OpenCV and Tesseract Library. But the performance is very poor, even on my Galaxy SIII. There are any methods to improve the performance? It is my code:

    Mat mGray = new Mat();
capture.retrieve(mGray);
Bitmap bmp = Bitmap.createBitmap(mGray.cols(), mGray.rows(), Bitmap.Config.ARGB_8888);
tessBaseApi.setImage(bmp);
String recognizedText = tessBaseApi.getUTF8Text();
Log.i("Reg", recognizedText);

可否的tesseract OCR的速度被传递位图向的tesseract API减少?我要传递给API的tesseract之前执行什么pre-处理?

Will the speed of tesseract OCR be reduced by passing bitmap to the Tesseract API? What pre-processing should I perform before passing to the Tesseract API?

推荐答案

您可以拥有的tesseract只能做识别合格1,这样它跳过经过2至9,
当它调用<一个href=\"https://github.com/rmtheis/tess-two/blob/master/tess-two/jni/com_google$c$c_tesseract_android/src/ccmain/control.cpp\"相对=nofollow> recog_all_words()。

You can have Tesseract only do the recognition pass 1, so that it skips passes 2 through 9, when it calls recog_all_words().

更改<一下面一行href=\"https://github.com/rmtheis/tess-two/blob/master/tess-two/jni/com_google$c$c_tesseract_android/src/api/baseapi.cpp\"相对=nofollow> baseapi.cpp
并重建你的tesseract库项目:

Change the following line in baseapi.cpp and rebuild your Tesseract library project:

if (tesseract_->recog_all_words(page_res_, monitor, NULL, NULL, 0)) {

将其更改为:

if (tesseract_->recog_all_words(page_res_, monitor, NULL, NULL, 1)) {

这篇关于改善与OpenCV的Andr​​oid上的tesseract性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆