您好,我是特征检测的新手,我试图在其他图像中查找与图像的匹配,如何以一种简单的方式执行此操作,并且有一种方法可以确定百分比匹配?
答案 0 :(得分:2)
尝试使用此入门代码熟悉功能匹配,并详细了解功能检测here
import cv2
from matplotlib import pyplot as plt
im1 = cv2.imread('Feature1.png')
im2 = cv2.imread('Image.png')
gray1 = cv2.cvtColor(im1, cv2.COLOR_BGR2GRAY)
gray2 = cv2.cvtColor(im2, cv2.COLOR_BGR2GRAY)
# initialize the AKAZE descriptor, then detect keypoints and extract
# local invariant descriptors from the image
detector = cv2.AKAZE_create()
(kps1, descs1) = detector.detectAndCompute(gray1, None)
(kps2, descs2) = detector.detectAndCompute(gray2, None)
# Match the features
bf = cv2.BFMatcher(cv2.NORM_HAMMING)
matches = bf.knnMatch(descs1,descs2, k=2)