Skip to content

Commit

Permalink
Fix inliers matches extraction when the homography is selected over t…
Browse files Browse the repository at this point in the history
…he fundamental matrix in EstimateUncalibrated function. (colmap#1369)
  • Loading branch information
ferreram authored Jan 4, 2022
1 parent 7d61a08 commit 2e02875
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/estimators/two_view_geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,25 @@ void TwoViewGeometry::EstimateUncalibrated(
static_cast<double>(H_report.support.num_inliers) /
F_report.support.num_inliers;

const std::vector<char>* best_inlier_mask = &F_report.inlier_mask;
size_t num_inliers = F_report.support.num_inliers;

if (H_F_inlier_ratio > options.max_H_inlier_ratio) {
config = ConfigurationType::PLANAR_OR_PANORAMIC;
if (H_report.support.num_inliers >= F_report.support.num_inliers) {
num_inliers = H_report.support.num_inliers;
best_inlier_mask = &H_report.inlier_mask;
}
} else {
config = ConfigurationType::UNCALIBRATED;
}

inlier_matches = ExtractInlierMatches(matches, F_report.support.num_inliers,
F_report.inlier_mask);
inlier_matches =
ExtractInlierMatches(matches, num_inliers, *best_inlier_mask);

if (options.detect_watermark &&
DetectWatermark(camera1, matched_points1, camera2, matched_points2,
F_report.support.num_inliers, F_report.inlier_mask,
options)) {
num_inliers, *best_inlier_mask, options)) {
config = ConfigurationType::WATERMARK;
}
}
Expand Down

0 comments on commit 2e02875

Please sign in to comment.