@@ -165,7 +165,7 @@ struct ObservationsAdaptator
165
165
inline size_t kdtree_get_point_count () const { return _data.size (); }
166
166
167
167
// Returns the dim'th component of the idx'th point in the class:
168
- inline T kdtree_get_pt (const size_t idx, int dim) const { return _data[idx].x (dim); }
168
+ inline T kdtree_get_pt (const size_t idx, int dim) const { return _data[idx].getCoordinates () (dim); }
169
169
170
170
// Optional bounding-box computation: return false to default to a standard bbox computation loop.
171
171
// Return true if the BBOX was already computed by the class and returned in "bb" so it can be avoided to redo it
@@ -353,7 +353,7 @@ ObservationsPerView getObservationsPerViews(SfMData& sfmData)
353
353
ObservationsPerView observationsPerView;
354
354
for (auto & landIt : sfmData.getLandmarks ())
355
355
{
356
- for (const auto & obsIt : landIt.second .observations )
356
+ for (const auto & obsIt : landIt.second .getObservations () )
357
357
{
358
358
IndexT viewId = obsIt.first ;
359
359
auto & landmarksSet = observationsPerView[viewId];
@@ -376,7 +376,7 @@ void filterLandmarks_step1(SfMData& sfmData,
376
376
ALICEVISION_LOG_INFO (" Removing landmarks having an insufficient number of observations: started." );
377
377
for (auto & it : sfmData.getLandmarks ())
378
378
{
379
- if (it.second .observations .size () < params.minNbObservationsPerLandmark )
379
+ if (it.second .getObservations () .size () < params.minNbObservationsPerLandmark )
380
380
continue ;
381
381
landmarksData[i++] = it.second ;
382
382
}
@@ -415,10 +415,10 @@ void filterLandmarks_step2(SfMData& sfmData,
415
415
for (auto i = 0 ; i < landmarksData.size (); i++)
416
416
{
417
417
const sfmData::Landmark& landmark = landmarksData[i];
418
- const auto & nbObservations = landmark.observations .size ();
418
+ const auto & nbObservations = landmark.getObservations () .size ();
419
419
auto & [viewIds, neighbors] = viewData[i];
420
420
viewIds.reserve (nbObservations);
421
- for (const auto & observationPair : landmark.observations )
421
+ for (const auto & observationPair : landmark.getObservations () )
422
422
{
423
423
const IndexT viewId = observationPair.first ;
424
424
viewIds.push_back (viewId);
@@ -504,12 +504,12 @@ void filterLandmarks_step3(SfMData& sfmData,
504
504
// compute landmark pixSize
505
505
double pixSize = 0 .;
506
506
int n = 0 ;
507
- for (const auto & observationPair : landmark.observations )
507
+ for (const auto & observationPair : landmark.getObservations () )
508
508
{
509
509
const IndexT viewId = observationPair.first ;
510
510
pixSize += mp.getCamPixelSize (Point3d (landmark.X .x (), landmark.X .y (), landmark.X .z ()),
511
511
mp.getIndexFromViewId (viewId),
512
- params.useFeatureScale ? observationPair.second .scale : 1 );
512
+ params.useFeatureScale ? observationPair.second .getScale () : 1 );
513
513
n++;
514
514
}
515
515
pixSize /= n;
@@ -594,13 +594,13 @@ void computeInitialObservationScores(SfMData& sfmData, std::vector<Landmark*>& l
594
594
const sfmData::Landmark& landmark = *landmarksData[i];
595
595
596
596
// compute observation scores
597
- const auto & nbObservations = landmark.observations .size ();
597
+ const auto & nbObservations = landmark.getObservations () .size ();
598
598
auto & [viewIds, viewScores] = viewScoresData[i];
599
599
viewIds.reserve (nbObservations);
600
600
viewScores.reserve (nbObservations);
601
601
// accumulator for normalizing the scores
602
602
double total = 0 .;
603
- for (const auto & observationPair : landmark.observations )
603
+ for (const auto & observationPair : landmark.getObservations () )
604
604
{
605
605
const IndexT viewId = observationPair.first ;
606
606
const sfmData::View& view = *(sfmData.getViews ().at (viewId));
@@ -869,7 +869,7 @@ void removeNonObservedLandmarks(SfMData& sfmData)
869
869
const auto & initialNbLandmarks = sfmData.getLandmarks ().size ();
870
870
for (auto it = sfmData.getLandmarks ().begin (); it != sfmData.getLandmarks ().end ();)
871
871
{
872
- if (it->second .observations .size () == 0 )
872
+ if (it->second .getObservations () .size () == 0 )
873
873
it = sfmData.getLandmarks ().erase (it);
874
874
else
875
875
++it;
@@ -920,14 +920,13 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
920
920
921
921
// keep only observations with best scores
922
922
Observations filteredObservations;
923
- size_t maxNbObservationsPerLandmark =
924
- std::min (static_cast <size_t >(params.maxNbObservationsPerLandmark ), landmark.observations .size ());
923
+ size_t maxNbObservationsPerLandmark = std::min (static_cast <size_t >(params.maxNbObservationsPerLandmark ), landmark.getObservations ().size ());
925
924
for (auto j = 0 ; j < maxNbObservationsPerLandmark; j++)
926
925
{
927
926
// add observation only if it's an original observation and not augmented
928
927
const auto & viewId = viewIds[idx[j]];
929
- const auto & obsIt = landmark.observations .find (viewId);
930
- if (obsIt != landmark.observations .end ())
928
+ const auto & obsIt = landmark.getObservations () .find (viewId);
929
+ if (obsIt != landmark.getObservations () .end ())
931
930
filteredObservations[viewId] = obsIt->second ;
932
931
else if (params.observationsPropagationKeep )
933
932
{
@@ -939,7 +938,7 @@ bool filterObservations3D(SfMData& sfmData, const FilterParams::FilterObservatio
939
938
filteredObservations[viewId] = Observation (x, UndefinedIndexT, 0.0 );
940
939
}
941
940
}
942
- landmark.observations = std::move (filteredObservations);
941
+ landmark.getObservations () = std::move (filteredObservations);
943
942
}
944
943
ALICEVISION_LOG_INFO (" Selecting observations with best scores: done" );
945
944
@@ -970,7 +969,7 @@ double filter2DView(SfMData& sfmData, const FilterParams::FilterObservations2DPa
970
969
std::vector<double > distances_ (nbNeighbors_);
971
970
KnnNonZeroSearch resultSet (nbNeighbors_);
972
971
resultSet.init (&indices_[0 ], &distances_[0 ]);
973
- tree.findNeighbors (resultSet, obs.x .data ());
972
+ tree.findNeighbors (resultSet, obs.getCoordinates () .data ());
974
973
const auto & nbFound = resultSet.size ();
975
974
if (nbFound == 0 )
976
975
continue ;
@@ -1023,7 +1022,7 @@ double filter2DView(SfMData& sfmData, const FilterParams::FilterObservations2DPa
1023
1022
}
1024
1023
1025
1024
bool filterObservations2D (SfMData& sfmData, const FilterParams::FilterObservations2DParams& params,
1026
- HashMap <IndexT, double >& estimatedRadii)
1025
+ std::map <IndexT, double >& estimatedRadii)
1027
1026
{
1028
1027
std::set<IndexT> viewIds = sfmData.getValidViews ();
1029
1028
std::vector<double > estimatedRadii_ (viewIds.size (), -1 .);
@@ -1046,7 +1045,7 @@ bool filterObservations2D(SfMData& sfmData, const FilterParams::FilterObservatio
1046
1045
// clear and update landmark observations
1047
1046
for (auto & landmark : sfmData.getLandmarks ())
1048
1047
{
1049
- landmark.second .observations .clear ();
1048
+ landmark.second .getObservations () .clear ();
1050
1049
}
1051
1050
for (int i = 0 ; i < viewIds.size (); ++i)
1052
1051
{
@@ -1064,7 +1063,7 @@ bool filterObservations2D(SfMData& sfmData, const FilterParams::FilterObservatio
1064
1063
auto & landmarks = observationsIt->second .second ;
1065
1064
for (int j = 0 ; j < observations.size (); j++)
1066
1065
{
1067
- landmarks[j]->observations [viewId] = observations[j];
1066
+ landmarks[j]->getObservations () [viewId] = observations[j];
1068
1067
}
1069
1068
}
1070
1069
}
@@ -1163,7 +1162,7 @@ int aliceVision_main(int argc, char *argv[])
1163
1162
1164
1163
// Read the input SfM scene
1165
1164
SfMData sfmData;
1166
- if (!sfmDataIO::Load (sfmData, inputSfmFilename, sfmDataIO::ESfMData::ALL))
1165
+ if (!sfmDataIO::load (sfmData, inputSfmFilename, sfmDataIO::ESfMData::ALL))
1167
1166
{
1168
1167
ALICEVISION_LOG_ERROR (" The input SfMData file '" << inputSfmFilename << " ' cannot be read." );
1169
1168
return EXIT_FAILURE;
@@ -1188,7 +1187,7 @@ int aliceVision_main(int argc, char *argv[])
1188
1187
1189
1188
if (params.filterObservations2D .enabled )
1190
1189
{
1191
- HashMap <IndexT, double > estimatedRadii;
1190
+ std::map <IndexT, double > estimatedRadii;
1192
1191
ALICEVISION_LOG_INFO (" Filtering observations in 2D: started." );
1193
1192
filterObservations2D (sfmData, params.filterObservations2D , estimatedRadii);
1194
1193
ALICEVISION_LOG_INFO (" Filtering observations in 2D: done." );
@@ -1206,7 +1205,7 @@ int aliceVision_main(int argc, char *argv[])
1206
1205
}
1207
1206
}
1208
1207
1209
- sfmDataIO::Save (sfmData, outputSfmFilename, sfmDataIO::ESfMData::ALL);
1208
+ sfmDataIO::save (sfmData, outputSfmFilename, sfmDataIO::ESfMData::ALL);
1210
1209
return EXIT_SUCCESS;
1211
1210
1212
1211
}
0 commit comments