本文整理汇总了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);
//.........这里部分代码省略.........