title: OpenCV-Python dense SIFT
body: <p>OpenCV has <a href="http://docs.opencv.org/trunk/doc/py_tutorials/py_feature2d/py_sift_intro/py_sift_intro.html" rel="noreferrer">very good documentation on generating SIFT descriptors</a>, but this is a version of "weak SIFT", where the key points are detected by the original <a href="http://www.cs.ubc.ca/~lowe/keypoints/" rel="noreferrer">Lowe algorithm</a>. The OpenCV example reads something like:</p>
  
  <pre><code>img = cv2.imread('home.jpg')
  gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
  
  sift = cv2.SIFT()
  kp = sift.detect(gray,None)
  kp,des = sift.compute(gray,kp)
  </code></pre>
  
  <p>What I'm looking for is strong/dense SIFT, which does not detect keypoints but instead calculates SIFT descriptors for a set of patches (e.g. 16x16 pixels, 8 pixels padding) covering an image as a grid. As I understand it, there are two ways to do this in OpenCV:</p>
  
  <ul>
  <li>I could divide the image in a grid myself, and somehow convert those patches to KeyPoints</li>
  <li>I could use a grid-based feature detector</li>
  </ul>
  
  <p>In other words, I'd have to replace the <code>sift.detect()</code> line with something that gives me the keypoints I require.</p>
  
  <p>My problem is that the rest of the OpenCV documentation, especially wrt Python, is severely lacking, so I have no idea how to achieve either of these things. I see in the C++ documentation that there are keypoint detectors for grid, but I don't know how to use these from Python.</p>
  
  <p>The alternative is to switch to VLFeat, which has a very good DSift/PHOW implementation but means that I'll have to switch from python to matlab.</p>
  
  <p>Any ideas? Thanks.</p>