I'm using Opencv 3.0+ Vs2008, (win*86 PC).I want to use HOGDescriptor in opencv to do some research, but the code throws exception in Release mode in VS2008. At the same time the code runs well in Deubug mode .Here is my code:
#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include<string>
#include<iostream>
#include<vector>
using namespace std;
using namespace cv;
int main()
{
string imagePath="E:/test/3.jpg";
Mat img=imread(imagePath,COLOR_RGB2GRAY);
if (img.empty())
{
cout<<"Can't read image,please check!"<<endl;
return -1;
}
HOGDescriptor hog;
vector< Point > location;
vector< float > descriptors;
hog.compute( img, descriptors, Size( 8, 8 ), Size( 0, 0 ), location );
return 0;
}
I debug the code step by step, I doubt Opencv source codes have bugs. I find that in "hog.cpp" in line 586 throw exceptions, here is the code : ......
for (; i <= blockSize.height - 4; i += 4)
{
__m128 t = _mm_sub_ps(_mm_cvtepi32_ps(idx), _bh);
t = _mm_mul_ps(t, t);
idx = _mm_add_epi32(idx, ifour);
_mm_storeu_ps(_di + i, t);
}
the code "i <= blockSize.height - 4" runtime error. I think my Code Project' property is right, in term : "c/c++"--code generation, runtime library is "Multi-threaded DLL (/MD)" in release mode . Is there anybody knowing this problems? Thank you for your help!