Ask Your Question

Chauncey's profile - activity

2015-03-19 04:22:16 -0600 received badge  Student (source)
2015-03-19 02:08:27 -0600 commented question Opencv 3.0 HOGDescriptor , the “compute” function runtime error when using Release Mode in vs 2008

Sorry, COLOR_RGB2GRAY should be IMREAD_GRAYSCALE, but the error is still there!

2015-03-18 08:03:12 -0600 received badge  Editor (source)
2015-03-18 07:34:56 -0600 asked a question Opencv 3.0 HOGDescriptor , the “compute” function runtime error when using Release Mode in vs 2008

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,IMREAD_GRAYSCALE);
    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 who knows this problems? Thank you for your help!