首页 > 代码库 > 双目视觉嵌入式移植后校正矩阵的生成方法
双目视觉嵌入式移植后校正矩阵的生成方法
首先要利用标定得到的参数,通过调用OpenCV中的函数来得到校正矩阵。
double LM[] = { 4.0178810502329486e+002, 0, 1.5950000000000000e+002, 0,4.0178810502329486e+002,1.1950000000000000e+002, 0,0, 1 }; double LD[] = { -4.5141575299933429e-001, 2.3998422552817714e-001, 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, -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, distortionCoefficients_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);
嵌入式运行后可以得到相关校正参数。
双目视觉嵌入式移植后校正矩阵的生成方法
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。