LEADTOOLS Support
Imaging
Imaging SDK Questions
User-assisted alignment (resize, rotate and shift) of 2 images.
While some posts in this topic are more current, this topic was posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Sunday, September 16, 2012 4:48:04 AM(UTC)
Groups: Registered
Posts: 256
The attached is a VS2008 C# project that uses LEADTOOLS v17.5 to implement a way of aligning one image (secondary) to have the same orientation and position of a primary image.
This is done by calculating rotation and shifting amount needed to align any 3 points chosen by the user.
This project works as follows:
1) The user loads a correct image that will be used as a reference and that would be image1 (primary).
2) The user loads the secondary image that needs to be processed and that would be image2.
3) The user chooses 3 points on image1 by clicking on them to be used as destination reference marks.
4) The user chooses the same 3 points on image2.
5) Click "Start processing" button.
6) The project will calculate the slopes for 2 points at a time for each image.
7) Use the Tan inverse to calculate the angles for points of the 2 images.
8) Calculate the difference between the corresponding points in both images.
9) Add 180 if the difference is less than 90 or subtract 180 if the difference is less than -90. This is needed when the slope value is too large in the positive or negative directions.
10) Calculate the average of angles differences and use it as the angle to rotate image2 with.
11) Calculate the new position of each point in image2 and then compare to the position of points in image1 to see if image2 is shifted or not.
12) Shift image2 if it needs shifting.
Notes:
1) The accuracy of the project depends on the accuracy of matching the points by the user.
2) The project does not resize images so if you load two images with different DPI, you will need to compensate for that by modifying the code so that it takes into consideration the size difference.
#2
Posted
:
Monday, November 12, 2012 3:04:04 AM(UTC)
Groups: Registered
Posts: 256
The attached VS2008 project adds resizing of the image if it needs to be resized by calculating the ratio of the average distances of points in Image1 to Image2.
This works best if the 2 images are close in size.
#3
Posted
:
Monday, July 30, 2018 8:35:49 AM(UTC)
Groups: Registered, Tech Support
Posts: 14
Updated the project to use v20 references and VS2017. The code remains very similar to previous uploads otherwise
.
Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Imaging
Imaging SDK Questions
User-assisted alignment (resize, rotate and shift) of 2 images.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.