Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fuseCut] added a parameter to filter points based on number of observations #885

Merged
merged 4 commits into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/aliceVision/fuseCut/DelaunayGraphCut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,12 +871,16 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector<int>& cams, const Po
verticesCoordsPrepare.resize(realMaxVertices);
std::vector<double> pixSizePrepare(realMaxVertices);
std::vector<float> simScorePrepare(realMaxVertices);

// counter for points filtered based on the number of observations (minVis)
int minVisCounter = 0;

ALICEVISION_LOG_INFO("simFactor: " << params.simFactor);
ALICEVISION_LOG_INFO("nbPixels: " << nbPixels);
ALICEVISION_LOG_INFO("maxVertices: " << params.maxPoints);
ALICEVISION_LOG_INFO("step: " << step);
ALICEVISION_LOG_INFO("realMaxVertices: " << realMaxVertices);
ALICEVISION_LOG_INFO("minVis: " << params.minVis);

ALICEVISION_LOG_INFO("Load depth maps and add points.");
{
Expand Down Expand Up @@ -1078,6 +1082,13 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector<int>& cams, const Po
pixSizePrepare[vIndex] = -1;
continue;
}
// Filter points based on their number of observations
if(visCams.size() < params.minVis)
{
pixSizePrepare[vIndex] = -1;
minVisCounter += 1;
continue;
}

const double angleScore = 1.0 + params.angleFactor / maxAngle;
// Combine angleScore with simScore
Expand All @@ -1095,6 +1106,7 @@ void DelaunayGraphCut::fuseFromDepthMaps(const StaticVector<int>& cams, const Po
ALICEVISION_LOG_INFO("Angle min: " << stat_minAngle << ", max: " << stat_maxAngle << ".");
ALICEVISION_LOG_INFO("Angle score min: " << stat_minAngleScore << ", max: " << stat_maxAngleScore << ".");
#endif
ALICEVISION_LOG_INFO((minVisCounter) << " points filtered based on the number of observations (minVis). ");
removeInvalidPoints(verticesCoordsPrepare, pixSizePrepare, simScorePrepare, verticesAttrPrepare);

ALICEVISION_LOG_INFO("Filter by angle score and sim score");
Expand Down
2 changes: 2 additions & 0 deletions src/aliceVision/fuseCut/DelaunayGraphCut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct FuseParams
/// The step used to load depth values from depth maps is computed from maxInputPts. Here we define the minimal value for this step,
/// so on small datasets we will not spend too much time at the beginning loading all depth values.
int minStep = 2;
/// After fusion, filter points based on their number of observations
int minVis = 2;

float simFactor = 15.0f;
float angleFactor = 15.0f;
Expand Down
2 changes: 2 additions & 0 deletions src/software/pipeline/main_meshing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ int aliceVision_main(int argc, char* argv[])
"simFactor")
("angleFactor", po::value<float>(&fuseParams.angleFactor)->default_value(fuseParams.angleFactor),
"angleFactor")
("minVis", po::value<int>(&fuseParams.minVis)->default_value(fuseParams.minVis),
"Filter points based on their number of observations")
("partitioning", po::value<EPartitioningMode>(&partitioningMode)->default_value(partitioningMode),
"Partitioning: 'singleBlock' or 'auto'.")
("repartition", po::value<ERepartitionMode>(&repartitionMode)->default_value(repartitionMode),
Expand Down