using max reprojection error (rather than average) for outlier rejection during triangulation
parent
245e802959
commit
03fac5cd02
|
@ -469,7 +469,7 @@ TriangulationResult triangulateSafe(const std::vector<CAMERA>& cameras,
|
||||||
|
|
||||||
// Check landmark distance and re-projection errors to avoid outliers
|
// Check landmark distance and re-projection errors to avoid outliers
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
double totalReprojError = 0.0;
|
double maxReprojError = 0.0;
|
||||||
for(const CAMERA& camera: cameras) {
|
for(const CAMERA& camera: cameras) {
|
||||||
const Pose3& pose = camera.pose();
|
const Pose3& pose = camera.pose();
|
||||||
if (params.landmarkDistanceThreshold > 0
|
if (params.landmarkDistanceThreshold > 0
|
||||||
|
@ -487,13 +487,13 @@ TriangulationResult triangulateSafe(const std::vector<CAMERA>& cameras,
|
||||||
if (params.dynamicOutlierRejectionThreshold > 0) {
|
if (params.dynamicOutlierRejectionThreshold > 0) {
|
||||||
const Point2& zi = measured.at(i);
|
const Point2& zi = measured.at(i);
|
||||||
Point2 reprojectionError(camera.project(point) - zi);
|
Point2 reprojectionError(camera.project(point) - zi);
|
||||||
totalReprojError += reprojectionError.vector().norm();
|
maxReprojError = std::max(maxReprojError, reprojectionError.vector().norm());
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
// Flag as degenerate if average reprojection error is too large
|
// Flag as degenerate if average reprojection error is too large
|
||||||
if (params.dynamicOutlierRejectionThreshold > 0
|
if (params.dynamicOutlierRejectionThreshold > 0
|
||||||
&& totalReprojError / m > params.dynamicOutlierRejectionThreshold)
|
&& maxReprojError > params.dynamicOutlierRejectionThreshold)
|
||||||
return TriangulationResult::Outlier();
|
return TriangulationResult::Outlier();
|
||||||
|
|
||||||
// all good!
|
// all good!
|
||||||
|
|
Loading…
Reference in New Issue