本文整理汇总了C++中Matches::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ Matches::insert方法的具体用法?C++ Matches::insert怎么用?C++ Matches::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matches
的用法示例。
在下文中一共展示了Matches::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findClosestMatch
/*
* Find the closest match in db, return as element of matches
*/
void SemanticDescriptor::findClosestMatch(Database & db, Matches & matches)
{
SemanticDescriptor bestMatch = (*(db.dDB.begin())).first;
//matches.insert((*(db.dDB.begin())).second);
SemanticDescriptor compareID;
int matchStrength;
map<SemanticDescriptor, string>::iterator iter;
for (iter = db.dDB.begin(); iter != db.dDB.end(); ++iter) {
compareID = iter->first;
matchStrength = closerMatch(compareID, bestMatch, db);
/* If compareID is a better match, reset matches */
if (matchStrength > 0)
if (compareID.coverage(*this, db) >= .5) {
matches.clear();
matches.insert(iter->second);
bestMatch = compareID;
}
/* If compareID is an equal match, then add it to the set of matches */
if (matchStrength == 0)
if (compareID.coverage(*this, db) >= .5)
matches.insert(iter->second);
}
}
示例2: findExactMatches
/*
* Find exact matches for the semantic descriptor in the database
*/
bool SemanticDescriptor::findExactMatches(Database & db, Matches & matches)
{
SemanticDescriptor compareID;
map<SemanticDescriptor, string>::iterator iter;
for (iter = db.dDB.begin(); iter != db.dDB.end(); ++iter) {
compareID = iter->first;
if (equals(compareID, db)) {
matches.insert(iter->second);
}
}
return matches.size();
}
示例3: main
//.........这里部分代码省略.........
int gistCount = 10000,histLargeCount = 100, histSmallCount = 0, thumbCount = 0;
desc.add_options()
("help", "Display help message.")
("database,D", "Database mode")
("panorama,P", "Panorama mode")
("preprocess,S","Preprocessing mode")
("config,c", po::value<string>(&configFile), "Config file")
("inputdir,i", po::value<string>(&inputDir), "Input directory")
("filelist,f", po::value<string>(&fileList), "File list or data base list")
("left,l", po::value<string>(&databaseFileLeft), "Database for left part of images")
("right,r", po::value<string>(&databaseFileRight),"Database for right part of images")
("output,o", po::value<string>(&outputImageFile), "Output image file")
("width,w", po::value<int>(&width), "Panorama width. Default: 10240")
("height,h", po::value<int>(&height), "Panorama height. Default: 768")
("gist", po::value<int>(&gistCount), "Gist count")
("histlarge", po::value<int>(&histLargeCount), "Histogram (large) count")
("histsmall", po::value<int>(&histSmallCount), "Histogram (small) count")
("thumb", po::value<int>(&thumbCount), "Thumbnail count")
("linear", "Enable linear blending (default)")
("poisson", "Enable poisson blending")
;
po::variables_map vm;
po::store(po::parse_command_line(ac, av, desc), vm);
po::notify(vm);
#define V vm.count
if (V("help")) { cout << desc << endl; return 1; }
if (V("config")) loadConfig(configFile);
if (V("gist")) config.set("FILTER_GIST_MATCHES",gistCount);
if (V("histsmall")) config.set("FILTER_HISTSMALL_MATCHES",histSmallCount);
if (V("histlarge")) config.set("FILTER_HISTLARGE_MATCHES",histLargeCount);
if (V("thumb")) config.set("FILTER_THUMBNAIL_MATCHES",thumbCount);
Panorama pan(width,height,&config);
config.print();
Panorama::BlendingMode blend = Panorama::BLEND_LINEAR;
if (V("poisson")) blend = Panorama::BLEND_POISSON;
if (V("preprocess") && V("left") && V("right") && V("inputdir"))
{
Image image(inputDir);
float border = 1.0f/6.0f;
Descriptor leftDesc(image,int(image.columns()*border),image.rows(),0,0);
Descriptor rightDesc(image,int(image.columns()*border),image.rows(),int((1.0f-border)*image.columns()),0);
LOG->level(2);
config.set("FILTER_GIST_MATCHES",5000);
config.set("FILTER_HISTSMALL_MATCHES",0);
config.set("FILTER_HISTLARGE_MATCHES",0);
config.set("FILTER_THUMBNAIL_MATCHES",0);
Database leftFinal(&config), rightFinal(&config);
vector< left_right > files = loadDatabaseList(fileList);
BOOST_FOREACH( left_right& file, files)
{
Statistics statistics(0,true);
DescriptorFilter filter(&config,&statistics);
LOG_MSG << fmt("Reading databases '%' (left) and '%' (right)...") % file.first % file.second;
Database leftTmp(file.first), rightTmp(file.second);
Descriptors leftDescs = leftTmp.descriptors(), rightDescs = rightTmp.descriptors();
Matches leftMatches = filter.getMatches(leftDesc,leftDescs);
BOOST_FOREACH ( const Match& m, leftMatches)
{
if (m.desc)
{
statistics.exclude(leftDescs[m.desc->index()]);
statistics.exclude(rightDescs[m.desc->index()]);
}
}
Matches rightMatches = filter.getMatches(rightDesc,rightDescs);
Matches matches = leftMatches;
BOOST_FOREACH ( const Match& m, rightMatches )
matches.insert(m);
BOOST_FOREACH ( const Match& m, matches)
{
if (m.desc)
{
Descriptor* newLeft = new Descriptor(leftTmp[m.desc->index()]);
Descriptor* newRight = new Descriptor(rightTmp[m.desc->index()]);
leftFinal.push_back(newLeft);
rightFinal.push_back(newRight);
}
}
LOG_MSG << fmt("Left database contains %, right database contains %") % leftFinal.size() % rightFinal.size();
leftTmp.clear();
rightTmp.clear();
}