Ask Your Question

How can I rotate images depends on a specific angle ?

asked 2015-03-19 06:08:44 -0500

RR14 gravatar image

updated 2015-03-25 07:07:56 -0500


I need to rotate all images to spesific angle to do OCR. I have to do it because after polar2cartesian transformation sometimes my characters get cropped. here example of my images.

edit retag flag offensive close merge delete



you can use the warpAffine() or remap() functions to achieve this

theodore gravatar imagetheodore ( 2015-03-19 06:44:13 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-19 06:44:35 -0500

updated 2015-03-20 09:50:26 -0500

getRotationMatrix2D, warpAffine


I now understood that you first need the angle. I think the easiest solution would be to just use two different angles that have the distance of abut half a character. You then use both angles and applies your OCR first on both images. (Or first on the full image and then on the first part of the second). In your case, you could maybe rotate about 15 degrees. (Or you just select some random angles and later merge all detected characters)

edit flag offensive delete link more


all images comes in different angles are these methods detect angle and then rotates ?

RR14 gravatar imageRR14 ( 2015-03-19 07:06:04 -0500 )edit

Sorry, but these questions can easily be solved by reading to documentation.

FooBar gravatar imageFooBar ( 2015-03-19 08:15:54 -0500 )edit

@FooBar I think his problem is more complex than you are suggesting. He thinks that these techniques will automatically detect the angles. Applying a rotation in this case is easy peasy, getting the correct angle for the rotation is far more difficult ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-20 05:21:07 -0500 )edit

Then I am sorry that I tried to help you. Won't happen again.

FooBar gravatar imageFooBar ( 2015-03-21 06:45:15 -0500 )edit

@Rodrane, instead of posting such a ridiculous response put some effort in and answer to remarks made. For example I wondered if you knew the angle to rotate, if not, than please fill in more info.... And looking at your SO topic I am even more baffled, why not share all that info here also and stop complaining?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-24 04:19:32 -0500 )edit

I am not complaining I was kindly told all images can come in different angles those methods can detect angle and rotated based on this angles.

but his answer was like I did not read documentation thousand times.

RR14 gravatar imageRR14 ( 2015-03-24 10:07:19 -0500 )edit

And could you please stop removing your comments and altering your posts? That's just childish.

FooBar gravatar imageFooBar ( 2015-03-25 07:32:55 -0500 )edit

@FooBar, lets back down here. Since he doesnt want any clear help just ignore him. Thought it is kind of stupid to remove all the info from the SO topic.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-25 07:43:24 -0500 )edit

I just don't want to be part of weird conversation. actually tried delete post but system does not allowed me.

RR14 gravatar imageRR14 ( 2015-03-25 08:10:01 -0500 )edit

@RR14 you are not part of a weird conversation, now you are simply making others look plain idiots :)

StevenPuttemans gravatar imageStevenPuttemans ( 2015-03-25 09:02:44 -0500 )edit

Question Tools

1 follower


Asked: 2015-03-19 06:08:44 -0500

Seen: 1,801 times

Last updated: Mar 25 '15