[C++]HOG+SVMランダムに負のサンプルを切り取る
1262 ワード
#include
#include
#include //srand() rand()
#include //time()
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
int CropImageCount = 0; //
int main()
{
Mat src;
string ImgName;
char saveName[256];//
ifstream fin("C:/Users/chenfeng/Documents/Visual Studio 2013/Projects/ConsoleApplication1/ConsoleApplication1/negatives/infofile.txt");//
//ifstream fin("subset.txt");
//
while (getline(fin, ImgName))
{
cout << " :" << ImgName << endl;
//ImgName = "D:\\DataSet\\INRIAPerson\\INRIAPerson\\Train\
eg\\" + ImgName;
src = imread(ImgName);//
//cout<= 64 && src.rows >= 128)
{
srand(time(NULL));//
// 10 64*128
for (int i = 0; i<10; i++)
{
int x = (rand() % (src.cols - 64)); // x
int y = (rand() % (src.rows - 128)); // y
//cout<