import numpyas npimport cv2as cvimg1= cv.imread('box.png',0)# queryImageimg2= cv.imread('box_in_scene.png',0)# trainImage# Initiate SIFT detectorsift= cv.SIFT()# find the keypoints and descriptors with SIFTkp1, des1= sift.detectAndCompute(img1,None)# FLANN parametersFLANN_INDEX_KDTREE=1index_params= dict(algorithm= FLANN_INDEX_KDTREE, trees=5)search_params= dict(checks=50)# or pass empty dictionarymatches= flann.knnMatch(des1,des2,k=2)# Need to draw only good matches, so create a maskmatchesMask=[[0,0]for iin xrange(len(matches))]# ratio test as per Lowe's paperfor i,(m,n)in enumerate(matches):if m.distance