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

bug: intrinsic parameters were not fixed

parent d0c10bb2
No related branches found
No related tags found
No related merge requests found
Pipeline #15134 passed
......@@ -237,18 +237,10 @@ void calibrate( MultiCameraCalibrationNew &calib, vector<string> &uri_cameras,
Mat P1, P2, Q;
Mat R1, R2;
Mat R_c1c2, T_c1c2;
LOG(INFO) << K1;
LOG(INFO) << K2;
calculateTransform(R[c], t[c], R[c + 1], t[c + 1], R_c1c2, T_c1c2);
cv::stereoRectify(K1, D1, K2, D2, params.size, R_c1c2, T_c1c2, R1, R2, P1, P2, Q, 0, params.alpha);
Mat rvec;
cv::Rodrigues(R_c1c2, rvec);
LOG(INFO) << "From camera " << c << " to " << c + 1;
LOG(INFO) << "rotation: " << rvec.t();
LOG(INFO) << "translation: " << T_c1c2.t();
// calculate extrinsics from rectified parameters
Mat _t = Mat(Size(1, 3), CV_64FC1, Scalar(0.0));
Rt_out[c] = getMat4x4(R[c], t[c]) * getMat4x4(R1, _t).inv();
......@@ -270,6 +262,14 @@ void calibrate( MultiCameraCalibrationNew &calib, vector<string> &uri_cameras,
);
LOG(INFO) << "Saved: " << params.output_path + node_name + "-extrinsic.yml";
}
else
{
Mat rvec;
cv::Rodrigues(R_c1c2, rvec);
LOG(INFO) << "From camera " << c << " to " << c + 1;
LOG(INFO) << "rotation: " << rvec.t();
LOG(INFO) << "translation: " << T_c1c2.t();
}
if (params.save_intrinsic)
{
......@@ -280,6 +280,11 @@ void calibrate( MultiCameraCalibrationNew &calib, vector<string> &uri_cameras,
);
LOG(INFO) << "Saved: " << params.output_path + node_name + "-intrinsic.yml";
}
else if (params.optimize_intrinsic)
{
LOG(INFO) << "K1:\n" << K1;
LOG(INFO) << "K2:\n" << K2;
}
}
// for visualization
......
......@@ -90,8 +90,9 @@ MultiCameraCalibrationNew::MultiCameraCalibrationNew(
n_cameras_(n_cameras),
reference_camera_(reference_camera),
min_visible_points_(50),
fix_intrinsics_(fix_intrinsics == 1 ? 5 : 0),
// NOTE: modified cvsba (intrinsics fixed in different order)
fix_intrinsics_(fix_intrinsics == 1 ? 2 : 5),
resolution_(resolution),
K_(n_cameras),
dist_coeffs_(n_cameras),
......@@ -491,7 +492,7 @@ double MultiCameraCalibrationNew::calibratePair(size_t camera_from, size_t camer
// Bundle Adjustment
// vector<Point3d> points3d_triangulated;
// points3d_triangulated.insert(points3d_triangulated.begin(), points3d.begin(), points3d.end());
LOG(INFO) << K1;
double err;
cvsba::Sba sba;
{
......
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