title: How to improve the homography accuracy?
body: <p>I used OpenCV's <code>cv::findHomography</code> API to calculate the homography matrix of two planar images.
  The matched key points are extracted by SIFT and matched by BFMatcher. As I know, <code>cv:findHomography</code> use RANSAC iteration to find out the best four corresponding points to get the homography matrix.
  So I draw the selected four pairs of points with the calculated contour using homograhy matrix of the edge of the object.
  The result are as the links:</p>
  
  <p><a href="https://postimg.cc/image/5igwvfrx9/" rel="noreferrer">https://postimg.cc/image/5igwvfrx9/</a></p>
  
  <p>As we can see, the selected matched points by RANSAC are correct, but the contour shows that the homography is not accurate.</p>
  
  <p>But these test shows that, both the selected matched points and the homography are correct:</p>
  
  <p><a href="https://postimg.cc/image/dvjnvtm53/" rel="noreferrer">https://postimg.cc/image/dvjnvtm53/</a></p>
  
  <p>My guess is that if the selected matched points are too close, the small error of the pixel position will lead to the significant error of the homography matrix. If the four points are in the corner of the image, then the shift of the matched points by 4-6 pixels still got good homography matrix. 
  (According the homogenous coordinate, I think it is reasonable, as the small error in the near plane will be amplified in the far away)</p>
  
  <p>My question is: </p>
  
  <p>1.Is my guess right? 
  2.Since the four matched points are generated by the RANSAC iteration, the overall error of all the keypoints are minimal. But How to get the stable homography, at least making the contour's mapping is correct? The theory proved that if the four corresponding points in a plane are found, the homography matrix should be calculated, but is there any trick in the engineer work?</p>