OpenCV人检测样本崩溃

时间:2011-09-07 17:51:43

标签: c++ opencv crash msvcr90.dll

编译peopledetect.cpp很顺利,但是当我尝试运行该程序时,它在行崩溃

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

错误讯息: openCV.exe中0x74a9ae7a处的未处理异常:0xC0000005:访问冲突写入位置0x00000000。

调用堆栈:

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()    

在网上潜伏之后,我找不到任何帮助,感谢任何帮助。

1 个答案:

答案 0 :(得分:2)

它在OS X下运行。有些东西试图访问空指针。尝试替换

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

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

查看getDefaultPeopleDetectorhog.setSVMDetector中是否发生错误。这可能有助于缩小问题范围。