title: Estimating R/T from Homography
body: <p>I've been trying to calculate the features in 2 images and then pass those features back to <code>CameraParams.R</code> without luck. The features are calculated and matched successfully, however, the problem is passing them back to <code>R &amp; t</code>.</p>
  
  <p>I understand that you must decompose the <code>Homography</code> in order for this to be possible, which I've done using something like this: <a href="https://github.com/syilma/homography-decomp" rel="nofollow noreferrer">https://github.com/syilma/homography-decomp</a>, but am I really doing it right?</p>
  
  <p>Right now I'm simply using:</p>
  
  <p><strong>Matching:</strong></p>
  
  <pre><code>vector&lt; vector&lt;DMatch&gt; &gt; matches;
  Ptr&lt;DescriptorMatcher&gt; matcher = DescriptorMatcher::create(algorithmName);
  matcher-&gt;knnMatch( descriptors_1, descriptors_2, matches, 50 );
  
  vector&lt; DMatch &gt; good_matches; // Storing good matches here
  </code></pre>
  
  <p>I've noticed that the <code>good_matches</code> isn't used anywhere. So I guess my question is, how can I pass back <code>good_matches</code> to <code>cameras.R/t</code>?</p>
  
  <p><strong>Extracting Homography:</strong></p>
  
  <pre><code>Mat K;
  cameras[img_idx].K().convertTo(K, CV_32F);
  
  findHomography -&gt; decomposeHomography(H, K, outputR,outputT,noarray()).
  </code></pre>
  
  <p>Then by utilizing the library above, I pass in the values from <code>R</code> &amp; <code>t</code> but the response is that the homography isn't found in the 4 possible outcomes.</p>
  
  <p>Am I on the right path here? Seems like decomposeHomography is a 3D solution, but, findHomography is 2D?</p>
  
  <p><strong>Absolute Goal:</strong></p>
  
  <p>Refine <code>CameraParam.R/t</code> depending on the features found in the images. </p>
  
  <p>Why? Because I'm currently passing in the <code>.R</code> from the devices rotation matrix but the rotation is slightly inaccurate. See more info about it on my previous question: <a href="https://stackoverflow.com/questions/38861985/refining-camera-parameters-and-calculating-errors-opencv/38924445">Refining Camera parameters and calculating errors - OpenCV</a></p>