c++ - Cannot get back original values of image points after calibrating camera -


after calibrating camera using opencv's calibratecamera method , obtaining parameters, when try reproduce original object points nonsensical output.
here code:

vector<vector<cv::point3f> >  object_points; vector<vector<cv::point2f> > image_points;  cv::mat cam_mat;  cv::mat dist_coeffs; vector<cv::mat> rvecs, tvecs;  std::vector<cv::point3f> t_3d; t_3d.push_back(cv::point3f(0.9, -3, 57.5)); t_3d.push_back(cv::point3f(1.45, -3, 57.5)); t_3d.push_back(cv::point3f(2, -3, 57.5)); t_3d.push_back(cv::point3f(0.9, -3, 53)); t_3d.push_back(cv::point3f(1.45, -3, 53)); t_3d.push_back(cv::point3f(2, -3, 53)); object_points.push_back(t_3d);  std::vector<cv::point2f> t_2d; t_2d.push_back(cv::point2f(434, 362)); t_2d.push_back(cv::point2f(570, 362)); t_2d.push_back(cv::point2f(706, 325)); t_2d.push_back(cv::point2f(513, 574)); t_2d.push_back(cv::point2f(513, 574)); t_2d.push_back(cv::point2f(654, 557)); 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);  cv::mat tx(4, 1, cv_64f, cv::scalar(1.0)); tx.at<double>(0, 0) = 0.9; tx.at<double>(1, 0) = -3; tx.at<double>(2, 0) = 57.5;  cv::mat rrr ; cv::projectpoints(object_points.at(0), rvecs.at(0), tvecs.at(0),cam_mat,                   dist_coeffs, rrr); 

i except rrr variable contain value of (434, 362), gets filled 6 nonsensical values:

rrr = [1.53232e+18, 1.08633e+18, 7.72618e+17, 7.09485e+19, 7.192e+19, 7.26505e+19] 

what wrong?


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -