PDA

View Full Version : calculating the Rotation of Images



2lights
5th August 2013, 15:34
There are 2 images loaded into 2 seperate labels
The user identifies(clicks) 3 points in the 1st image
and identifies 3 points in the second image similar to the 1st image.

I want to calculate the amount of rotation needed and translation needed for the points to be alligned
(I'll probably have to calculate the average rotation of each point before i rotate image 2 to allign with image 1) ->ideas

I know more or less how to do it using matrices and some functionaltiy in opencv...
But since I cant get opencv to operate in my windows qt environment

Is there a way around it?
Other Ideas on this matter :)

Thank you

ChrisW67
6th August 2013, 09:10
Unless the triangles formed by the three points in each image have identical internal angles then rotate, translate and scale will not be adequate to align the points. If the images were taken from different viewpoints then you might have perspective corrections to make. In most cases you would be looking for a closest match for some definition of closest.


I know more or less how to do it using matrices and some functionaltiy in opencv...
But since I cant get opencv to operate in my windows qt environment

If you can do it this way why not work the OpenCV problem.

You could attack this another way. Have the user select three points in the first image. Generate a congruent triangle over the second image and give the user controls to rotate, scale, and translate the triangle to match three points in the second image. Then you have the transforamtion required.

2lights
6th August 2013, 11:28
Thanks, got opencv working

My new Problem:
Once i calculated the orientation needed, i need to:
http://www.qtcentre.org/threads/55677-Overlay-2-images-in-QLabel

Kind Regards