I am trying to only draw the keypoints (without the image) using this example code:
import cv2
import numpy as np
img = cv2.imread('test.png')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift = cv2.SIFT()
kp = sift.detect(gray,None)
img=cv2.drawKeypoints(gray,kp)
cv2.imwrite('sift_keypoints.jpg',img)
I tried cv2.drawKeypoints(None,kp)
and cv2.drawKeypoints(kp)
but to no avail.
Any ideas how this could be achieved ?
Thanks.
OpenCV does not have any method to draw the keypoints alone.This is the code i used to find SIFT keypoints.
You can get ONLY the keypoints by drawing them on a solid black image having the SAME shape of your original image.
This is the image I used:
I then obtained the keypoints:
Then I created an image of solid color(black) having same size of the original image and draw these keypoints on them.
Voila ONLY keypoints
CODE: