title: Why doesn't SIFT work for 8 bit images (JPEG) in OpenCV with Python?
body: <p>I used SIFT for all my other 24 bit JPEG images without any problems, however, the 8-bit one always give me the following error. </p>
  
  <p>image is empty or has incorrect depth (!=CV_8U) in function cv::SIFT::operator ()</p>
  
  <p>Does anyone know how to deal with it?</p>
  
  <p>Here is my code:</p>
  
  <pre><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)
  </code></pre>
  
  <p>Then the error "image is empty or has incorrect depth (!=CV_8U) in function cv::SIFT::operator ()" pops up. </p>