Ask Your Question
0

Rotate image

asked Jan 13 '15

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.

Preview: (hide)

1 answer

Sort by » oldest newest most voted
2

answered Jan 13 '15

thdrksdfthmn gravatar image

updated Jan 13 '15

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

Preview: (hide)

Comments

1

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

FooBar gravatar imageFooBar (Jan 13 '15)edit
1

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

thdrksdfthmn gravatar imagethdrksdfthmn (Jan 13 '15)edit

Ok I will try it thank you guys

spinter696 gravatar imagespinter696 (Jan 15 '15)edit

Question Tools

1 follower

Stats

Asked: Jan 13 '15

Seen: 662 times

Last updated: Jan 15 '15