Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, September 16, 2012 4:48:04 AM(UTC)

Daoud  
Daoud

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.

File Attachment(s):
CS_User_Assisted_Resize_And_Rotation.zip (272kb) downloaded 294 time(s).
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, November 12, 2012 3:04:04 AM(UTC)

Daoud  
Daoud

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.

File Attachment(s):
CS_User_Assisted_Resize_And_Rotation.zip (393kb) downloaded 291 time(s).
 
#3 Posted : Monday, July 30, 2018 8:35:49 AM(UTC)

Hussam  
Hussam

Groups: Registered, Tech Support
Posts: 14


Updated the project to use v20 references and VS2017. The code remains very similar to previous uploads otherwise
File Attachment(s):
CS_User_Assisted_Resize_And_Rotation.zip (424kb) downloaded 250 time(s).
.
Hussam Barouqa
Developer Support Engineer
LEAD Technologies, Inc.

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

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.155 seconds.