Skip to content

Commit

Permalink
[software] featureMatching : Rename option nonPosesGeometricErrorMax
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo committed Jan 22, 2020
1 parent 3bf747a commit 0ac65c8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,25 @@ void PointsToMat(
}

/// Use geometry of the views to compute a putative structure from features and descriptors.
void StructureEstimationFromKnownPoses::run(double thresholdF,
SfMData& sfmData,
void StructureEstimationFromKnownPoses::run(SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView)
const feature::RegionsPerView& regionsPerView,
double knownPosesGeometricErrorMax)
{
sfmData.structure.clear();

match(thresholdF, sfmData, pairs, regionsPerView);
match(sfmData, pairs, regionsPerView, knownPosesGeometricErrorMax);
filter(sfmData, pairs, regionsPerView);
triangulate(sfmData, regionsPerView);
}

// #define ALICEVISION_EXHAUSTIVE_MATCHING

/// Use guided matching to find corresponding 2-view correspondences
void StructureEstimationFromKnownPoses::match(double thresholdF,
const SfMData& sfmData,
void StructureEstimationFromKnownPoses::match(const SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView)
const feature::RegionsPerView& regionsPerView,
double knownPosesGeometricErrorMax)
{
boost::progress_display my_progress_bar( pairs.size(), std::cout,
"Compute pairwise fundamental guided matching:\n" );
Expand Down Expand Up @@ -140,7 +140,7 @@ void StructureEstimationFromKnownPoses::match(double thresholdF,
regionsPerView.getRegions(it->second, descType),
iterIntrinsicR->second->w(), iterIntrinsicR->second->h(),
//descType,
Square(thresholdF), Square(0.8),
Square(knownPosesGeometricErrorMax), Square(0.8),
matches
);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ class StructureEstimationFromKnownPoses
public:

/// Use geometry of the views to compute a putative structure from features and descriptors.
void run(double thresholdF,
sfmData::SfMData& sfmData,
void run(sfmData::SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView);
const feature::RegionsPerView& regionsPerView,
double knownPosesGeometricErrorMax);

public:

/// Use guided matching to find corresponding 2-view correspondences
void match(double thresholdF,
const sfmData::SfMData& sfmData,
void match(const sfmData::SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView);
const feature::RegionsPerView& regionsPerView,
double knownPosesGeometricErrorMax);

/// Filter inconsistent correspondences by using 3-view correspondences on view triplets
void filter(
Expand Down
10 changes: 6 additions & 4 deletions src/software/pipeline/main_computeStructureFromKnownPoses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char **argv)
std::string sfmDataFilename;
std::string outSfMDataFilename;
std::vector<std::string> featuresFolders;

double knownPosesGeometricErrorMax = 5.0;
// user optional parameters

std::string describerTypesName = feature::EImageDescriberType_enumToString(feature::EImageDescriberType::SIFT);
Expand All @@ -59,7 +59,10 @@ int main(int argc, char **argv)
("describerTypes,d", po::value<std::string>(&describerTypesName)->default_value(describerTypesName),
feature::EImageDescriberType_informations().c_str())
("matchesFolders,m", po::value<std::vector<std::string>>(&matchesFolders)->multitoken()->required(),
"Path to folder(s) in which computed matches are stored.");
"Path to folder(s) in which computed matches are stored.")
("knownPosesGeometricErrorMax", po::value<double>(&knownPosesGeometricErrorMax)->default_value(knownPosesGeometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification for non camera poses known. "
"If set to 0 it lets the ACRansac select an optimal value.");

po::options_description logParams("Log parameters");
logParams.add_options()
Expand Down Expand Up @@ -151,9 +154,8 @@ int main(int argc, char **argv)
sfmData.structure.clear();

// compute Structure from known camera poses
double thresholdF=0.0;
sfm::StructureEstimationFromKnownPoses structureEstimator;
structureEstimator.match(thresholdF,sfmData, pairs, regionsPerView);
structureEstimator.match(sfmData, pairs, regionsPerView, knownPosesGeometricErrorMax);

// unload descriptors before triangulation
regionsPerView.clearDescriptors();
Expand Down
9 changes: 5 additions & 4 deletions src/software/pipeline/main_featureMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ int main(int argc, char **argv)
std::string nearestMatchingMethod = "ANN_L2";
robustEstimation::ERobustEstimator geometricEstimator = robustEstimation::ERobustEstimator::ACRANSAC;
double geometricErrorMax = 0.0; //< the maximum reprojection error allowed for image matching with geometric validation
double thresholdF=0.0;
double knownPosesGeometricErrorMax=5.0;
bool savePutativeMatches = false;
bool guidedMatching = false;
int maxIteration = 2048;
Expand Down Expand Up @@ -158,8 +158,9 @@ int main(int argc, char **argv)
("geometricError", po::value<double>(&geometricErrorMax)->default_value(geometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification. "
"If set to 0 it lets the ACRansac select an optimal value.")
("thresholdF", po::value<double>(&thresholdF)->default_value(thresholdF),
"")
("knownPosesGeometricErrorMax", po::value<double>(&knownPosesGeometricErrorMax)->default_value(knownPosesGeometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification for non camera poses known. "
"If set to 0 it lets the ACRansac select an optimal value.")
("savePutativeMatches", po::value<bool>(&savePutativeMatches)->default_value(savePutativeMatches),
"Save putative matches.")
("guidedMatching", po::value<bool>(&guidedMatching)->default_value(guidedMatching),
Expand Down Expand Up @@ -340,7 +341,7 @@ int main(int argc, char **argv)
ALICEVISION_LOG_INFO("Putative matches from known poses: " << pairsPoseKnown.size() << " image pairs.");

sfm::StructureEstimationFromKnownPoses structureEstimator;
structureEstimator.match(thresholdF, sfmData, pairsPoseKnown, regionPerView);
structureEstimator.match(sfmData, pairsPoseKnown, regionPerView, knownPosesGeometricErrorMax);
mapPutativesMatches = structureEstimator.getPutativesMatches();
}

Expand Down

0 comments on commit 0ac65c8

Please sign in to comment.