November 2018
Intermediate to advanced
492 pages
12h 19m
English
In this section, we will demonstrate how two image descriptors can be matched using the brute-force matcher of opencv. In this, a descriptor of a feature from one image is matched with all the features in another image (using some distance metric), and the closest one is returned. We will use the BFMatcher() function with ORB descriptors to match two images of books:
img1 = cv2.imread('../images/books.png',0) # queryImageimg2 = cv2.imread('../images/book.png',0) # trainImage# Create a ORB detector objectorb = cv2.ORB_create()# find the keypoints and descriptorskp1, des1 = orb.detectAndCompute(img1,None)kp2, des2 = orb.detectAndCompute(img2,None)# create a BFMatcher object ...Read now
Unlock full access