I deal with a lot of image processing. This can be within the context of creating a large composite of aerial photographs, correcting spherical images for lateral shifts, or template matching tables for data digitization and transcription.
However, a lot of these efforts rely in some way or shape on image alignment techniques. As such I thought it would be a nice to list some of the most common techniques in a small python script for further reference.
The python script, hosted on github, covers three different methods for calculating image registration / alignment transformation information and returning transformed images.
- FFT phase correlation
- Enhanced Correlation Coefficient (ECC) maximization
- Feature based registration
In this list, phase correlation is the simplest method and only calculates the translation (shift) of one image compared to the other. In contrast, the ECC methodology can compensate for both shifts, shifts + rotations (euclidean), shifts + rotation + shear (affine), or homographic (3D) transformations of one image to the next. The feature based methodology uses a homographic representation but uses features within the image rather than a correlation based method on the whole image to search for these values.
Depending on the complexity of the task a matching method should be chosen. In the github repo I’ve included a worked example on how to align two images taken by separate but closely located cameras (either on the same physical system or different ones). The worked example allows you to play around with some of your own data without too much coding. I hope this helps some with their image alignment problems.