Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to manually input forcal length #304

Merged
merged 4 commits into from
Oct 23, 2019
Merged
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
@@ -1,5 +1,6 @@
#include <opencv2/core/eigen.hpp>
#include <Eigen/StdVector>
#include <iostream>

namespace aslam {

Expand Down Expand Up @@ -777,9 +778,16 @@ bool PinholeProjection<DISTORTION_T>::initializeIntrinsics(const std::vector<Gri
}
}

//get the median of the guesses
if(f_guesses.empty())
return false;
// Get the median of the guesses if available.
if(f_guesses.empty()) {
double input_guess;
std::cout << "Initialization of focal length failed. Provide manual initialization: ";
std::cin >> input_guess;
floriantschopp marked this conversation as resolved.
Show resolved Hide resolved
SM_ASSERT_GT(std::runtime_error, input_guess, 0.0,
"Focal length needs to be positive.");
std::cout << "Initializing focal length to " << input_guess << "\n";
f_guesses.push_back(input_guess);
}
double f0 = PinholeHelpers::medianOfVectorElements(f_guesses);

//set the estimate
Expand Down