It'd be a nice addition in the Feature Detection tutorial using FlannBasedMatcher in Python (asking here since code.opencv.org is down) [closed]
Since FlannBasedMatcher.knnMatch requires CV_32F for descriptor arrays
It'd be nice to have one of the examples use ORB rather than SIFT for FlannBasedMatcher and then detect and computer with ORB
kp1 = orb.detect(sample, None)
kp2 = orb.detect(display, None)
# Compute the descriptors
kp1, des1 = orb.compute(sample, kp1)
kp2, des2 = orb.compute(display, kp2)
# Convert descriptor array to float32
des1 = des1.astype(np.float32)
des2 = des2.astype(np.float32)
# Finds the matches in order of increasing distance
matches = fbm.knnMatch(des1,des2,k=2)
matchesMask = [[0,0] for i in range(len(matches))]
for i,(m,n) in enumerate(matches):
if m.distance < 0.7*n.distance:
matchesMask[i]=[1,0]
draw_params = dict(matchColor = (0,255,0),
singlePointColor = (255,0,0),
matchesMask = matchesMask,
flags = 0)
outImage = cv2.drawMatchesKnn(sample,kp1,display,kp2,matches,None,**draw_params)
outImage = cv2.cvtColor(outImage, cv2.COLOR_BGR2RGB)
plt.imshow(outImage), plt.show()
btw, code.opencv.org does no more exist.
issues go here, (python)tutorials are here