Skip to content

Commit e07bc8d

Browse files
committed
[filterSfM] add option for not using feature scale
when computing pixel size
1 parent b62ce7b commit e07bc8d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/software/pipeline/main_filterSfM.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class PixSizeSearch
120120
inline double worstDist() const { return _radius_sq; }
121121
};
122122

123-
bool filterLandmarks(SfMData& sfmData, double radiusScale)
123+
bool filterLandmarks(SfMData& sfmData, double radiusScale, bool useFeatureScale)
124124
{
125125
std::vector<Landmark> landmarksData(sfmData.getLandmarks().size());
126126
{
@@ -146,8 +146,10 @@ bool filterLandmarks(SfMData& sfmData, double radiusScale)
146146
for(const auto& observationPair : landmark.observations)
147147
{
148148
const IndexT viewId = observationPair.first;
149-
pixSize += mp.getCamPixelSize(Point3d(landmark.X.x(), landmark.X.y(), landmark.X.z()),
150-
mp.getIndexFromViewId(viewId), observationPair.second.scale);
149+
pixSize += mp.getCamPixelSize(
150+
Point3d(landmark.X.x(), landmark.X.y(), landmark.X.z()),
151+
mp.getIndexFromViewId(viewId),
152+
useFeatureScale ? observationPair.second.scale : 1);
151153
n++;
152154
}
153155
pixSize /= n;
@@ -269,6 +271,7 @@ int aliceVision_main(int argc, char *argv[])
269271
std::string outputSfmFilename;
270272
int maxNbObservationsPerLandmark = 5;
271273
double radiusScale = 2;
274+
bool useFeatureScale = true;
272275

273276
// user optional parameters
274277
std::vector<std::string> featuresFolders;
@@ -287,7 +290,9 @@ int aliceVision_main(int argc, char *argv[])
287290
("maxNbObservationsPerLandmark", po::value<int>(&maxNbObservationsPerLandmark)->default_value(maxNbObservationsPerLandmark),
288291
"Maximum number of allowed observations per landmark.")
289292
("radiusScale", po::value<double>(&radiusScale)->default_value(radiusScale),
290-
"Scale factor applied to pixel size based radius filter applied to landmarks.")
293+
"Scale factor applied to pixel size based radius filter applied to landmarks.")(
294+
"useFeatureScale", po::value<bool>(&useFeatureScale)->default_value(useFeatureScale),
295+
"If true, use feature scale for computing pixel size. Otherwise, use a scale of 1 pixel.")
291296
("featuresFolders,f", po::value<std::vector<std::string>>(&featuresFolders)->multitoken(),
292297
"Path to folder(s) containing the extracted features.")
293298
("matchesFolders,m", po::value<std::vector<std::string>>(&matchesFolders)->multitoken(),
@@ -322,7 +327,7 @@ int aliceVision_main(int argc, char *argv[])
322327
if(radiusScale > 0)
323328
{
324329
ALICEVISION_LOG_INFO("Filtering landmarks: started.");
325-
filterLandmarks(sfmData, radiusScale);
330+
filterLandmarks(sfmData, radiusScale, useFeatureScale);
326331
ALICEVISION_LOG_INFO("Filtering landmarks: done.");
327332
}
328333

0 commit comments

Comments
 (0)