Skip to content

Commit 7aae1a0

Browse files
committed
[WIP][filterSfM] fix option to keep propagated observations
- create a fake observation by projecting the landmark in the view
1 parent 982fa24 commit 7aae1a0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/software/pipeline/main_filterSfM.cpp

+10-6
Original file line numberDiff line numberDiff line change
@@ -926,13 +926,17 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
926926
{
927927
// add observation only if it's an original observation and not augmented
928928
const auto& viewId = viewIds[idx[j]];
929-
if(params.observationsPropagationKeep)
930-
filteredObservations[viewId] = landmark.observations[viewId];
931-
else
929+
const auto& obsIt = landmark.observations.find(viewId);
930+
if(obsIt != landmark.observations.end())
931+
filteredObservations[viewId] = obsIt->second;
932+
else if (params.observationsPropagationKeep)
932933
{
933-
const auto& obsIt = landmark.observations.find(viewId);
934-
if(obsIt != landmark.observations.end())
935-
filteredObservations[viewId] = landmark.observations[viewId];
934+
// project landmark in view to find observation coords
935+
const sfmData::View* view = sfmData.getViews().at(viewId).get();
936+
const geometry::Pose3 pose = sfmData.getPose(*view).getTransform();
937+
const camera::IntrinsicBase* intrinsic = sfmData.getIntrinsics().at(view->getIntrinsicId()).get();
938+
const Vec2& x = intrinsic->project(pose, landmark.X.homogeneous());
939+
filteredObservations[viewId] = Observation(x, UndefinedIndexT, 0.0);
936940
}
937941
}
938942
landmark.observations = std::move(filteredObservations);

0 commit comments

Comments
 (0)