import cv2
import numpy as np
img = cv2.imread("2.PNG", cv2.IMREAD_GRAYSCALE)
sift = cv2.xfeatures2d.SIFT_create()
surf = cv2.xfeatures2d.SURF_create()
orb = cv2.ORB_create(nfeatures=1500)
# here None is for non-masking
keypoints1, descriptors1 = orb.detectAndCompute(img, None)
keypoints2, descriptors2 = sift.detectAndCompute(img, None)
keypoints3, descriptors3 = surf.detectAndCompute(img, None)
imgOrb = cv2.drawKeypoints(img, keypoints1, None)
imgSift = cv2.drawKeypoints(img, keypoints2, None)
imgSurf = cv2.drawKeypoints(img, keypoints3, None)
cv2.imshow("Orb", cv2.resize(imgOrb,(700,500)) )
cv2.imshow("Sift", cv2.resize(imgSift,(700,500)) )
cv2.imshow("Surf", cv2.resize(imgSurf,(700,500)) )
cv2.waitKey(0)
cv2.destroyAllWindows()
Friday, 2 November 2018
Feature Descriptor like ORB, Shift and Surf Implementation using OpenCv Python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment