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


C++ DataBase::getNonFaceRect方法代码示例

本文整理汇总了C++中DataBase::getNonFaceRect方法的典型用法代码示例。如果您正苦于以下问题:C++ DataBase::getNonFaceRect方法的具体用法?C++ DataBase::getNonFaceRect怎么用?C++ DataBase::getNonFaceRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataBase的用法示例。


在下文中一共展示了DataBase::getNonFaceRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: floor

void BootstrapNonfaces
(vector<cv::Mat>& noFaceRects, cv::Mat& nonfaceFea, vector<int>& negIndex, DataBase& dataBase,
	NpdModel& npdModel, Model& model ,const char* nonfaceDBFile,
	int objSize, int numNegs,
	int numThreads) {
	
	int numLimit = floor(numNegs / 1000) + 1;
	int dispStep = floor(numNegs / 10) + 1;
	int dispCount = 0;

	if (!negIndex.empty() && dataBase.NonFaceDB.empty())
	{
		printf("Warning: negIndex not empty but NonfaceDB empty !\n");
		dataBase.getNonFaceRect(nonfaceDBFile, objSize, numNegs);
	}

	vector<cv::Mat> nonfacePatches;
	noFaceRects.clear();

	/*if npdModel is empty*/
	if (npdModel.isEmpty()) 
	{
		random_shuffle(dataBase.NonFaceDB.begin(), dataBase.NonFaceDB.end());
		nonfacePatches = dataBase.NonFaceDB;
		if (numNegs > int(nonfacePatches.size())) 
		{
			printf("Number of NonfaceDB not enough. Please check.");
		}
		else 
		{
			nonfacePatches.resize(numNegs);
		}
		
	}
	/*if npdmodel is not empty*/
	else 
	{
		nonfacePatches.resize(numNegs);
		int T = npdModel.numStages;

		int n;

		/*select noface images from nofaceDB*/
		if (!negIndex.empty() && !dataBase.NonFaceDB.empty()) 
		{
			int numValid = negIndex.size();
			vector<int> passCount;
			vector<double> score; 
			NPDClassify(score, passCount, npdModel, dataBase.NonFaceDB, negIndex, numThreads);
			vector<int> newNegIndex;

			for (int i = 0; i < int(negIndex.size()); i++) 
			{
				if (passCount[i] == T) 
				{
					newNegIndex.push_back(negIndex[i]);
				}
			}

			n = newNegIndex.size();

			cout << endl << n << " of " << numValid << " NonfaceDB samples. total: "
				<< (n < numNegs ? n : numNegs) << " of " << numNegs << endl;

			if (n > numNegs) 
			{
				random_shuffle(newNegIndex.begin(), newNegIndex.end());
				newNegIndex.resize(numNegs);
				n = numNegs;
			}

			for (int i = 0; i < int(newNegIndex.size()); i++) 
			{
				nonfacePatches[i] = dataBase.NonFaceDB[newNegIndex[i]];
			};

		}
		else 
		{
			n = 0;
		}

		//add noface images from nofaceImages
		if (n < numNegs) 
		{

			dataBase.NonFaceDB.clear();
			negIndex.clear();

			vector<int> samIndex;
			double sum = 0;
			for (int i = 0; i < int(dataBase.numGridFace.size()); i++) 
			{
				if (dataBase.numGridFace[i] > 0) {
					samIndex.push_back(i);
				}
				sum += dataBase.numGridFace[i];
			}

			IndexSort(samIndex, dataBase.numGridFace, -1);
//.........这里部分代码省略.........
开发者ID:AAAyag,项目名称:OpenNPD,代码行数:101,代码来源:BootstrapNonfaces.cpp


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