# How can I rotate images depends on a specific angle ?

Hi,

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 close merge delete

2

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

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

Sort by ยป oldest newest most voted

getRotationMatrix2D, warpAffine

http://docs.opencv.org/doc/tutorials/...

P.S.:

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)

more

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

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

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

( 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 ...

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

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

( 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?

( 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.

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

( 2015-03-25 07:32:55 -0500 )edit
1

@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.

( 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.

( 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 :)

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

Official site

GitHub

Wiki

Documentation