@@ -80,6 +80,7 @@ struct FilterParams
80
80
bool observationsPropagationEnabled = true ;
81
81
int observationsPropagationFrequency = 1 ;
82
82
int observationsPropagationCount = 1 ;
83
+ bool observationsPropagationKeep = false ;
83
84
double neighborsInfluence = 0.5 ;
84
85
int nbIterations = 5 ;
85
86
bool dampingEnabled = true ;
@@ -100,7 +101,7 @@ std::istream& operator>>(std::istream& in, FilterParams& params)
100
101
in >> token;
101
102
std::vector<std::string> splitParams;
102
103
boost::split (splitParams, token, boost::algorithm::is_any_of (" :" ));
103
- if (splitParams.size () != 24 )
104
+ if (splitParams.size () != 25 )
104
105
throw std::invalid_argument (" Failed to parse FilterParams from: \n " + token);
105
106
int i = 0 ;
106
107
@@ -124,6 +125,7 @@ std::istream& operator>>(std::istream& in, FilterParams& params)
124
125
params.filterObservations3D .observationsPropagationEnabled = boost::to_lower_copy (splitParams[i++]) == " true" ;
125
126
params.filterObservations3D .observationsPropagationFrequency = boost::lexical_cast<int >(splitParams[i++]);
126
127
params.filterObservations3D .observationsPropagationCount = boost::lexical_cast<int >(splitParams[i++]);
128
+ params.filterObservations3D .observationsPropagationKeep = boost::to_lower_copy (splitParams[i++]) == " true" ;
127
129
params.filterObservations3D .neighborsInfluence = boost::lexical_cast<double >(splitParams[i++]);
128
130
params.filterObservations3D .nbIterations = boost::lexical_cast<int >(splitParams[i++]);
129
131
params.filterObservations3D .dampingEnabled = boost::to_lower_copy (splitParams[i++]) == " true" ;
@@ -924,9 +926,14 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
924
926
{
925
927
// add observation only if it's an original observation and not augmented
926
928
const auto & viewId = viewIds[idx[j]];
927
- const auto & obsIt = landmark.observations .find (viewId);
928
- if (obsIt != landmark.observations .end ())
929
+ if (params.observationsPropagationKeep )
929
930
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
+ }
930
937
}
931
938
landmark.observations = std::move (filteredObservations);
932
939
}
@@ -1112,6 +1119,7 @@ int aliceVision_main(int argc, char *argv[])
1112
1119
" * Enable Propagating Observations: Propagate neighbors observations before propagating the scores.\n "
1113
1120
" * Frequency: Specifies every how many iterations should the observations be propagated.\n "
1114
1121
" * 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 "
1115
1123
" * Neighbors Influence: Specifies how much influential the neighbors are in selecting the best observations.\n "
1116
1124
" Between 0. and 1., the closer to 1., the more influencial the neighborhood is.\n "
1117
1125
" * Nb of Iterations: Number of iterations to propagate neighbors information.\n "
0 commit comments