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

option: update previous intrinsics

parent 56ae9758
No related branches found
No related tags found
1 merge request!87Bug/intrinsic scaling
Pipeline #12665 passed
...@@ -33,12 +33,13 @@ void ftl::calibration::intrinsic(map<string, string> &opt) { ...@@ -33,12 +33,13 @@ void ftl::calibration::intrinsic(map<string, string> &opt) {
const Size image_size = Size( getOptionInt(opt, "width", 1280), const Size image_size = Size( getOptionInt(opt, "width", 1280),
getOptionInt(opt, "height", 720)); getOptionInt(opt, "height", 720));
const int n_cameras = getOptionInt(opt, "n_cameras", 2); const int n_cameras = getOptionInt(opt, "n_cameras", 2);
const int iter = getOptionInt(opt, "iter", 60); const int iter = getOptionInt(opt, "iter", 40);
const int delay = getOptionInt(opt, "delay", 750); const int delay = getOptionInt(opt, "delay", 1);
const double aperture_width = getOptionDouble(opt, "aperture_width", 6.2); const double aperture_width = getOptionDouble(opt, "aperture_width", 6.2);
const double aperture_height = getOptionDouble(opt, "aperture_height", 4.6); const double aperture_height = getOptionDouble(opt, "aperture_height", 4.6);
const string filename_intrinsics = getOptionString(opt, "profile", FTL_LOCAL_CONFIG_ROOT "/intrinsics.yml"); const string filename_intrinsics = getOptionString(opt, "profile", FTL_LOCAL_CONFIG_ROOT "/intrinsics.yml");
CalibrationChessboard calib(opt); CalibrationChessboard calib(opt);
const bool use_guess = getOptionInt(opt, "use_guess", 1);
LOG(INFO) << "Intrinsic calibration parameters"; LOG(INFO) << "Intrinsic calibration parameters";
LOG(INFO) << " profile: " << filename_intrinsics; LOG(INFO) << " profile: " << filename_intrinsics;
...@@ -49,12 +50,24 @@ void ftl::calibration::intrinsic(map<string, string> &opt) { ...@@ -49,12 +50,24 @@ void ftl::calibration::intrinsic(map<string, string> &opt) {
LOG(INFO) << " delay: " << delay; LOG(INFO) << " delay: " << delay;
LOG(INFO) << " aperture_width: " << aperture_width; LOG(INFO) << " aperture_width: " << aperture_width;
LOG(INFO) << " aperture_height: " << aperture_height; LOG(INFO) << " aperture_height: " << aperture_height;
LOG(INFO) << " use_guess: " << use_guess;
LOG(INFO) << "-----------------------------------"; LOG(INFO) << "-----------------------------------";
int calibrate_flags = cv::CALIB_ZERO_TANGENT_DIST | cv::CALIB_FIX_ASPECT_RATIO; int calibrate_flags = cv::CALIB_ZERO_TANGENT_DIST | cv::CALIB_FIX_ASPECT_RATIO;
if (use_guess) { calibrate_flags |= cv::CALIB_USE_INTRINSIC_GUESS; }
// cv::CALIB_FIX_PRINCIPAL_POINT; // cv::CALIB_FIX_PRINCIPAL_POINT;
// PARAMETERS // PARAMETERS
vector<Mat> camera_matrix(n_cameras), dist_coeffs(n_cameras);
if (use_guess) {
camera_matrix.clear();
dist_coeffs.clear();
loadIntrinsics(filename_intrinsics, camera_matrix, dist_coeffs);
CHECK((camera_matrix.size() == dist_coeffs.size()) && (camera_matrix.size() == n_cameras));
}
vector<cv::VideoCapture> cameras; vector<cv::VideoCapture> cameras;
cameras.reserve(n_cameras); cameras.reserve(n_cameras);
for (int c = 0; c < n_cameras; c++) { cameras.emplace_back(c); } for (int c = 0; c < n_cameras; c++) { cameras.emplace_back(c); }
...@@ -102,8 +115,6 @@ void ftl::calibration::intrinsic(map<string, string> &opt) { ...@@ -102,8 +115,6 @@ void ftl::calibration::intrinsic(map<string, string> &opt) {
cv::waitKey(delay); cv::waitKey(delay);
} }
vector<Mat> camera_matrix(n_cameras), dist_coeffs(n_cameras);
for (int c = 0; c < n_cameras; c++) { for (int c = 0; c < n_cameras; c++) {
LOG(INFO) << "Calculating intrinsic paramters for camera " << std::to_string(c); LOG(INFO) << "Calculating intrinsic paramters for camera " << std::to_string(c);
......
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