The attached project uses OCR to automatically align an image that's rotated, shifted or both, based on an aligned reference image. You can see the program in action by following these 3 steps:
1- Build and run the project and either load 2 images that contain some similar words at similar locations or use the 2 default test images.
2- Select 3 words using 3 different zones in the reference (left-side) image. Each zone must contain one and only one word.
3- Click the (Process) button, which will display the rotation and shift values then apply them to the right-side image.
For a similar project that relies on the user to select 3 similar points in the 2 images instead of using OCR, see this forum thread:
http://support.leadtools.com/CS/forums/41654/ShowPost.aspx
You can load a new image (Image to be aligned) and click (Process) as many times as you want to examine different images without the need to re-select the regions from the reference image. In order to get good results, you need to take these points into consideration:
1- The 3 words in the reference image should be readable using OCR.
2- The image to align can be rotated and shifted within reasonable limits. If the 2 images are substantially different, correct alignment cannot be expected to happen.
3- You can load a new image for alignment and process it using the current zones selected in the current reference image without resetting.
4- Both images should be of similar width and height.
5- Make sure that the words you are using as a reference are also clear in the image to be aligned.
6- Try to choose a word that isn't repeated in the area surrounding it.
7- Depending on the image to be aligned, you might be in need to modify the calculations of the zones to get better results.
8- Include any dots, apostrophes, question marks or any other characters that follow the word. For example, in the word ( buildings' ), you should include the last apostrophe when you choose the reference.
Try the program as is at first and notice the zones drawn in the image to be recognized. If the zones in the image to be recognized require changing their sizes, you can do that in code. Look for them in the "btnProcess_Click" event, which is the last coded event in the project.
Faris Shahin
Developer Support Engineer
LEAD Technologies, Inc.