I dont get the coordinates from feature matching
list_kp1 = [] list_kp2 = [] del list_kp1 del list_kp2 import cv2 import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl img1=cv2.imread("rm1.jpg",0) img2=cv2.imread("rm2.JPG",0) orb=cv2.ORB_create() kp1, des1=orb.detectAndCompute(img1,None) kp2, des2=orb.detectAndCompute(img2,None) bf=cv2.BFMatcher(cv2.NORM_HAMMING,crossCheck= True) matches=bf.match(des1,des2) matches=sorted(matches,key=lambda x:x.distance) img3=cv2.drawMatches(img1,kp1,img2,kp2,matches[:5],None,flags=2) plt.imshow(img3) plt.show() print() # Initialize lists list_kp1 = [] list_kp2 = [] # For each match... for mat in matches[:5]: # Get the matching keypoints for each of the images img1_idx = mat.queryIdx img2_idx = mat.trainIdx # x - columns # y - rows # Get the coordinates (x1, y1) = kp1[img1_idx].pt (x2, y2) = kp2[img2_idx].pt # Append to each list list_kp1.append((x1, y1)) list_kp2.append((x2, y2)) list_kp1 = [kp1[mat.queryIdx].pt for mat in matches] list_kp2 = [kp2[mat.trainIdx].pt for mat in matches] print(np.size(list_kp1))