我发现两个图像之间存在相似性。我的代码是
img1 = cv2.imread(os.path.join("/home/atul/Documents/Data/objectdetection/imboxes1/images000.jpeg/car0.jpg"))
img2 = cv2.imread(os.path.join("/home/atul/Documents/Data/objectdetection/frames1/images000.jpeg"))
sift = cv2.xfeatures2d.SIFT_create()
kp1, des1 = sift.detectAndCompute(img1,None)
kp2, des2 = sift.detectAndCompute(img2,None)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 5)
search_params = dict(checks = 50)
flann = cv2.FlannBasedMatcher(index_params, search_params)
matches = flann.knnMatch(des1,des2,k=2)
我面临的错误是-
我该如何解决?请建议
谢谢!
最佳答案
在您的代码中,请检查您的路径,因为扩展名无关
“/home/atul/Documents/Data/objectdetection/imboxes1/images000.jpeg/car0.jpg”
请将images000.jpeg更改为简单文件夹images000 / car0.jpg
同时检查查询图片的大小应小于原始图片的大小