Skip to content
Snippets Groups Projects
Commit aca25726 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

fix Q scaling

parent 409ae628
No related branches found
No related tags found
1 merge request!87Bug/intrinsic scaling
Pipeline #12642 passed
......@@ -119,12 +119,12 @@ bool Calibrate::_loadCalibration(cv::Size img_size, std::pair<Mat, Mat> &map1, s
img_size_ = img_size;
// TODO: normalize calibration
double scale_x = 1.0 / 1280.0;
double scale_y = 1.0 / 720.0;
double scale_x = ((double) img_size.width) / 1280.0;
double scale_y = ((double) img_size.height) / 720.0;
Mat scale(cv::Size(3, 3), CV_64F, 0.0);
scale.at<double>(0, 0) = (double) img_size.width * scale_x;
scale.at<double>(1, 1) = (double) img_size.height * scale_y;
scale.at<double>(0, 0) = (double) scale_x;
scale.at<double>(1, 1) = (double) scale_y;
scale.at<double>(2, 2) = 1.0;
M1_ = scale * M1_;
......@@ -132,9 +132,10 @@ bool Calibrate::_loadCalibration(cv::Size img_size, std::pair<Mat, Mat> &map1, s
P1_ = scale * P1_;
P2_ = scale * P2_;
Q_.at<double>(0, 3) = Q_.at<double>(3, 2) * (double) img_size.width * scale_x;
Q_.at<double>(1, 3) = Q_.at<double>(3, 2) * (double) img_size.height * scale_y;
Q_.at<double>(3, 3) = Q_.at<double>(3, 3) * (double) img_size.width * scale_x;
Q_.at<double>(0, 3) = Q_.at<double>(0, 3) * scale_x;
Q_.at<double>(1, 3) = Q_.at<double>(1, 3) * scale_y;
Q_.at<double>(2, 3) = Q_.at<double>(2, 3) * scale_x; // TODO: scaling?
Q_.at<double>(3, 3) = Q_.at<double>(3, 3) * scale_x;
// cv::cuda::remap() works only with CV_32FC1
initUndistortRectifyMap(M1_, D1_, R1_, P1_, img_size_, CV_32FC1, map1.first, map2.first);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment