已经通过sift算法将图片的相似点找出并且连线,但是不知道怎么用sift算法判断两张图片的相似程度
import cv2 as cv
import numpy as np
img1 = cv.imread('s1.jpg')
img2 = cv.imread('s2.jpg')
def cv_show(name, img):
cv.imshow(name, img)
sift = cv.xfeatures2d.SIFT_create()
kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)
bf = cv.BFMatcher(crossCheck=True)
matches = bf.match(des1, des2)
matches = sorted(matches, key=lambda x: x.distance)
img3 = cv.drawMatches(img1, kp1, img2, kp2, matches[:10], None, flags=2)
cv_show('img3', img3)
cv.imwrite('s12.jpg', img3)
cv.waitKey(0)
cv.destroyAllWindows()
我想要达到的结果是:如果sift特征相似阈值超过70%,则程序代码输出“两幅图像相似”,否则输出“两张图像不相似”