Ask Your Question

Rotate image

asked 2015-01-13 03:52:45 -0500

spinter696 gravatar image

I explain the problem. For example, I have a rotated square like a diamond , and I want to have the square in a original position as you can see your laptop's screen for example, and the result I want So the first step I think is the best one is detect the borders of the image using a filter and after rotating the image basing on, for example, the left border. and putting it vertical to the bottom of the screen.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-01-13 04:31:45 -0500

thdrksdfthmn gravatar image

updated 2015-01-13 04:34:57 -0500

You need to detect somehow the rectangle, maybe with a threshold + findContours and then using minAreaRect, you will find the rotated rectangle. By affine transformation, you can rotate it bac to the wanted "vertical position".

BTW I cannot access the second link...

edit flag offensive delete link more



You can use cv::getRotationMatrix2D to get the rotation/translation matrix for your transformation.

FooBar gravatar imageFooBar ( 2015-01-13 05:07:29 -0500 )edit

yes I have forgotten about it, but I think it is mentioned in the affine transformation

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-01-13 07:26:29 -0500 )edit

Ok I will try it thank you guys

spinter696 gravatar imagespinter696 ( 2015-01-15 06:55:33 -0500 )edit

Question Tools

1 follower


Asked: 2015-01-13 03:52:45 -0500

Seen: 448 times

Last updated: Jan 15 '15