Skip to content

Commit adfee7e

Browse files
committed
add fix for 0 focal length
1 parent 18a70ee commit adfee7e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

glomap/estimators/view_graph_calibration.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ void ViewGraphCalibrator::Reset(
5555
focals_.reserve(cameras.size());
5656
for (const auto& [camera_id, camera] : cameras) {
5757
focals_[camera_id] = camera.Focal();
58+
// Avoid zero focal length
59+
if (focals_[camera_id] < 1e-3) {
60+
focals_[camera_id] =
61+
std::max(std::max(camera.width, camera.height) * 1.2, 1e-3);
62+
}
5863
}
5964

6065
// Set up the problem
@@ -179,7 +184,7 @@ size_t ViewGraphCalibrator::FilterImagePairs(ViewGraph& view_graph) const {
179184
}
180185

181186
LOG(INFO) << "invalid / total number of two view geometry: "
182-
<< invalid_counter << " / " << counter;
187+
<< invalid_counter << " / " << (counter / 2);
183188

184189
return invalid_counter;
185190
}

0 commit comments

Comments
 (0)