forked from x4nth055/pythoncode-tutorials
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsift.py
More file actions
Latest commit
18 lines (17 loc) · 521 Bytes
/
Copy pathsift.py
File metadata and controls
18 lines (17 loc) · 521 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
importcv2
# reading the image
img=cv2.imread('table.jpg')
# convert to greyscale
gray=cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# create SIFT feature extractor
sift=cv2.xfeatures2d.SIFT_create()
# detect features from the image
keypoints, descriptors=sift.detectAndCompute(img, None)
# draw the detected key points
sift_image=cv2.drawKeypoints(gray, keypoints, img)
# show the image
cv2.imshow('image', sift_image)
# save the image
cv2.imwrite("table-sift.jpg", sift_image)
cv2.waitKey(0)
cv2.destroyAllWindows()