Ask Your Question
0

Rotate image

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

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, http://pullmonkey.com/tag/gems/ and the result I want http://jwilson.coe.uga.edu/emt725/SqT.... 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
2

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

thdrksdfthmn gravatar image

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

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

Comments

1

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

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

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 -0600 )edit

Ok I will try it thank you guys

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

Question Tools

1 follower

Stats

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

Seen: 602 times

Last updated: Jan 15 '15