Fixed issue with Epipolar Geometry Tutorial

pull/18848/head
Ian Maquignaz 4 years ago
parent 328883b6ea
commit fef23768fe
  1. 4
      doc/py_tutorials/py_calib3d/py_epipolar_geometry/py_epipolar_geometry.markdown

@ -79,7 +79,7 @@ from matplotlib import pyplot as plt
img1 = cv.imread('myleft.jpg',0) #queryimage # left image img1 = cv.imread('myleft.jpg',0) #queryimage # left image
img2 = cv.imread('myright.jpg',0) #trainimage # right image img2 = cv.imread('myright.jpg',0) #trainimage # right image
sift = cv.SIFT() sift = cv.SIFT_create()
# find the keypoints and descriptors with SIFT # find the keypoints and descriptors with SIFT
kp1, des1 = sift.detectAndCompute(img1,None) kp1, des1 = sift.detectAndCompute(img1,None)
@ -93,14 +93,12 @@ search_params = dict(checks=50)
flann = cv.FlannBasedMatcher(index_params,search_params) flann = cv.FlannBasedMatcher(index_params,search_params)
matches = flann.knnMatch(des1,des2,k=2) matches = flann.knnMatch(des1,des2,k=2)
good = []
pts1 = [] pts1 = []
pts2 = [] pts2 = []
# ratio test as per Lowe's paper # ratio test as per Lowe's paper
for i,(m,n) in enumerate(matches): for i,(m,n) in enumerate(matches):
if m.distance < 0.8*n.distance: if m.distance < 0.8*n.distance:
good.append(m)
pts2.append(kp2[m.trainIdx].pt) pts2.append(kp2[m.trainIdx].pt)
pts1.append(kp1[m.queryIdx].pt) pts1.append(kp1[m.queryIdx].pt)
@endcode @endcode

Loading…
Cancel
Save