@@ -80,6 +80,7 @@ struct FilterParams
8080 bool observationsPropagationEnabled = true ;
8181 int observationsPropagationFrequency = 1 ;
8282 int observationsPropagationCount = 1 ;
83+ bool observationsPropagationKeep = false ;
8384 double neighborsInfluence = 0.5 ;
8485 int nbIterations = 5 ;
8586 bool dampingEnabled = true ;
@@ -100,7 +101,7 @@ std::istream& operator>>(std::istream& in, FilterParams& params)
100101 in >> token;
101102 std::vector<std::string> splitParams;
102103 boost::split (splitParams, token, boost::algorithm::is_any_of (" :" ));
103- if (splitParams.size () != 24 )
104+ if (splitParams.size () != 25 )
104105 throw std::invalid_argument (" Failed to parse FilterParams from: \n " + token);
105106 int i = 0 ;
106107
@@ -124,6 +125,7 @@ std::istream& operator>>(std::istream& in, FilterParams& params)
124125 params.filterObservations3D .observationsPropagationEnabled = boost::to_lower_copy (splitParams[i++]) == " true" ;
125126 params.filterObservations3D .observationsPropagationFrequency = boost::lexical_cast<int >(splitParams[i++]);
126127 params.filterObservations3D .observationsPropagationCount = boost::lexical_cast<int >(splitParams[i++]);
128+ params.filterObservations3D .observationsPropagationKeep = boost::to_lower_copy (splitParams[i++]) == " true" ;
127129 params.filterObservations3D .neighborsInfluence = boost::lexical_cast<double >(splitParams[i++]);
128130 params.filterObservations3D .nbIterations = boost::lexical_cast<int >(splitParams[i++]);
129131 params.filterObservations3D .dampingEnabled = boost::to_lower_copy (splitParams[i++]) == " true" ;
@@ -924,9 +926,14 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
924926 {
925927 // add observation only if it's an original observation and not augmented
926928 const auto & viewId = viewIds[idx[j]];
927- const auto & obsIt = landmark.observations .find (viewId);
928- if (obsIt != landmark.observations .end ())
929+ if (params.observationsPropagationKeep )
929930 filteredObservations[viewId] = landmark.observations [viewId];
931+ else
932+ {
933+ const auto & obsIt = landmark.observations .find (viewId);
934+ if (obsIt != landmark.observations .end ())
935+ filteredObservations[viewId] = landmark.observations [viewId];
936+ }
930937 }
931938 landmark.observations = std::move (filteredObservations);
932939 }
@@ -1112,6 +1119,7 @@ int aliceVision_main(int argc, char *argv[])
11121119 " * Enable Propagating Observations: Propagate neighbors observations before propagating the scores.\n "
11131120 " * Frequency: Specifies every how many iterations should the observations be propagated.\n "
11141121 " * Count: Maximum number of times the observations are propagated (0 for no limit).\n "
1122+ " * Keep Observations: Specifies if propagated observations are to be kept at the end.\n "
11151123 " * Neighbors Influence: Specifies how much influential the neighbors are in selecting the best observations.\n "
11161124 " Between 0. and 1., the closer to 1., the more influencial the neighborhood is.\n "
11171125 " * Nb of Iterations: Number of iterations to propagate neighbors information.\n "
0 commit comments