title: Applying homography on non planar surface
body: <p>As I know, Homography (projective transformation) in computer vision can be used to detect object in images but all the examples, I've seen, were on planar objects. Does Homography only work on a <a href="http://goo.gl/x4aG3l" rel="nofollow noreferrer">planar surface</a> object? Or It can detect any kind of <a href="https://goo.gl/gVQP5U" rel="nofollow noreferrer">objects</a>? I'm asking because I tried to find the object below (It's a non planar surface object) with no success:</p>
  <ol>
  <li><img src="https://i.stack.imgur.com/3MFFg.png" alt="List item" /></li>
  <li><img src="https://i.stack.imgur.com/21TmJ.jpg" alt="List item" /></li>
  </ol>
  <p>In this <a href="http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html" rel="nofollow noreferrer">link</a>, you can see the code. I used it as it's with just updating the name of images so what we're doing is the following:</p>
  <ol>
  <li>Getting the keypoints from the 2 images using SURF</li>
  <li>Describe the keypoints using SURF descriptor</li>
  <li>Try to match the keypoints between the 2 images</li>
  <li>Use the list of matched key points to compute Homography matrix.</li>
  <li>Get the coordinates of the object corner points.</li>
  <li>Apply perspectiveTransform to get their correspondings in the scene image</li>
  <li>Draw lines between the results points.</li>
  </ol>
  <p>Please note that the green lines drawn inside the big circles in the images are the line drawn to represent the results points.</p>
  <p>Based on what I showed above, it seems to me that there is something not clear in my understanding of Homography and where it can be applied because this kind of example is quite simple and it didn't work. I'm currently looking into OpenCV code to understand exactly how they estimate it but it's not going quickly.So, does anyone have any clue on how OpenCV computes this transformation? Or any reference that can help in this situation?</p>
  <p><strong>EDITED:</strong>
  Here is another example:
  <img src="https://i.stack.imgur.com/hwGxG.jpg" alt="enter image description here" /></p>
  <p>I applied the homography on the object and the yellow box which is just containing the instrument I need. The results are even worse because now it's somehow a point as you can see in the green point surrounded by the red circle.
  Also, I can't take images for the objects from the scene because I have a lot of videos so what I'm doing is taking a separate images for each intruments and trying to find them in the scene videos.</p>