I used SIFT for all my other 24 bit JPEG images without any problems, however, the 8 bit one always give me this following error.
image is empty or has incorrect depth (!=CV_8U) in function cv::SIFT::operator ()
Does anyone know how to deal with it?
Here is my code:
import cv2 import numpy as np import os import glob import scipy.cluster os.chdir('\mydirectory') images = [] for infile in glob.glob('./*.jpg'): pic = cv2.imread(infile,0) images.append(pic) my_set = images descriptors = np.array([]) feaL=np.array([]) for pic in my_set: kp, des = cv2.SIFT().detectAndCompute(pic, None) feaL=np.append(feaL,des.shape[0]) descriptors = np.append(descriptors, des)
Then the error "image is empty or has incorrect depth (!=CV_8U) in function cv::SIFT::operator ()" pops up.