Skip to content

Commit 2999e18

Browse files
Merge pull request #304 from ethz-asl/feature/input_focal_length_guess
add option to manually input forcal length
2 parents ee2b09d + 7a29676 commit 2999e18

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

aslam_cv/aslam_cameras/include/aslam/cameras/implementation/PinholeProjection.hpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <opencv2/core/eigen.hpp>
22
#include <Eigen/StdVector>
3+
#include <iostream>
34

45
namespace aslam {
56

@@ -777,9 +778,16 @@ bool PinholeProjection<DISTORTION_T>::initializeIntrinsics(const std::vector<Gri
777778
}
778779
}
779780

780-
//get the median of the guesses
781-
if(f_guesses.empty())
782-
return false;
781+
// Get the median of the guesses if available.
782+
if(f_guesses.empty()) {
783+
double input_guess;
784+
std::cout << "Initialization of focal length failed. Provide manual initialization: ";
785+
std::cin >> input_guess;
786+
SM_ASSERT_GT(std::runtime_error, input_guess, 0.0,
787+
"Focal length needs to be positive.");
788+
std::cout << "Initializing focal length to " << input_guess << "\n";
789+
f_guesses.push_back(input_guess);
790+
}
783791
double f0 = PinholeHelpers::medianOfVectorElements(f_guesses);
784792

785793
//set the estimate

0 commit comments

Comments
 (0)