随机生成特征和生成指定特征:
void GenerateFeature(vector< vector<int>> &featureList)
{
vector<int> feature;
int x, y, w, h;
for (w = 4; w <= 16; w = w + 4) //[4, 8, 12, 16]
{
for (h = 3; h <= 12; h = h + 3) //[3, 6, 9, 12]
{
for (x = 1; x <= imgWidth - w; x = x + 3) //[1, 4, 7, 10, 13, 16]
{
for (y = 1; y <= imgHeight - h; y = y + 5) //[1, 6, 11, 16, 21]
{
feature.clear();
feature.push_back(x);
feature.push_back(y);
feature.push_back(w);
feature.push_back(h);
featureList.push_back(feature);
}
}
}
}
cout << "featureList.size()=" << featureList.size() << endl;
//cout << featureList[1][0] << "*" << featureList[1][1] << "*" << featureList[1][2] << "*" << featureList[1][3] << endl;
//cout << featureList[5][0] << "*" << featureList[5][1] << "*" << featureList[5][2] << "*" << featureList[5][3] << endl;
//cout << featureList[11][0] << "*" << featureList[11][1] << "*