The following are the steps that you will follow (you will have to implement a few functions) to implement image stitching/mosaicing:
- First, implement the compute_homography() function, which computes the homography matrix, h, from two given input images:
def compute_homography(image1, image2, bff_match=False):
- Similar to the previous recipe, first compute keypoints/descriptors (this time use SIFT):
sift = cv2.xfeatures2d.SIFT_create(edgeThreshold=10, sigma=1.5, \ contrastThreshold=0.08) kp1, des1 = sift.detectAndCompute(image1, None) kp2, des2 = sift.detectAndCompute(image2, None)
- Match the descriptors using brute-force knnMatch() and then select the good matches using Lowe's ratio test:
bf = cv2.BFMatcher() # Brute ...