Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCV: compute Rotation Matrix for stereoRectify
    primarykey
    data
    text
    <p>I want to compute the rotation and translation matrices to use for stereoRectify in open CV. The rectified images look twisted and totally incorrect (Like completely twisted cone at the center of the image going both directions)</p> <p>I have the rotation and translation matrices of both cameras....</p> <p>Also, this is a smilar post but it is not helping: <a href="https://stackoverflow.com/questions/5055864/finding-rotation-matrices-between-two-cameras-for-stereorectify">Finding Rotation matrices between two cameras for &quot;Stereorectify&quot;</a></p> <p>I am sharing my code below...</p> <pre><code>// Create interinsic parameters matrix given the translation and rotation matrecis Mat CreateExternsicParamsMat(Mat R, Mat T) { Mat ext1(4,4,T.type()); Mat ext2(4,4,T.type()); for(int i=0; i&lt;3;i++) for(int j=0;j&lt;3; j++) ext1.at&lt;double&gt;(i,j) = R.at&lt;double&gt;(i,j); for(int i=0; i&lt;3;i++) ext1.at&lt;double&gt;(i,3) = T.at&lt;double&gt;(i,0); ext1.at&lt;double&gt;(3,3) = 1; ext1.at&lt;double&gt;(3,2) = 0; ext1.at&lt;double&gt;(3,1) = 0; ext1.at&lt;double&gt;(3,0) = 0; return ext1; } Mat ext1 = CreateExternsicParamsMat(R1,T1); Mat ext2 = CreateExternsicParamsMat(R2,T2); Mat ext1inv; invert(ext1,ext1inv); Mat ext = ext1inv*ext2; for(int i=0; i&lt;3;i++) for(int j=0;j&lt;3; j++) R.at&lt;double&gt;(i,j) = ext.at&lt;double&gt;(i,j); for(int i=0; i&lt;3;i++) T.at&lt;double&gt;(i,0)=ext.at&lt;double&gt;(i,3); stereoRectify( M1, D1, M2, D2, img_size, R, T, R1, R2, P1, P2, Q); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload