Some questions when using HogDescriptor in OpenCv3.0 under Visual studio 2012

I want to use HOGDescriptor of OpenCv3.0 under VS2012.And my codes is flows:

    cv::Mat  img=cv::imread("D:\\pictures\\1.bmp";



         cout<<"load pictures error"<<endl;




        count<<"the size of pictures is wrong"<<endl;




    vector<float> featureVec;


//fails,"Access error occurred while writing position 0 x00477218”

I examine the codes many times, and don't why.

Please help me. Thank you.


You are using incorrect types in your code.

As per documentation (Openc 3.0 docs) your featureVec has to be vector of Points. Not vector of floats.

Relevant part of docs:

virtual void cv::HOGDescriptor::detect  (   const Mat &     img,
        std::vector< Point > &      foundLocations,
        double      hitThreshold = 0,
        Size    winStride = Size(),
        Size    padding = Size(),
        const std::vector< Point > &    searchLocations = std::vector< Point >() 
    )       const

So in your code try following:

vector<cv::Point> featureVec;

It interesting that the code event compile, if the types don't match.

Try to run HoG.compute(img,featureVec) with default parameters, i.e. don't give window sizes when declaring your HOG variable. It sounds like a parameter is wrong ...

Detect is a different method, so the call is correct

Need Your Help

How to send out a http reponse

php apache httpresponse

I am a php newbie and I came across some problems when use php with apache.