Created
March 23, 2019 09:54
-
-
Save saurabhpal97/6da46cdd99ea5c080ec9ec18cae4304a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import required libraries | |
import cv2 | |
import numpy as np | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#show OpenCV version | |
print(cv2.__version__) | |
#read the iamge and convert to grayscale | |
image = cv2.imread('index.png') | |
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) | |
#create sift object | |
sift = cv2.xfeatures2d.SIFT_create() | |
#calculate keypoints and their orientation | |
keypoints,descriptors = sift.detectAndCompute(gray,None) | |
#plot keypoints on the image | |
with_keypoints = cv2.drawKeypoints(gray,keypoints) | |
#plot the image | |
plt.imshow(with_keypoints) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment