title: OpenCV: Why using solvePnP() when i already have Projection Matrix P?
body: <p>I already know that solvePnP() finds the position (rotation and translation) of the camera using the 2d point coordinates and corresponding 3d point coordinates, but i don't really understand why i have to use it after i triangulated some 3d points with 2 cameras and their corresponding 2d points.</p>
  
  <p>Because while triangulating a new 3D point, i already have (need) the projection matrices P1 and P2 of the two cameras (which contains of the R1, R2 and t1, t2 rotation and translations and is already the location of the cameras w.r.t. the new triangulating 3D point).</p>
  
  <p>My workflow is:</p>
  
  <ol>
  <li>Get 2D-correspondences from 2 images.</li>
  <li>Get Essential Matrix E using these 2D-correspondences.</li>
  <li><p>Get relative orientation (R, t) of the 2 images from the Essential Matrix E.  </p></li>
  <li><p>Set Projection Matrix P1 of camera1 to</p>
  
  <p>P1 = (1, 0, 0, 0, 
        0, 1, 0, 0, 
        0, 0, 1, 0, 
        0, 0, 0, 0);</p></li>
  </ol>
  
  <p>and set Projection Matrix P2 of camera2 to</p>
  
  <pre><code>P2 = (R.at&lt;double&gt;(0, 0), R.at&lt;double&gt;(0, 1), R.at&lt;double&gt;(0, 2), t.at&lt;double&gt;(0),
        R.at&lt;double&gt;(1, 0), R.at&lt;double&gt;(1, 1), R.at&lt;double&gt;(1, 2), t.at&lt;double&gt;(1),
        R.at&lt;double&gt;(2, 0), R.at&lt;double&gt;(2, 1), R.at&lt;double&gt;(2, 2), t.at&lt;double&gt;(2));
  </code></pre>
  
  <ol start="5">
  <li><p>Solve least squares problem</p>
  
  <p>P1 * X = x1<br>
  P2 * X = x2</p>
  
  <p>(solving for X = 3D Point). and so on.....  </p></li>
  </ol>
  
  <p>After that i get a triangulated 3D Point X from these Projection Matrices P1 and P2 and the x1 and x2 2D Point correspondences.</p>
  
  <p><strong><em>My question is now again:<br>
  Why i need to use now solvePnP() to get the camera location? Because I already have P1 and P2 which should be already the locations of the cameras (w.r.t. the triangulated 3D points).</em></strong></p>