You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#calaulate RANSAC matching point
sum = 0
for i in range(1,matches, 1):
if mask[i][0]==1:
sum += 1
print("RANSAC matching point: ",sum)
mismatching=matches-sum
print("mismatching:",mismatching)
img_homo_gray1= cv2.cvtColor(IX, cv2.COLOR_BGR2GRAY)
img_homo_gray2= cv2.cvtColor(registered, cv2.COLOR_BGR2GRAY)
MIN_MATCH_COUNT =5
if matches>MIN_MATCH_COUNT:
M, mask = cv2.findHomography(X,Z, cv2.RANSAC,5.0)
matchesMask = mask.ravel().tolist()
print(matchesMask)
h,w =img_homo_gray1.shape
pts = np.float32([ [0,0],[0,h-1],[w-1,h-1],[w-1,0] ]).reshape(-1,1,2)
dst = cv2.perspectiveTransform(pts, M)
img_homo_gray2= cv2.polylines(img_homo_gray2, [np.int32(dst)], True, 255, 3, cv2.LINE_AA)
else:
matchesMask = None
#calaulate RANSAC matching point
sum = 0
for i in range(1,matches, 1):
if mask[i][0]==1:
sum += 1
print("RANSAC matching point: ",sum)
mismatching=matches-sum
print("mismatching:",mismatching)
#---------------------------------------------------------------------------------
Question: I don't know how to draw the matching line after doing RANSAC?
The text was updated successfully, but these errors were encountered: