Skip to content

Commit

Permalink
Merge pull request #304 from ethz-asl/feature/input_focal_length_guess
Browse files Browse the repository at this point in the history
add option to manually input forcal length
  • Loading branch information
floriantschopp authored Oct 23, 2019
2 parents ee2b09d + 7a29676 commit 2999e18
Showing 1 changed file with 11 additions and 3 deletions.
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;
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

0 comments on commit 2999e18

Please # to comment.