OPENCV2.3版本中模板函数peopledetect.cpp文件调用HOGDescriptor函数问题

xq6084765 2012-03-22 09:03:59
程序源代码如下:
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"

#include <stdio.h>
#include <string.h>
#include <ctype.h>

using namespace cv;
using namespace std;
void help()
{
printf(
"\nDemonstrate the use of the HoG descriptor using\n"
" HOGDescriptor::hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());\n"
"Usage:\n"
"./peopledetect (<image_filename> | <image_list>.txt)\n\n");
}

int main(int argc, char** argv)
{
Mat img;
FILE* f = 0;
char _filename[1024];

if( argc == 1 )
{
printf("Usage: peopledetect (<image_filename> | <image_list>.txt)\n");
return -1;
}
img = imread(argv[1]);

if( img.data )
{
strcpy(_filename, argv[1]);
}
else
{
f = fopen(argv[1], "rt");
if(!f)
{
fprintf( stderr, "ERROR: the specified file could not be loaded\n");
return 0;
}
}

HOGDescriptor *hog=new HOGDescriptor();
hog->setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
namedWindow("people detector", 1);

for(;;)
{
char* filename = _filename;
if(f)
{
if(!fgets(filename, (int)sizeof(_filename)-2, f))
break;
//while(*filename && isspace(*filename))
// ++filename;
if(filename[0] == '#')
continue;
int l = strlen(filename);
while(l > 0 && isspace(filename[l-1]))
--l;
filename[l] = '\0';
img = imread(filename);
}
printf("%s:\n", filename);
if(!img.data)
continue;

fflush(stdout);
vector<Rect> found, found_filtered;
double t = (double)getTickCount();
// run the detector with default parameters. to get a higher hit-rate
// (and more false alarms, respectively), decrease the hitThreshold and
// groupThreshold (set groupThreshold to 0 to turn off the grouping completely).
hog->detectMultiScale(img, found, 0, Size(8,8), Size(32,32), 1.05, 2);
t = (double)getTickCount() - t;
printf("tdetection time = %gms\n", t*1000./cv::getTickFrequency());
size_t i, j;
for( i = 0; i < found.size(); i++ )
{
Rect r = found[i];
for( j = 0; j < found.size(); j++ )
if( j != i && (r & found[j]) == r)
break;
if( j == found.size() )
found_filtered.push_back(r);
}
for( i = 0; i < found_filtered.size(); i++ )
{
Rect r = found_filtered[i];
// the HOG detector returns slightly larger rectangles than the real objects.
// so we slightly shrink the rectangles to get a nicer output.
r.x += cvRound(r.width*0.1);
r.width = cvRound(r.width*0.8);
r.y += cvRound(r.height*0.07);
r.height = cvRound(r.height*0.8);
rectangle(img, r.tl(), r.br(), cv::Scalar(0,255,0), 3);
}
imshow("people detector", img);
int c = waitKey(0) & 255;
if( c == 'q' || c == 'Q' || !f)
break;
}
if(f)
fclose(f);

delete(hog);
return 0;
}
加入的库函数如下:
opencv_highgui230d.lib
opencv_imgproc230d.lib
opencv_objdetect230d.lib
opencv_core230d.lib
opencv_features2d230d.lib

当注释掉HOGDescriptor函数程序能正常运行,调用该函数运行结果出问题,无法进入单步调试。报错如下:

'arm_detect.exe': Loaded 'E:\xqdevc++\arm_detect\Debug\arm_detect.exe', Symbols loaded.
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'E:\Program Files\OpenCV2.3\build\x86\vc10\bin\opencv_highgui230d.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\opencv_core230d.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Symbols loaded.
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\avifil32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\msacm32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\msvfw32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\shell32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\avicap32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\version.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'E:\Program Files\OpenCV2.3\build\x86\vc10\bin\opencv_objdetect230d.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'E:\Program Files\OpenCV2.3\build\x86\vc10\bin\opencv_imgproc230d.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'E:\Program Files\OpenCV2.3\build\x86\vc10\bin\tbb_debug.dll', Cannot find or open the PDB file
'arm_detect.exe': Loaded 'E:\Program Files\OpenCV2.3\build\x86\vc10\bin\opencv_features2d230d.dll', Cannot find or open the PDB file
SXS: RtlCreateActivationContext() failed 0xc000000d
LDR: LdrpWalkImportDescriptor() failed to probe E:\Program Files\OpenCV2.3\build\x86\vc10\bin\opencv_features2d230d.dll for its manifest, ntstatus 0xc000000d
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\lpk.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\comctl32.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll', Symbols loaded (source information stripped).
'arm_detect.exe': Unloaded 'C:\WINDOWS\system32\apphelp.dll'
The thread 'Win32 Thread' (0xdf8) has exited with code 0 (0x0).
Debugger:: An unhandled non-continuable exception was thrown during process load
The program '[3788] arm_detect.exe: Native' has exited with code -1073741811 (0xc000000d).
弹出一个窗口如下:
应用程序正常初始化(0xc000000d)失败。请单击“确定”,终止应用程序。

不知道是怎么回事,怀疑是加载opencv_features2d230d.dll文件出问题,请问该怎么解决呢。
...全文
836 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liqiinhit 2013-03-22
  • 打赏
  • 举报
回复
楼上的哥们,太谢谢了,真tmd是这么回事。破vs2010!!!
tianxiadys 2012-07-22
  • 打赏
  • 举报
回复
vs2010与生成的程序不得在同一个逻辑磁盘,这是BUG!
刚刚我尝试把程序挪到f盘,问题解决了。
tianxiadys 2012-07-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]
另一个安装在e:(当然,我并不觉得这有什么问题。。)
[/Quote]

这句话我收回
tianxiadys 2012-07-22
  • 打赏
  • 举报
回复
挖坟不判死刑吧?
这个问题我也遇到了!
而且我有新的线索。。我有两台电脑,

其中一个vs安装在c:
AMD 4000+
英伟达显卡(额~~我只是随便写一写)

另一个安装在e:(当然,我并不觉得这有什么问题。。)
intel 赛扬T3500
ATI显卡

然后同一份源码,在AMD下编译有效,intel下编译也有效,但是运行出现问题!
下面是输出窗口中的内容
“Test.exe”: 已加载“E:\Test\Debug\Test.dll”,已加载符号。
SXS: RtlCreateActivationContext() failed 0xc000000d
LDR: LdrpWalkImportDescriptor() failed to probe e:\Test\Debug\Test.dll for its manifest, ntstatus 0xc000000d
“Test.exe”: 已卸载“E:\Test\Debug\Test.dll”
Test.exe 中的 0x7c812afb 处最可能的异常: 0xC06D007E: Module not found
Test.exe 中的 0x7c812afb 处有未经处理的异常: 0xC06D007E: Module not found

PS:Test.dll应用了VC的延迟加载技术
wsc36305 2012-04-26
  • 打赏
  • 举报
回复
我也遇到了,还不知道为什么

65,192

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧