This assignment explores making image panoramas. Take images and write code to construct panoramas in two ways, first using hand selected correspondeces between images, and then using automatically found correspondes between images. For each panorama, at least 4 photographs are used.
In this part, I use hand specified correspondences.
I click the graph (ginput()
in MATLAB) to manually set correspondences between two graphs.
Hence, I get two group of points.
I normalize the points by function [normal_Points T]= Normal(Points)
, and then compute the homography
for the two normalized point groups by function H_normal = Compute_H_normal(Points,Points_prime)
.
Leveraging these two functions, I can compute the homography H for the two original images by
function H = Compute_H(Points,Points_prime)
.
Code of the three functions are provided in Compute_H.m.
In this part, I detect and match correspondences automatically via
MATLAB functions detectSURFFeatures()
, extractFeatures()
and matchFeatures()
.
Then, I estimate, with RANSAC, homography H of the correspondences for the two images via
MATLAB function estimateGeometricTransform()
.
Integrating these functions, I get function tform = auto(I,I_prime)
to automatically compute
homography. Code is provided in auto.m.
Finally, by the computed homography, by hand or automatically, I can use imtransform()
to transform each individual image, and then blend it to the main photograph, or Base in my code,
by gradient domain blending.
The gradient domain blending function output = gra_proc(source,target)
is a little variation from
previous assignments. The code is provided in gra_proc.m.
Since the HD photographs will make the matrix too large, especially in the gradient domain processing, and hence will cause very long processing time or even may result in "OUT OF MEMORY" MATLAB error. Thus, I always resize the images to 0.25 of the original at very beginning of the whole processing.
The scripts for making the panorama by hand and automatically are homo.m and auto_homo.m, respectively
I did 4 sets of examples to show my results. Each of them consists of 4 individual photographs. I will give very detailed step-by-step result for one of them, and for others, I will just post the final results for manual correspondences and automatic correspondences.
By hand
Manually chosen 8 correspondent point pairs, noted by blue circles.
Automatic
Chosen correspondences automatically, and use RANSAC to find proper pairs.
Result Summary
The following are the results for the other 3 examples. I omit the intermediate steps for them and just show the final resualts.