void getHoG(Mat img, CvMat ** _feat, Size winSize, Size blockSize, Size cellSize, Size blockStride) { int i = 0; CvMat * feat = NULL; HOGDescriptor des; vector <float> descriptor; vector <Point> loc; int patchnum = 0; loc.push_back(Point(0,0)); des.winSize = winSize; des.blockSize = blockSize; des.cellSize = cellSize; des.blockStride = blockStride; des.gammaCorrection = true; des.nbins = 9; des.compute(img, descriptor, des.blockStride, Size(8,8), loc); int dim = descriptor.size(); feat = cvCreateMat(1, dim, CV_32FC1); for (i = 0; i < dim; i++) { CV_MAT_ELEM(*feat, float, 0, i) = descriptor[i]; } *_feat = feat; }