本文整理汇总了C++中Labels::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Labels::name方法的具体用法?C++ Labels::name怎么用?C++ Labels::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Labels
的用法示例。
在下文中一共展示了Labels::name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upLabels
vector<float> ShadeShapeMatch::match(ShadeShape upSS, ShadeShape dbSS) {
ShapeMatch shapematch;
ShadeMatch shadematch;
String newNameUP = upSS.name()+"_"+dbSS.name();
String newNameDB = dbSS.name()+"_"+upSS.name();
shadematch.setMaxShades(upSS.get_shades(),dbSS.get_shades());
float upTotalArea = upSS.areaPostDensityConnector();
float dbTotalArea = dbSS.areaPostDensityConnector();
this->upIslandVec = this->groupIslandsByShape(upSS);
this->dbIslandVec = this->groupIslandsByShape(dbSS);
this->sortIslandsByArea(this->dbIslandVec);
this->sortIslandsByArea(this->upIslandVec);
Labels upLabels(this->upIslandVec,upTotalArea,upSS.name());
Labels dbLabels(this->dbIslandVec,dbTotalArea,dbSS.name());
Labels upLabelsFilled = upLabels;
Labels dbLabelsFilled = dbLabels;
this->fillMissingLabels(upLabelsFilled,dbLabelsFilled);
//Labels::printCompareLabels(upLabelsFilled,dbLabelsFilled);
//cout << "--------------------------" << endl;
vector<vector<float> > resultVec;
vector<vector<vector<Islands> > > islandVec2;
vector<vector<vector<Islands> > > islandVec3;
float maxResults = 0.0, finalTR1 = 0.0, finalTR2_match = 0.0, finalTR2_mismatch = 0.0;
Labels largestLabelsUP = upLabelsFilled;
Labels largestLabelsDB = dbLabelsFilled ;
vector<vector<vector<Islands> > > largestIslandVec;
Mat largestImg = upSS.image(), maxMatchImg = upSS.image();
String maxNStr = "";
float prevScore = tr1ForShade(upLabelsFilled,dbLabelsFilled); //> initialize
prevScore = roundDecimal(prevScore,6);
for(int n=0; n<3; n++) {
for(unsigned int shadeShift=0; shadeShift<shadematch.SHIFT().size(); shadeShift++) {
bool isShifted = false;
islandVec2 = this->upIslandVec;
float largestResult = prevScore;
vector<vector<vector<Islands> > > largestIslandVec2 = islandVec2;
ImageData upId = upSS.getImageData();
ShadeShape newUpSS(upId,false);
if(n==0) {
while(shadematch.shade_translation1(newUpSS,shadeShift)) {
ShadeShape matchSS(newUpSS.getImageData(),false);
islandVec2 = this->groupIslandsByShape(matchSS);
this->sortIslandsByArea(islandVec2);
upLabels = Labels(islandVec2,matchSS.area(),matchSS.name());
upLabelsFilled = upLabels;
dbLabelsFilled = dbLabels;
this->fillMissingLabels(upLabelsFilled,dbLabelsFilled);
float results = this->tr1ForShade(upLabelsFilled,dbLabelsFilled);
results = roundDecimal(results,6);
///////////////////////////////////////////////
//################ Debug Print ####################//
if(this->debugMode>=1) {
printf("n: %d\n",n);
printf("ShadeShift: %s, ",shadematch.SHIFT()[shadeShift].c_str());
printf("Results: %f\n",results);
printf("PrevScore: %f\n",prevScore);
Labels::printCompareLabels(upLabelsFilled,dbLabelsFilled);
printf("LargestResult: %f\n",largestResult);
printf("StoreIdx.size(): %lu\n",shadematch.getStoredFeatIslIdx().size());
printf("isStored: %d\n",shadematch.isFeatIslStored());
cout << "-------------------------" << endl;
}
//############### End Debug Print ###################//
////////////////////////////////////////////////
if(results>largestResult || (results>=largestResult && shadeShift==ShadeMatch::SHIFT_NONE)) {
isShifted = true;
largestResult = results;
largestIslandVec2 = islandVec2;
largestImg = matchSS.image();
if(shadeShift==ShadeMatch::SHIFT_NONE) {
islandVec2 = largestIslandVec2;
break;
}
} else {
if(shadematch.isFeatIslStored()) {
shadematch.getStoredFeatIslIdx().pop_back();
}
islandVec2 = largestIslandVec2;
break;
}
} // end while
} else if(n==1 && shadeShift==ShadeMatch::SHIFT_LEFT) {
isShifted = shadematch.shade_translation2(newUpSS,shadeShift);
ShadeShape matchSS(newUpSS.getImageData(),false);
islandVec2 = this->groupIslandsByShape(matchSS);
this->sortIslandsByArea(islandVec2);
largestImg = matchSS.image().clone();
} else if(n==2 && shadeShift==ShadeMatch::SHIFT_RIGHT) {
isShifted = shadematch.shade_translation2(newUpSS,shadeShift);
ShadeShape matchSS(newUpSS.getImageData(),false);
islandVec2 = this->groupIslandsByShape(matchSS);
this->sortIslandsByArea(islandVec2);
largestImg = matchSS.image().clone();
}
// start shape shifting
if(isShifted) {
vector<vector<int> > islandVecIdxSorted = shapematch.getIslandVecIdxByArea(islandVec2);
int shapeNum1 = islandVecIdxSorted.at(0).at(0);
int shapeNum2 = islandVecIdxSorted.at(1).at(0);
//.........这里部分代码省略.........