Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

read numbers and letters from an image using openCV

Tags:

I am developing an application to read the letters and numbers from an image using opencv in c++. I first changed the given colour image and colour template to binary image, then called the method cvMatchTemplate(). This method just highlighted the areas where the template matches.. But not clear.. I just dont want to see the area.. I need to parse the characters(letters & numbers) from the image. I am new to openCV. Does anybody know any other method to get the result??

alt text

Image is taken from camera. the sample image is shown above. I need to get all the texts from the LED display(130 and Delft Tanthaf).

Friends I tried with the sample application of face detection, It detects the faces. the HaarCascade file is provided with the openCV. I just loaded that file and called the method cvHaarDetectObjects(); To detect the letters I created the xml file by using the application letter_recog.cpp provided by openCV. But when I loading this file, it shows some error(OpenCV error: UnSpecified error > in unknown function, file ........\ocv\opencv\src\cxcore\cxpersistence.cpp,line 4720). I searched in web for this error and got the information about lib files used. I did so, but the error still remains. Is the error with my xml file or calling the method to load this xml file((CvHaarClassifierCascade*)cvLoad("builded xml file name",0,0,0);)?? please HELP...

Thanks in advance

like image 635
asifkt Avatar asked Jan 16 '11 15:01

asifkt


People also ask

How do I extract digits from an image in Python?

How do I extract digits from an image in Python? Convert image to grayscale and Otsu's threshold. Perform morph close with a horizontal kernel to merge the numbers into a single contour. Find contours and filter using a minimum threshold area to filter out the large outer contour.

Does OpenCV have OCR?

The OpenCV OCR is a command present in the open-source computer vision library, which consists of various functions that aid in programming that is majorly designed to help in programs associated with computer vision that work on a real-time platform and computation.


1 Answers

As of OpenCV 3.0 (in active dev), you can use the built-in "scene text" object detection module ~

  • Reference: http://docs.opencv.org/3.0-beta/modules/text/doc/erfilter.html

  • Example: https://github.com/Itseez/opencv_contrib/blob/master/modules/text/samples/textdetection.cpp

The text detection is built on these two papers:

  • [Neumann12] Neumann L., Matas J.: Real-Time Scene Text Localization and Recognition, CVPR 2012. The paper is available online at http://cmp.felk.cvut.cz/~neumalu1/neumann-cvpr2012.pdf

  • [Gomez13] Gomez L. and Karatzas D.: Multi-script Text Extraction from Natural Scenes, ICDAR 2013. The paper is available online at http://refbase.cvc.uab.es/files/GoK2013.pdf

Once you've found where the text in the scene is, you can run any sort of standard OCR against those slices (Tesseract OCR is common). And there's now an end-to-end sample in opencv using OpenCV's new interface to Tesseract:

  • https://github.com/Itseez/opencv_contrib/blob/master/modules/text/samples/end_to_end_recognition.cpp
like image 169
Kaolin Fire Avatar answered Sep 20 '22 19:09

Kaolin Fire