Scripting Resources for DigitalMicrograph™ |
.- |
Align Images |
Function |
Script to align two images using either cross correlation or manual alignment. |
Version |
version:20130508, v1.0 |
Author |
D. R. G. Mitchell |
Acknowledgements |
- |
Comments |
After the shift between the two images is determined, a range of mathematical manipulations can be carried out or image B, shift corrected relative to image A, can be displayed. Alignment can be done via cross correlation (automatic) or manually. The use of the Sobel edge filtering option will generally improve cross correlation values, especially with feature/contrast-poor images. The 'blank' option will blank out any areas in the final result which do not overlap with the first image. Two modes of manual alignment are provided - rapidly alternating between the two images or showing them simultaneously (overlapped). Alignment is with done with the arrow keys and is terminated by hitting the Space Bar. |
System Requirements |
Tested on GMS 1.83, but should be compatible with GMS 2.x - please advise if not. |
Known Issues |
Both images must be the same size. If using cross-correlation (automatic alignment), the images must also have dimensions which are a power of 2 (eg 256 x 256, 512 x 1024, 2048 x 2048 etc.). Sub-pixel alignment precision is not implemented and alignments are rounded to the nearest pixel. Background threading has not been implemented here, so when carrying out a manual alignment, the script runs in a loop. All dialog controls are suspended during this time. The program will look for keyboard arrow strokes with which to do the alignment, and space will terminate the alignment loop. The CPU will run flat out during this loop - avoid leaving it running longer than necessary. |
Supported |
Yes. |
Included Files |
Single script file. |
Source Code |
See attached script file. |