Moved 2D confidence scaling to a later step.

This commit is contained in:
Daniel
2025-03-24 14:16:08 +01:00
parent 7e3151530e
commit 0841713e1a
3 changed files with 32 additions and 16 deletions

View File

@ -828,6 +828,27 @@ std::vector<std::vector<std::array<float, 4>>> TriangulatorInternal::triangulate
auto [pose3d, score] = triangulate_and_score(
pose1, pose2, cam1, cam2, roomparams, {});
// Scale scores with 2D confidences
// They can improve the merge weighting, but especially the earlier step of pair-filtering
// works better if only per-view consistency is used, so they are not included before.
for (size_t j = 0; j < pose3d.size(); ++j)
{
float score1 = pose1[j][2];
float score2 = pose2[j][2];
float min_score = 0.1;
if (score1 > min_score && score2 > min_score)
{
float scoreP = (score1 + score2) * 0.5;
float scoreT = pose3d[j][3];
// Since the triangulation score is less sensitive and generally higher,
// weight it stronger to balance the two scores.
pose3d[j][3] = 0.9 * scoreT + 0.1 * scoreP;
}
}
all_full_poses[i] = std::move(pose3d);
}
@ -1430,11 +1451,7 @@ std::pair<std::vector<std::array<float, 4>>, float> TriangulatorInternal::triang
if (mask[i])
{
float scoreT = 0.5 * (score1[i] + score2[i]);
float scoreP = 0.5 * (pose1[i][2] + pose2[i][2]);
// Since the triangulation score is less sensitive and generally higher,
// weight it stronger to balance the two scores.
pose3d[i][3] = 0.9 * scoreT + 0.1 * scoreP;
pose3d[i][3] = scoreT;
}
}