c++ - Why my camera matrix is an identity matrix after calibration -
after calibrating camera using sample data in opencv
, camera matrix becomes identity matrix.
here code:
std::vector<cv::point3f> t_3d; t_3d.push_back(cv::point3f(50, 100, 0)); t_3d.push_back(cv::point3f(375, 100, 0)); t_3d.push_back(cv::point3f(50, 1600, 0)); t_3d.push_back(cv::point3f(750, 1600, 0)); object_points.push_back(t_3d); std::vector<cv::point2f> t_2d; t_2d.push_back(cv::point2f(2.27556, 98.9867)); t_2d.push_back(cv::point2f(631.467, 58.0267)); t_2d.push_back(cv::point2f(207.076, 1020.59)); t_2d.push_back(cv::point2f(1061.55, 969.387)); image_points.push_back(t_2d); cv::calibratecamera(object_points, image_points, cv::size(1440, 900), cam_mat, dist_coeffs, rvecs, tvecs, cv_calib_use_intrinsic_guess);
is behaviour normal?
according docs, need initialize camera matrix @ least partially beforehand.
from docs:
if cv_calib_use_intrinsic_guess and/or cv_calib_fix_aspect_ratio specified, or of fx, fy, cx, cy must initialized before calling function.
and
cv_calib_use_intrinsic_guess cameramatrix contains valid initial values of fx, fy, cx, cy optimized further. otherwise, (cx, cy) set image center ( imagesize used), , focal distances computed in least-squares fashion.
in case, since haven't set cam_mat value, believe c_x , c_y being set image center (presumably (0,0)) , focal distances f_x , f_y 1 because of use of cv_calib_use_intrinsic_guess.
try passing in 0 instead of flag.
Comments
Post a Comment