简体   繁体   中英

How to use OpenCV+Tesseract for accurate Text recognition in Android?

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.

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

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:

  1. Obtain grayscale of image.
  2. Perform canny edge detection on grayscale image.
  3. Apply gaussian blur on grayscale image(store in seperate matrix)
  4. Input matrices from steps 2 & 3 into SWT algorithm
  5. Binarize(threshhold) resulting image.
  6. Feed image to tesseract.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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