A method for generating the correction matrix after binocular vision embedded transplantation

Source: Internet
Author: User

First of all, the calibration matrix can be obtained by calling the function in OpenCV by using the calibrated parameters.



   
    Double lm[] = {     4.0178810502329486e+002, 0, 1.5950000000000000e+002, &nbs p;    0,4.0178810502329486e+002,1.1950000000000000e+002,      0,0, 1  
   };      Double ld[] = {    -4.5141575299933429e-001, 2.3998422552817714e-001,  &
nbsp;   1.5081252615814692e-002, 1.8419337906291466e-003, 0     };      Double rm[] = {     4.0178810502329486e+002, 0, 1.5950000000000000e+
002,0,      4.0178810502329486e+002, 1.1950000000000000e+002,0,0, 1     };      Double rd[] = {     -5.1762688060193929e-001,6.3474560985437023e-001, &
nbsp;    -2.5303249541511292e-003, -2.7165709692779268e-003, 0     };      Double rotate[] = {     9.9952858710662951e-001,1.4994693512808868e-002,      2.6791094100126738e-002,- 1.1568939379481839e-002,      9.9224798371307799e-001,-1.2373398263599662e-001,   
   -2.8438762249064085e-002, 1.2336570829767958e-001,      9.9195369792039845e-001
    };      Double translation[] = {     -8.8108837791674333e+001,-



1.3412948452799096e+000,      9.4102431499505457e+000     };
    Cv::mat cameramatrix_l = Cv::mat (3,3,CV_64FC1,LM);
    Cv::mat distortioncoefficients_l = Cv::mat (1,5,CV_64FC1,LD);
    Cv::mat cameramatrix_r = Cv::mat (3,3,CV_64FC1,RM);

    Cv::mat Distortioncoefficients_r = Cv::mat (1,5,CV_64FC1,RD);
    Cv::mat rotations= Cv::mat (3,3,cv_64fc1,rotate);
    Cv::mat translations= Cv::mat (3,1,cv_64fc1,translation);
    Cv::mat R1, R2, P1, P2, Q;
    Cv::rect Roi1,roi2; Cv::mat m_calib_mat_remap_x_l = Cv::mat (ImageSize, CV_32FC1);
    Cv::mat m_calib_mat_remap_y_l= Cv::mat (imagesize, CV_32FC1);
    Cv::mat m_calib_mat_remap_x_r = Cv::mat (ImageSize, CV_32FC1);

    Cv::mat m_calib_mat_remap_y_r = Cv::mat (ImageSize, CV_32FC1); Cv::stereorectify (cameramatrix_l, distortioncoefficients_l, Cameramatrix_r, Distortio
         Ncoefficients_r, ImageSize, rotations, translations, r1,r2,p1,p2,q, 1024
    );
         Initundistortrectifymap (cameramatrix_l, distortioncoefficients_l, R1,P1, ImageSize,
     CV_16SC2, m_calib_mat_remap_x_l, m_calib_mat_remap_y_l);
         Initundistortrectifymap (Cameramatrix_r, Distortioncoefficients_r, R2, P2, ImageSize,
 CV_16SC2, M_calib_mat_remap_x_r,m_calib_mat_remap_y_r);

The relevant correction parameters can be obtained after the embedded operation.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.