Image stitching for arbitrary camera motion
This article covers algorithm for stitching multiple images obtained from arbitrary motion of camera. Most of us are aware of panorama image. Panorama is obtained by stitching multiple images obtained from horizontal motion of a camera. The algorithm presented in this article is a generalization to arbitrary camera motions.
Feature points (keypoints) of an image
Feature points (also called interest points or keypoints) are distinct locations in an image. They typically represent areas with high contrast or structural uniqueness — like corners, blobs, or junctions. Good keypoints are invariant to changes in scale, rotation, and (to some extent) illumination. Feature points are used as reference points to match adjacent images. We use SURF (Speeded-up robust feature) algorithm to detect feature points.Feature descriptors
A descriptor is a numerical vector that describes the appearance (local texture) around a keypoint. It encodes the local image structure in a way that allows comparison across different images. Descriptors are designed to be robust to scale, rotation, noise, and illumination changes. We use SURF algorithm to generate both feature points and feature descriptors. When two keypoints from different images have similar descriptors, they are considered a match.Algorithm: Image Stitching for arbitrary camera motion
Input:
- A sequence of overlapping images \( \{I_1, I_2, \dots, I_N\} \)
- Scaling factor \( s \in (0, 1] \)
Output:
- A stitched panoramic image \( P \)
Steps:
- Preprocessing
Load the sequence of images and resize each image using the factor \( s \) to reduce computation. Also, convert images to grayscale, if required, for feature extraction. -
Feature detection and extraction
- Detect keypoints in the first image \( I_1 \) using a robust detector (e.g., SURF).
- Extract descriptors from the detected keypoints.
- Initialize transformation list with identity: \(T_1 = I\)
-
Image registration
- For each image \( I_i \) where \( i = 2 \) to \( N \):
- Detect keypoints and extract descriptors.
- Match descriptors with those from \( I_{i-1} \).
- Estimate projective transformation \( H_i \) using matched keypoints.
- Update transformation for \(I_i\). \[T_i = T_{i-1} \cdot H_i\]
-
Transformation normalization
- Select reference image index \( m = \lceil N/2 \rceil \).
- Compute inverse transformation T_m^{-1}
- Normalize all transformations:
\[T_i \leftarrow T_m^{-1} \cdot T_i \quad \text{for all } i\]
-
Output canvas estimation
Compute output limits of each image under transformation \( T_i \). Determine global minimum and maximum in \( x \) and \( y \) directions to estimate canvas size. -
Stitched image construction
- Initialize a blank canvas of computed size.
- For each image \( I_i \):
- Warp the image using \( T_i \).
- Overlay it onto the canvas using alpha blending.
Remarks:
Use advanced blending techniques to adjust lighting conditions.Demonstration
For demonstration, a set of 7 images of a messy hostel room were snapped by a mobile camera. The images were scaled down to reduce processing time.Input images
Stitched image
Source code (MATLAB)
MATLAB code for stitching images with arbitrary camera motionAuthor
Anurag Gupta is an M.S. graduate in Electrical and Computer Engineering from Cornell University. He also holds an M.Tech degree in Systems and Control Engineering and a B.Tech degree in Electrical Engineering from the Indian Institute of Technology, Bombay.
Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Similar content
Past Comments