我正在使用HOG描述符进行特征提取。我正在使用visual studio 2012和opencv 2.4.9版本。我在hog.compute函数中遇到运行时错误。
int main()
{
Mat img_raw = imread("p1.jpg", 1); // load as color image.
Mat img;
cvtColor(img_raw, img, CV_RGB2GRAY);
HOGDescriptor hog;
vector<float> descriptor;
vector<Point>locations;
hog.compute(img, descriptor,Size(32,32),Size(0,0),locations);
cout << "HOG descriptor size is " << hog.getDescriptorSize() << endl;
cout << "img dimensions: " << img.cols << " width x " << img.rows << "height" << endl;
cout << "Found " << descriptor.size() << " descriptor values" << endl;
cout << "Nr of locations specified : " << locations.size() << endl;
return 0;
}