Ask Your Question

Revision history [back]

Recognizing some text (but not OCR) in opencv 2.4.9

Using opencv, I identify interesting contours in images, individually rotate them back to angle zero, and crop them to obtain exactly what is needed. These images are then saved to disk or inserted into a database, etc. So far, so good.

The problem is rotating them back to zero is not necessary correct. From there, I may need to rotate them another 90, 180, or 270 degrees to make sure the final saved images are right-side-up.

Each image contains English-language text. I don't need to perform OCR to "read" the text, but I was thinking that maybe I could leverage this and attempt to detect a few letters. If a few letters were correctly detected, then I'd know the image was rotated correctly. Otherwise I'd rotate another 90° and attempt again.

Can this text recognition be done in OpenCV? I see on the web that v3 has some new OCR capabilities, but on Ubuntu we're still on v2.4.9 of OpenCV.

Here is an example image I've captured, rotated to zero, and cropped, but which obviously still needs to be rotated another 90° CCW:

image description