title: Open-CV 2.4 Dense SIFT with contrast threshold
body: <p>I'm trying to compute dense SIFT with openCV-python 2.4</p>
  
  <pre><code>import cv2
  def gen_sift_features(gray, step_size, gamma):
      dense = cv2.FeatureDetector_create("Dense")
      dense.setInt('initXyStep',step_size)
      kp = dense.detect(gray)
  
      sift = cv2.SIFT(contrastThreshold=gamma)
      kp, desc = sift.compute(gray, kp)
      return kp, desc
  
  img = cv2.imread('myimage.png')
  gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  kp, desc = gen_sift_features(gray, 8, 0.01)
  </code></pre>
  
  <p>Normally, the contrast threshold will filter out the keypoints at low-contrast regions but in this case, it was ignored and openCV still give me sifts descriptors for all the keypoints.</p>
  
  <p><a href="https://i.stack.imgur.com/UkNXY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UkNXY.png" alt="enter image description here"></a></p>
  
  <p>Anyone knows how to filter out the low-contrast descriptors in this case?
  Thanks for your help!</p>
  
  <p>EDIT: I tried to look closer and removed all the null descriptors</p>
  
  <pre><code>remove = []
  for i in range(0,len(desc)):
     if sum(desc[i])==0:
         remove.append(i)
  
  np.delete(desc,remove)
  for i in sorted(remove, reverse=True):
      del kp[i]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5lnS0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5lnS0.png" alt="enter image description here"></a></p>
  
  <p>But when I changed my contrastThreshold, the result is still the same!!!!
  Seem like the parameter is still <strong>ignored</strong></p>