Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import cv2
  2. import numpy as np
  3.  
  4. def detect():
  5. img1 = cv2.imread('znak1.png',1)
  6. img2 = cv2.imread('znak1.png',1)
  7.  
  8. fast = cv2.FastFeatureDetector_create(threshold=70, nonmaxSuppression=1)
  9. kp1 = fast.detect(img1, None)
  10. kp2 = fast.detect(img2, None)
  11.  
  12. orb = cv2.ORB_create()
  13. kp1, des1 = orb.compute(img1, kp1)
  14. kp2, des2 = orb.compute(img2, kp2)
  15.  
  16. bf = cv2.BFMatcher(cv2.NORM_HAMMING)
  17. matches = bf.match(des1, des2)
  18.  
  19. img3 = cv2.drawMatches(img1, kp1, img2, kp2, matches[:20], (100, 0, 0))
  20. cv2.imshow('image', img3)
  21. cv2.waitKey(0)
  22.  
  23. detect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement