如何使用OpenCV的+的tesseract在Android的准确的文字识别?如何使用、准确、文字、tesseract

2023-09-05 09:47:08 作者:寂寞半支烟

我想使用的OpenCV(安卓),用于处理利用相机拍摄,然后把它传递给的tesseract的文本图像(位)的认可,但我没有得到,直到图像好成绩是非常(几乎没有噪音)的罚款。 目前,我在执行以下处理上拍摄的图像为: 1.应用高斯模糊。 2.自适应阈值:二值化图像。 3.反相颜色,使背景的黑色。 然后使经处理的图像,以的tesseract

I am trying to use OpenCV (Android) for processing image taken using camera and then pass it to Tesseract for text (digits) recognition but am not getting good results till the images are very (almost no noise) fine. Currently I am performing below processing on taken images as: 1. Applying Gaussian blur. 2. Adaptive threshold: to binarize the image. 3. Inverting colours to make background black. Then passing the processed image to Tesseract.

但我没有得到较好的效果。

But I am not getting good results.

请建议具体步骤/方法我可能需要进一步传递到的tesseract或阶段,而在处理的tesseract之前处理图像。

Please suggest what steps/measures I may take further to process image before passing to Tesseract or at stage while processing at Tesseract.

此外,是否有这个在Android的任何其他更好的库?

Also, are there any other better libraries in Android for this?

推荐答案

您可以隔离/检​​测字符图像。这可以通过强大的算法来完成,如笔划宽度变换。

You can isolate/detect characters in images. This can be done with powerful algorithms such as the Stroke Width Transform.

下面的步骤,我的工作还有:

The following steps worked well with me:

获取图像的灰度。 执行的灰度图像Canny边缘检测。 在应用高斯模糊的灰度图像(存储在单独的矩阵) 从步骤2和输入矩阵; 3成 SWT 算法 在二值化(门限)得到的图像。 饲料形象的tesseract。 Obtain grayscale of image. Perform canny edge detection on grayscale image. Apply gaussian blur on grayscale image(store in seperate matrix) Input matrices from steps 2 & 3 into SWT algorithm Binarize(threshhold) resulting image. Feed image to tesseract.

请注意,对于第4步,您将需要建立链接C ++库,然后导入到你的Andr​​oid项目的 JNI 的包装。此外,你需要做的微调整的所有步骤,以获得最好的效果。但是,这至少应该让你开始。

Please note, for step 4 you will need to build the c++ library in the link and then import into your android project with JNI wrappers. Also, you will need to do micro tweaking for all steps to get the best results. But, this should at least get you started.