Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Calibration
- Mat K, xi, D, idx;
- int flags=0|omnidir::CALIB_FIX_SKEW | omnidir::CALIB_FIX_K1 |
- omnidir::CALIB_FIX_K2;
- TermCriteria critia(cv::TermCriteria::COUNT + cv::TermCriteria::EPS, 200,
- 0.0001);
- vector<cv::Mat> rvecs, tvecs;
- double rms = cv::omnidir::calibrate(obj_points, image_points, image_size, K,
- xi, D, rvecs, tvecs, flags, critia, idx);
- //Testing
- Mat R = Mat::eye(3, 3, CV_32F);
- Mat Mapx, Mapy;
- Mat New_camera_mat(3,3,CV_32F);
- //New_camera_mat tries to get entire FOV,but it is losing some information
- at edges
- New_camera_mat.at<float>(0, 0) = 100; New_camera_mat.at<float>(0, 1) = 0;
- New_camera_mat.at<float>(0, 2) = 1280/2;
- New_camera_mat.at<float>(1, 0) = 0; New_camera_mat.at<float>(1, 1) = 100;
- New_camera_mat.at<float>(1, 2) = 720/2 ;
- New_camera_mat.at<float>(2, 0) = 0; New_camera_mat.at<float>(2, 1) = 0;
- New_camera_mat.at<float>(2, 2) = 1;
- cv::omnidir::initUndistortRectifyMap(K, D, xi_Right, R, New_camera_mat,
- image_size, CV_32F, Mapx, Mapy, cv::omnidir::RECTIFY_PERSPECTIVE);
- remap(distorted_frame, undistorted_out_frame, Mapx, Mapy, INTER_CUBIC);
Add Comment
Please, Sign In to add comment