Skip to content

Commit

Permalink
[software] featureMatching: rename matchFromKnownCameraPoses
Browse files Browse the repository at this point in the history
  • Loading branch information
Theo committed Jan 24, 2020
1 parent b344d4e commit a4f3b6e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/aliceVision/matching/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,19 @@ void filterTopMatches(
const int limitNum,
const int minNum)
{
if (limitNum <= 0)
return;
if (minNum <= 0 || minNum > limitNum)
if (limitNum <= 0 && minNum <=0)
return;
if (minNum > limitNum)
throw std::runtime_error("The minimum of matches is higher than the maximum of matches");

for(auto& matchesPerDesc: allMatches)
{
for(auto& matches: matchesPerDesc.second)
{
IndMatches& m = matches.second;
if (m.size() > limitNum)
if (limitNum > 0 && m.size() > limitNum)
m.erase(m.begin()+limitNum, m.end());
if (m.size() < minNum)
if (minNum > 0 && m.size() < minNum)
m.erase(m.begin(), m.end());
}
}
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 knownPosesGeometricErrorMax)
double GeometricErrorMax)
{
sfmData.structure.clear();

match(sfmData, pairs, regionsPerView, knownPosesGeometricErrorMax);
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 knownPosesGeometricErrorMax)
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(knownPosesGeometricErrorMax), 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 knownPosesGeometricErrorMax);
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 knownPosesGeometricErrorMax);
double GeometricErrorMax);

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

std::string describerTypesName = feature::EImageDescriberType_enumToString(feature::EImageDescriberType::SIFT);
Expand All @@ -60,8 +60,8 @@ 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.")
("knownPosesGeometricErrorMax", po::value<double>(&knownPosesGeometricErrorMax)->default_value(knownPosesGeometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification for non camera poses known. "
("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.");

po::options_description logParams("Log parameters");
Expand Down Expand Up @@ -155,7 +155,7 @@ int main(int argc, char **argv)

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

// unload descriptors before triangulation
regionsPerView.clearDescriptors();
Expand Down
11 changes: 6 additions & 5 deletions src/software/pipeline/main_featureMatching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int main(int argc, char **argv)
size_t numMatchesToKeep = 0;
bool useGridSort = true;
bool exportDebugFiles = false;
bool matchFromCameraPosesKnown=false;
bool matchFromKnownCameraPoses = false;
const std::string fileExtension = "txt";

po::options_description allParams(
Expand Down Expand Up @@ -159,7 +159,7 @@ int main(int argc, char **argv)
"Maximum error (in pixels) allowed for features matching during geometric verification. "
"If set to 0 it lets the ACRansac select an optimal value.")
("knownPosesGeometricErrorMax", po::value<double>(&knownPosesGeometricErrorMax)->default_value(knownPosesGeometricErrorMax),
"Maximum error (in pixels) allowed for features matching during geometric verification for non camera poses known. "
"Maximum error (in pixels) allowed for features matching guided by geometric information from known camera poses. "
"If set to 0 it lets the ACRansac select an optimal value.")
("savePutativeMatches", po::value<bool>(&savePutativeMatches)->default_value(savePutativeMatches),
"Save putative matches.")
Expand All @@ -181,8 +181,9 @@ int main(int argc, char **argv)
"Range image index start.")
("rangeSize", po::value<int>(&rangeSize)->default_value(rangeSize),
"Range size.")
("matchFromCameraPosesKnown", po::value<bool>(&matchFromCameraPosesKnown)->default_value(matchFromCameraPosesKnown),
"Match from camera poses known");
("matchFromKnownCameraPoses", po::value<bool>(&matchFromKnownCameraPoses)->default_value(matchFromKnownCameraPoses),
"Enable the usage of geometric information from known camera poses to guide the feature matching. "
"If some cameras have unknown poses (so there is no geometric prior), the standard feature matching will be performed.");

po::options_description logParams("Log parameters");
logParams.add_options()
Expand Down Expand Up @@ -316,7 +317,7 @@ int main(int argc, char **argv)
PairSet pairsPoseKnown;
PairSet pairsPoseUnknown;

if(matchFromCameraPosesKnown)
if(matchFromKnownCameraPoses)
{
for(const auto& p: pairs)
{
Expand Down

0 comments on commit a4f3b6e

Please sign in to comment.