OpenCV people detection sample crashes

2.2k Views Asked by At

Compiling peopledetect.cpp goes just fine, but when I try to run the program, it crashes at the line

hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());

The error message: Unhandled exception at 0x74a9ae7a in openCV.exe: 0xC0000005: Access violation writing location 0x00000000.

Call stack:

msvcr90.dll!74a9ae7a()  
opencv_objdetect231.dll!6dbfe397()  
openCV.exe!main()  Line 27 + 0x49 bytes
openCV.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes
openCV.exe!mainCRTStartup()  Line 371
kernel32.dll!74f63677()     
ntdll.dll!77319d72()    
ntdll.dll!77319d45()    

After lurking around on the internet, I couldn't find anything, any help appreciated.

1

There are 1 best solutions below

1
On

It works here under OS X. Something is trying to access a null pointer. Try replacing

hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());

with

static vector<float> detector = HOGDescriptor::getDefaultPeopleDetector();
if (!detector.size()) {
    fprintf(stderr, "ERROR: getDefaultPeopleDetector returned NULL\n");
    return -1;      
}
hog.setSVMDetector(detector);

to see whether the error is occurring in getDefaultPeopleDetector or hog.setSVMDetector. That might help narrow down the issue.