Hi, I have an issue with the HOGDescriptor.
I use the
hog.setSVMDetector(detectorVector);
command to assign a trained vector to HOG.
afterwards I use the
hog.detectMultiScale(...);
function to detect people in an image.
but after applying the detectMultiScale() function to a sequence and
trying to start over again for a new sequence the program gives an assertion failure.
It looks like that when the HOGDescriptor deconstructor is called the error is produced.
I get the following error in file dbgheap.c.
Expression: _CtrIsValidHeapPointer(pUserData)
By the way, when I do not apply the detectMultiScale() function the error is gone.
What may be causing the problem and how can it be fixed?
I have a class named "Detectors" with a field:
HOGDescriptor hog;
my code for initializing hog is:
is:
void Detectors::readHOG(string trainedData, string filename)
{
hog.winSize = Size(48,96);
Size(48,96);
if (filename=="")
filename = trainedData + "\\ConfigFiles\\HOG_Data.dat";
else
filename = trainedData + filename;
ifstream HOG_inputFile(filename, ios::in);
int i=0;
while (!HOG_inputFile.eof())
{
float input;
HOG_inputFile >> input;
hog.svmDetector.push_back(input);
i++;
}
hog.svmDetector.pop_back();
HOG_inputFile.close();
}
}
my code for detection is:
void Detectors::detectionFunction(Mat current, int detType, bool calcWeights, bool showImg, vector<double> &hogParams)
{
Mat img;
img = current.clone();
currentFrame = img.clone();
clearPrevious(false,
img); img);
if (detType == 0) // HOG type
{
if (showImg)
namedWindow("people detector",
1); 1);
{
double t =
(double)getTickCount(); (double)getTickCount();
hog.detectMultiScale(img, found, found_weights, hogParams[10], Size(4,4), Size(32,32), hogParams[8], hogParams[11]);
...
}
}
}}
the detectionFunction() is called in a loop for each frame read from the disk.
after all the frames have been processed and when the program wants to finish this error is fired.