Image registration is a digital image processing technique which helps us align different images of the same scene. For instance, one may click the picture of a book from various angles. Below are a few instances that show the diversity of camera angle.
Now, we may want to “align” a particular image to the same angle as a reference image. In the images above, one may consider the first image to be an “ideal” cover photo, while the second and third images do not serve well for book cover photo purposes. The image registration algorithm helps us align the second and third pictures to the same plane as the first one.
How does image registration work?
Alignment can be looked at as a simple coordinate transform. The algorithm works as follows:
- Convert both images to grayscale.
- Match features from the image to be aligned, to the reference image and store the coordinates of the corresponding keypoints. Keypoints are simply the selected few points which are used to compute the transform (generally points that stand out), and descriptors are histograms of the image gradients to characterize the appearance of a keypoint. In this post, we use ORB (Oriented FAST and Rotated BRIEF) implementation in the OpenCV library, which provides us with both keypoints as well as their associated descriptors.
- Match the keypoints between the two images. In this post, we use BFMatcher, which is a brute force matcher.
BFMatcher.match()retrieves the best match, while
BFMatcher.knnMatch()retrieves top K matches, where K is specified by the user.
- Pick the top matches, and remove the noisy matches.
- Find the homomorphy transform.
- Apply this transform to the original unaligned image to get the output image.
Applications of Image Registration –
Some of the useful applications of image registration include:
- Stiching various scenes (which may or may not have the same camera alignment) together to form a continuous panaromic shot.
- Aligning camera images of documents to a standard alignment to create realistic scanned documents.
- Aligning medical images for better observation and analysis.
Below is the code for image registration. We have aligned the second image with reference to the third image.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Simple registration form using Tkinter
- Login and Registration Project Using Flask and MySQL
- How to get client_id and client_secret for Python Reddit API registration ?
- OpenCV - Facial Landmarks and Face Detection using dlib and OpenCV
- Transition from OpenCV 2 to OpenCV 3.x
- Image resizing using Seam carving using OpenCV in Python
- OpenCV Python Program to analyze an image using Histogram
- Python Program to detect the edges of an image using OpenCV | Sobel edge detection method
- Reading an image in OpenCV using Python
- Python | Detect corner of an image using OpenCV
- Image Pyramid using OpenCV | Python
- Negative transformation of an image using Python and OpenCV
- Python | Image blurring using OpenCV
- Image Resizing using OpenCV | Python
- Find Circles and Ellipses in an Image using OpenCV | Python
- Image Translation using OpenCV | Python
- Python | Detect Polygons in an Image using OpenCV
- Image Steganography using OpenCV in Python
- Create Local Binary Pattern of an image using OpenCV-Python
- Log transformation of an image using Python and OpenCV
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.