Guest User

Untitled

a guest
Dec 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. orb = cv2.ORB_create()
  2.  
  3. kp1, des1 = orb.detectAndCompute(l, None)
  4. kp2, des2 = orb.detectAndCompute(r, None)
  5.  
  6. # create BFMatcher object
  7. bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
  8. # Match descriptors.
  9. matches = bf.match(des1, des2)
  10.  
  11. # Sort them in the order of their distance.
  12. matches = sorted(matches, key=lambda x: x.distance)
  13.  
  14. # Graph the difference in x and y to see if we can identify a trend.
  15. x_coords = []
  16. y_coords = []
  17.  
  18. for match in matches[:50]:
  19. x_coords.append(kp2[match.trainIdx].pt[0] - kp1[match.queryIdx].pt[0])
  20. y_coords.append(kp2[match.trainIdx].pt[1] - kp1[match.queryIdx].pt[1])
  21.  
  22. plt.scatter(x_coords, y_coords)
  23. plt.show()
Add Comment
Please, Sign In to add comment