OpenCV - Display ONLY the keypoints NOT the image using SIFT -


i trying only draw keypoints (without image) using example code:

import cv2 import numpy 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) no avail.

any ideas how achieved ?

thanks.

you can only keypoints drawing them on solid black image having same shape of original image.

this image used:

enter image description here

i obtained keypoints:

enter image description here

then created image of solid color(black) having same size of original image , draw these keypoints on them.

enter image description here

voila keypoints

code:

#---creating image of solid color same size image--- mask = np.zeros((img.shape[0], img.shape[1], 3), np.uint8) mask[:] = (0, 0, 0)   #---drawing keypoints on mask image--- fmask = cv2.drawkeypoints(mask,kp,none,color=(0,255,0), flags=0) cv2.imshow('fmask.jpg', fmask) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -