I am trying to create a codebook from a set of image patches. I have divided the images (Caltech 101) into 20 X 20 image patches. I want to create a SIFT descriptor for each patch. But for some of the image patches, it does not return any descriptor/keypoint. I have tried using OpenCV and vlfeat. The behavior is same using any of the libraries.
Following is my code using OpenCV -
sift = cv2.SIFT()
img = cv2.imread('patch_temp.jpg',0)
imgptch = cv2.imread('image_patch.jpg',cv2.CV_LOAD_IMAGE_GRAYSCALE)
kp, des = sift.detectAndCompute(imgptch,None)
print des
des is 'None'. Same is the case if I use vlfeat. Note : Above works if I use a different image. It returns None for some of the images (6 out of 10).
I have created the image patch using OpenCV indexing -
patch = img[0:20,0:20]
cv2.imwrite('image_patch.jpg',img)