Skip to content

Commit

Permalink
[WIP][filterSfM] fix option to keep propagated observations
Browse files Browse the repository at this point in the history
- create a fake observation by projecting the landmark in the view
  • Loading branch information
almarouk committed Mar 26, 2024
1 parent 98cea2f commit d76e166
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/software/pipeline/main_filterSfM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -926,13 +926,17 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
{
// add observation only if it's an original observation and not augmented
const auto& viewId = viewIds[idx[j]];
if(params.observationsPropagationKeep)
filteredObservations[viewId] = landmark.observations[viewId];
else
const auto& obsIt = landmark.observations.find(viewId);
if(obsIt != landmark.observations.end())
filteredObservations[viewId] = obsIt->second;
else if (params.observationsPropagationKeep)
{
const auto& obsIt = landmark.observations.find(viewId);
if(obsIt != landmark.observations.end())
filteredObservations[viewId] = landmark.observations[viewId];
// project landmark in view to find observation coords
const sfmData::View* view = sfmData.getViews().at(viewId).get();
const geometry::Pose3 pose = sfmData.getPose(*view).getTransform();
const camera::IntrinsicBase* intrinsic = sfmData.getIntrinsics().at(view->getIntrinsicId()).get();
const Vec2& x = intrinsic->project(pose, landmark.X.homogeneous());
filteredObservations[viewId] = Observation(x, UndefinedIndexT, 0.0);
}
}
landmark.observations = std::move(filteredObservations);
Expand Down

0 comments on commit d76e166

Please sign in to comment.