I have this function that crashes on exit and I cant seem to figure out why. I hope it isn't a problem with the opencv or visual studio version because I have many other code in the program and it runs fine. The only problem is in this function.
void compute_hog(const vector< cv::Mat > & img_lst, vector< cv::Mat > & gradient_lst, const cv::Size & size)
{
cv::HOGDescriptor hog;
hog.winSize = size;
cv::Mat gray;
vector< cv::Point > location;
vector< float > descriptors;
vector< cv::Mat >::const_iterator img = img_lst.begin();
vector< cv::Mat >::const_iterator end = img_lst.end();
//for (; img != end; ++img)
//{
cv::cvtColor(*img, gray, cv::COLOR_BGR2GRAY);
hog.compute(gray, descriptors, cv::Size(8, 8), cv::Size(0, 0), location);
gradient_lst.push_back(cv::Mat(descriptors).clone());
//get_hogdescriptor_visu(img->clone(), descriptors, size);
//#ifdef _DEBUG
//cv::imshow("gradient", get_hogdescriptor_visu(img_lst[0], descriptors, size));
//cv::waitKey(1);
//cv::destroyAllWindows();
//#endif
//}
}