1. generate a panorama
2. Image Re-projection
3. Homography from a pair of images
4. Computing inliers and outliers
5. Details of constructing panoramas
5 steps to make a panorama
– comupte images
– detection and matching
– warping -> aligning images
– blending, fading, cutting
– cropping (optional)
Align images: Translate
A Bundle of Rays Contains all views
View 1, View 2 -> Synthetic
Possible to generate any synthetic camera view as long as it has the same center of projection
Image Re-Projection
To relate two images from the same camera center and map a pixel from PP1 to PP2
– cast a ray through each pixel in PP1
– Draw the pixel where that ray intersects PP2
Recall: Image warping
traslaion, scale, rotation, affine, perspective
Computing Homography
(x,y), (wx’/w, wy’/w)= (x’,y’)
To compute the homography H, given pairs of corresponding points in two images, we need to set up an equation
Set up a system of linear equation
Ah = b
where vector of unknowns
h = [a,b,c,d,e,f,g,h]^T
Need at least 8 equations, but the more the better
solve for h. if over-constrained, solve using least-equation
Warp into a shared coordinate space
Random sample consensus (RANSAC)
Select one match count INLIERS
Find “average” translation vector
1. select four feature pairs
2. compute homography H(exact)
3. compute inliers where SSD(Pin’, H Pin) < ε
“””Building a (crude) panorama from two images.””” import numpy as np import cv2 # Read images img1 = cv2.imread(“einstein.png”) # left image img2 = cv2.imread(“davinci.png”) # right image print “Image 1 size: {}x{}”.format(img1.shape[1], img1.shape[0]) print “Image 2 size: {}x{}”.format(img2.shape[1], img2.shape[0]) cv2.imshow(“Image 1”, img1) cv2.imshow(“Image 2”, img2) # Convert to grayscale img1_gray = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY) img2_gray = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY) # Initialize ORB detector object orb = cv2.ORB() # or cv2.SIFT() in OpenCV 2.4.9+