如何更准确地比较两幅图像之间的特征?
How to more accurately compare the characteristics between two images?
我开发了两种使用 SIFT 和 ORB 的方法,但在我看来,这些点并没有正确对应。我是不是错误地使用了这些功能,还是我需要一些不同的东西?
orb = cv2.ORB_create()
keypoints_X, descriptor_X = orb.detectAndCompute(car1_gray, None)
keypoints_y, descriptor_y = orb.detectAndCompute(car2_gray, None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck = True)
matches = bf.match(descriptor_X, descriptor_y)
matches = sorted(matches, key = lambda x: x.distance)
result = cv2.drawMatches(car1_gray, keypoints_X, car2_gray, keypoints_y, matches[:10], car2_gray, flags = 2)
sift = cv2.SIFT_create()
keypoints_X, descriptor_X = sift.detectAndCompute(car1_gray, None)
keypoints_y, descriptor_y = sift.detectAndCompute(car2_gray, None)
bf = cv2.BFMatcher()
matches = bf.knnMatch(descriptor_X, descriptor_y, k=2)
bom = []
for m,n in matches:
if m.distance < 0.75*n.distance:
bom.append([m])
result = cv2.drawMatchesKnn(car1_gray, keypoints_X, car2_gray, keypoints_y, bom, None, flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
SIFT 和 ORB 的结果如下:
查看 SuperGlue,基于图形神经网络的特征匹配。虽然,他们不提供训练代码,但是提供了室内、室外两种预训练模型。链接,
https://github.com/magicleap/SuperGluePretrainedNetwork
https://psarlin.com/superglue/
https://arxiv.org/pdf/1911.11763.pdf
我开发了两种使用 SIFT 和 ORB 的方法,但在我看来,这些点并没有正确对应。我是不是错误地使用了这些功能,还是我需要一些不同的东西?
orb = cv2.ORB_create()
keypoints_X, descriptor_X = orb.detectAndCompute(car1_gray, None)
keypoints_y, descriptor_y = orb.detectAndCompute(car2_gray, None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck = True)
matches = bf.match(descriptor_X, descriptor_y)
matches = sorted(matches, key = lambda x: x.distance)
result = cv2.drawMatches(car1_gray, keypoints_X, car2_gray, keypoints_y, matches[:10], car2_gray, flags = 2)
sift = cv2.SIFT_create()
keypoints_X, descriptor_X = sift.detectAndCompute(car1_gray, None)
keypoints_y, descriptor_y = sift.detectAndCompute(car2_gray, None)
bf = cv2.BFMatcher()
matches = bf.knnMatch(descriptor_X, descriptor_y, k=2)
bom = []
for m,n in matches:
if m.distance < 0.75*n.distance:
bom.append([m])
result = cv2.drawMatchesKnn(car1_gray, keypoints_X, car2_gray, keypoints_y, bom, None, flags=cv2.DrawMatchesFlags_NOT_DRAW_SINGLE_POINTS)
SIFT 和 ORB 的结果如下:
查看 SuperGlue,基于图形神经网络的特征匹配。虽然,他们不提供训练代码,但是提供了室内、室外两种预训练模型。链接,
https://github.com/magicleap/SuperGluePretrainedNetwork
https://psarlin.com/superglue/
https://arxiv.org/pdf/1911.11763.pdf