Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -780,20 +780,19 @@ bool PinholeProjection<DISTORTION_T>::initializeIntrinsics(const std::vector<Gri
}
}
if(f_guesses.empty()) {
std::cout << "Initialization of focal length failed." << std::endl;
const char* manual_input = std::getenv("KALIBR_MANUAL_FOCAL_LENGTH_INIT");
if(manual_input != nullptr) {
double input_guess;
std::cout << "Initialization of focal length failed. Provide manual initialization: " << std::endl;
std::cin >> input_guess;
SM_ASSERT_GT(std::runtime_error, input_guess, 0.0,
"Focal length needs to be positive.");
std::cout << "Initializing focal length to " << input_guess << std::endl;
f_guesses.push_back(input_guess);
double input_guess;
if(manual_input != nullptr && manual_input[0] != '\0') {
input_guess = std::stod(manual_input);
} else {
std::cout << "Initialization of focal length failed. You can enable"
<< " manual input by setting 'KALIBR_MANUAL_FOCAL_LENGTH_INIT'." << std::endl;
return false;
std::cout << "Provide manual initialization: " << std::endl;
std::cin >> input_guess;
}
SM_ASSERT_GT(std::runtime_error, input_guess, 0.0,
"Focal length needs to be positive.");
std::cout << "Initializing focal length to " << input_guess << std::endl;
f_guesses.push_back(input_guess);
}
// Get the median of the guesses if available.
double f0 = PinholeHelpers::medianOfVectorElements(f_guesses);
Expand Down