0

我正在尝试注册 2 个类似的图像;但是,在执行我的代码后,我最终得到了确切的参考图片。

我注册这两张图片的主要目的是找到差异,我怎样才能获得差异?

orb= cv.ORB_create(1000)
kp1, des1 = orb.detectAndCompute(grey, None)
kp2, dess2 = orb.detectAndCompute(greyy, None)  
matcher = cv.DescriptorMatcher_create(cv.DescriptorMatcher_BRUTEFORCE_HAMMING)

matches = matcher.match(des1, des2, None)
matches = sorted(matches, key=lambda x:x.distance)

points1 = np.zeros((len(matches), 2), dtype=np.float32)
points2 = np.zeros((len(matches), 2), dtype=np.float32)

for i, match in enumerate(matches):
    points1[i, :] = kp1[match.queryIdx].pt
    points2[i, :] = kp2[match.trainIdx].pt

h, mask= cv.findHomography(points1, points2, cv.RANSAC)

regimg = cv.warpPerspective(img1, h, (width,height))
cv.imshow('registered', regimg)

根据评论中的要求:使用 orb 匹配的图像

4

0 回答 0