fork download
  1. import numpy as np
  2. import cv2
  3. import matplotlib.pyplot as plt
  4.  
  5. img1 = cv2.imread('8d.png',0)
  6. img2 = cv2.imread('all_cards.png',0)
  7. orb = cv2.ORB_create()
  8. kp1, des1 = orb.detectAndCompute(img1,None)
  9. kp2, des2 = orb.detectAndCompute(img2,None)
  10. bf = cv2.BFMatcher(cv2.NORM_L2, crossCheck=True)
  11.  
  12. matches = bf.match(des1,des2)
  13. matches = sorted(matches, key = lambda x:x.distance)
  14.  
  15. img3 = cv2.drawMatches(img1,kp1,img2,kp2,matches[:30],None, flags=2)
  16. plt.imshow(img3)
  17. plt.show()
  18.  
Runtime error #stdin #stdout #stderr 0.06s 27256KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
ImportError: No module named 'cv2'