当前位置: 首页>>代码示例>>C++>>正文


C++ Labels::name方法代码示例

本文整理汇总了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);
//.........这里部分代码省略.........
开发者ID:theunknowner,项目名称:WebDerm,代码行数:101,代码来源:shadeshapematch.cpp


注:本文中的Labels::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。