# Thread: calculating the Rotation of Images

1. Novice
Join Date
Jun 2013
Posts
46
Thanks
24
Qt products
Platforms

## calculating the Rotation of Images

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

2. Guru
Join Date
Mar 2009
Location
Brisbane, Australia
Posts
7,734
Thanks
13
Thanked 1,610 Times in 1,537 Posts
Qt products
Platforms
Wiki edits
17

## Re: calculating the Rotation of Images

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.

Originally Posted by 2lights
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.

3. ## The following user says thank you to ChrisW67 for this useful post:

2lights (6th August 2013)

4. Novice
Join Date
Jun 2013
Posts
46
Thanks
24
Qt products
Platforms

## Re: calculating the Rotation of Images

Thanks, got opencv working

My new Problem:
Once i calculated the orientation needed, i need to:

Kind Regards