Skip to content

Commit

Permalink
add check to opensfm BA that GPS accuracies are positive
Browse files Browse the repository at this point in the history
Summary: For MLY internal we sometimes get -1 values for GPS accuracy. The new EXIF parser now prevents this from happening and sends None instead, but this diff adds an error message for this case so that we immediately notice if this ever happens again.

Reviewed By: DodgySpaniard

Differential Revision: D58373009

fbshipit-source-id: 526d92fbec49be7a9a8398648d722880ab138d54
  • Loading branch information
Michael Waechter authored and facebook-github-bot committed Jun 11, 2024
1 parent b18e638 commit c9d7d98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions opensfm/src/sfm/src/ba_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <chrono>
#include <cmath>
#include <stdexcept>
#include <string>

#include "geo/geo.h"
#include "map/defines.h"
Expand Down Expand Up @@ -672,6 +673,11 @@ py::dict BAHelpers::Bundle(
const auto pos = shot.GetShotMeasurements().gps_position_;
const auto acc = shot.GetShotMeasurements().gps_accuracy_;
if (pos.HasValue() && acc.HasValue()) {
if (acc.Value() <= 0) {
throw std::runtime_error("Shot " + shot.GetId() + " has an accuracy <= 0: "
+ std::to_string(acc.Value()) + ". Try modifying "
"your input parser to filter such values.");
}
average_position += pos.Value();
average_std += acc.Value();
++gps_count;
Expand Down

0 comments on commit c9d7d98

Please sign in to comment.