编译 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()
在互联网上潜伏之后,我找不到任何东西,感谢任何帮助。
最佳答案
它在 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);
查看错误是否发生在 getDefaultPeopleDetector
或 hog.setSVMDetector
中。这可能有助于缩小问题范围。
关于c++ - OpenCV 人物检测样本崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7338284/