Deskew letters

asked 2014-06-01 15:57:02 -0600

valorcurse gravatar image

Hello,

I have been looking for a way to de-skew characters to be later used for OCR purposes, but haven't been able to find or think of a way to accomplish it, thought maybe anyone had a good idea or could point me in the right direction.

Here's the problem:

These are the filled contours of the plate's text I've retrieved from an image. The plate has already been de-skewed by applying a perspective warp on the minRectArea which fixes the rotation problem, but there's still a slight vertical skew to each letter that seems to be problematic for Tesseract, the OCR engine I'm using.

plate

If I try to apply another perspective warp to each individual character, the same way I did to the plate, I get the following undesired results:

plate

Any ideas or pointers on how to fix this?

Thanks

edit retag flag offensive close merge delete

Comments

Did you try to find minAreaRect for each individual character and its angle of rotation and simply rotate individual character in the opposite direction? It should work for most characters and you should definitely not get this what happened to your G letter.

Witek gravatar imageWitek ( 2014-06-01 16:14:13 -0600 )edit

I have, the letters will then be positioned with the longest size horizontally. This creates a better position for the 'G', yet still not a correct position and the rest of the characters will be worse off. It looks like this:

plate

valorcurse gravatar imagevalorcurse ( 2014-06-02 02:58:45 -0600 )edit