Skip to content

Commit

Permalink
[software] ImageMatching : rename and move tree to option param
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo committed Jan 28, 2020
1 parent a4f3b6e commit 0711000
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/aliceVision/matching/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ bool Load(

if(maxNbMatches > 0)
filterTopMatches(matches, maxNbMatches, minNbMatches);
if(minNbMatches <= maxNbMatches)
filterTopMatches(matches, maxNbMatches, minNbMatches);

ALICEVISION_LOG_TRACE("Matches per image pair (after filtering):");
logMatches(matches);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ void PointsToMat(
void StructureEstimationFromKnownPoses::run(SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView,
double GeometricErrorMax)
double geometricErrorMax)
{
sfmData.structure.clear();

match(sfmData, pairs, regionsPerView, GeometricErrorMax);
match(sfmData, pairs, regionsPerView, geometricErrorMax);
filter(sfmData, pairs, regionsPerView);
triangulate(sfmData, regionsPerView);
}
Expand All @@ -76,7 +76,7 @@ void StructureEstimationFromKnownPoses::run(SfMData& sfmData,
void StructureEstimationFromKnownPoses::match(const SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView,
double GeometricErrorMax)
double geometricErrorMax)
{
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(const SfMData& sfmData,
regionsPerView.getRegions(it->second, descType),
iterIntrinsicR->second->w(), iterIntrinsicR->second->h(),
//descType,
Square(GeometricErrorMax), Square(0.8),
Square(geometricErrorMax), Square(0.8),
matches
);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class StructureEstimationFromKnownPoses
void run(sfmData::SfMData& sfmData,
const PairSet& pairs,
const feature::RegionsPerView& regionsPerView,
double GeometricErrorMax);
double geometricErrorMax);

public:

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

/// Filter inconsistent correspondences by using 3-view correspondences on view triplets
void filter(
Expand Down
4 changes: 2 additions & 2 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 GeometricErrorMax = 5.0;
double geometricErrorMax = 5.0;
// user optional parameters

std::string describerTypesName = feature::EImageDescriberType_enumToString(feature::EImageDescriberType::SIFT);
Expand All @@ -60,7 +60,7 @@ int main(int argc, char **argv)
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.")
("GeometricErrorMax", po::value<double>(&GeometricErrorMax)->default_value(GeometricErrorMax),
("GeometricErrorMax", po::value<double>(&geometricErrorMax)->default_value(geometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification for known camera poses. "
"If set to 0 it lets the ACRansac select an optimal value.");

Expand Down
18 changes: 9 additions & 9 deletions src/software/pipeline/main_imageMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,6 @@ int main(int argc, char** argv)
std::string sfmDataFilenameA;
/// the folder(s) containing the extracted features with their associated descriptors
std::vector<std::string> featuresFolders;
/// the filename of the voctree
std::string treeName="Vocabulary Tree";
/// the file in which to save the results
std::string outputFile;

Expand All @@ -568,8 +566,10 @@ int main(int argc, char** argv)
std::size_t numImageQuery = 50;
/// the number of neighbors to retrieve for each image in Sequential Mode
std::size_t numImageQuerySequential = 50;
/// the filename of the voctree
std::string treeFilepath;
/// the filename for the voctree weights
std::string weightsName;
std::string weightsFilepath;
/// flag for the optional weights file
bool withWeights = false;

Expand Down Expand Up @@ -598,9 +598,6 @@ int main(int argc, char** argv)
"SfMData file.")
("featuresFolders,f", po::value<std::vector<std::string>>(&featuresFolders)->multitoken()->required(),
"Path to folder(s) containing the extracted features.")
("tree,t", po::value<std::string>(&treeName)->default_value(treeName),
"Input file path of the vocabulary tree. This file can be generated by createVoctree. "
"This software is intended to be used with a generic, pre-trained vocabulary tree.")
("output,o", po::value<std::string>(&outputFile)->required(),
"Filepath to the output file with the list of selected image pairs.");

Expand All @@ -618,7 +615,10 @@ int main(int argc, char** argv)
("nbNeighbors", po::value<std::size_t>(&numImageQuerySequential)->default_value(numImageQuerySequential),
"The number of neighbors to retrieve for each image (If 0 it will "
"retrieve all the neighbors).")
("weights,w", po::value<std::string>(&weightsName),
("tree,t", po::value<std::string>(&treeFilepath)->default_value(treeFilepath),
"Input file path of the vocabulary tree. This file can be generated by 'createVoctree'. "
"This software is intended to be used with a generic, pre-trained vocabulary tree.")
("weights,w", po::value<std::string>(&weightsFilepath)->default_value(weightsFilepath),
"Input name for the vocabulary tree weight file, if not provided all voctree leaves will have the same weight.");

po::options_description multiSfMParams("Multiple SfM");
Expand Down Expand Up @@ -731,7 +731,7 @@ int main(int argc, char** argv)
}
case EImageMatchingMethod::VOCABULARYTREE:
{
conditionVocTree(treeName, withWeights, weightsName, matchingMode,featuresFolders, sfmDataA, nbMaxDescriptors, sfmDataFilenameA, sfmDataB,
conditionVocTree(treeFilepath, withWeights, weightsFilepath, matchingMode,featuresFolders, sfmDataA, nbMaxDescriptors, sfmDataFilenameA, sfmDataB,
sfmDataFilenameB, useMultiSfM, descriptorsFilesA, numImageQuery, selectedPairs);
break;
}
Expand All @@ -743,7 +743,7 @@ int main(int argc, char** argv)
case EImageMatchingMethod::SEQUENTIAL_AND_VOCABULARYTREE:
{
generateSequentialMatches(sfmDataA, numImageQuerySequential, selectedPairs);
conditionVocTree(treeName, withWeights, weightsName, matchingMode,featuresFolders, sfmDataA, nbMaxDescriptors, sfmDataFilenameA, sfmDataB,
conditionVocTree(treeFilepath, withWeights, weightsFilepath, matchingMode,featuresFolders, sfmDataA, nbMaxDescriptors, sfmDataFilenameA, sfmDataB,
sfmDataFilenameB, useMultiSfM, descriptorsFilesA, numImageQuery, selectedPairs);
break;
}
Expand Down

0 comments on commit 0711000

Please sign in to comment.