環境はウィンドウズ10(64bit)、visual C++2010、OpenCV2.4.9です。
画像処理について取得した画像の前後を差分した映像を取得するプログラムを組んでいます。
参考書を見ながらやっているのですが
”test1.exe の 0x768a3e28 でハンドルされていない例外が発生しました: Microsoft C++ の例外: cv::Exception (メモリの場所 0x0034faa0)。”
という表示がでます。
また、visualstudioの出力に
'test1.exe': 'C:\Windows\SysWOW64\ntdll.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\kernel32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\KernelBase.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\opencv\build\x86\vc10\bin\opencv_core249d.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msvcr100d.dll' を読み込みました。シンボルが読み込まれました。
'test1.exe': 'C:\opencv\build\x86\vc10\bin\opencv_highgui249d.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\user32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\gdi32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msvcp100d.dll' を読み込みました。シンボルが読み込まれました。
'test1.exe': 'C:\Windows\SysWOW64\ole32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\combase.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msvcrt.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\rpcrt4.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\sspicli.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\cryptbase.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\bcryptprimitives.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\sechost.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\oleaut32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\advapi32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\avifil32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msvfw32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.10240.16384_none_49c02355cf03478c\comctl32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\shell32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msacm32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\avicap32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\windows.storage.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\shlwapi.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\winmm.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\kernel.appcore.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\winmmbase.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\SHCore.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\cfgmgr32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\powrprof.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\profapi.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\devobj.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\imm32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msctf.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\uxtheme.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\clbcatq.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\devenum.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\setupapi.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\ntmarta.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\wintrust.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msasn1.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\crypt32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msdmo.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\qcap.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\version.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\quartz.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\dwmapi.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\ksproxy.ax' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\d3d9.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\ksuser.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\policymanager.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\msvcp110_win.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\xmllite.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\vidcap.ax' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\Kswdmcap.ax' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\mfc42.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\odbc32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\dpapi.dll' を読み込みました。Cannot find or open the PDB file
スレッド 'Win32 スレッド' (0x10fc) はコード 0 (0x0) で終了しました。
'test1.exe': 'C:\Windows\SysWOW64\qedit.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\comdlg32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.10240.16384_none_d15682eeaf714889\GdiPlus.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\ddraw.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\dciman32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\igdumdim32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\igc32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\d3dim700.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\igc32.dll' をアンロード
'test1.exe': 'C:\Windows\SysWOW64\igdumdim32.dll' をアンロード
'test1.exe': 'C:\Windows\SysWOW64\igdumdim32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\igc32.dll' を読み込みました。Cannot find or open the PDB file
'test1.exe': 'C:\Windows\SysWOW64\igc32.dll' をアンロード
'test1.exe': 'C:\Windows\SysWOW64\igdumdim32.dll' をアンロード
'test1.exe': 'C:\Windows\SysWOW64\msyuv.dll' を読み込みました。Cannot find or open the PDB file
test1.exe の 0x768a3e28 で初回の例外が発生しました: Microsoft C++ の例外: cv::Exception (メモリの場所 0x0034faa0)。
test1.exe の 0x768a3e28 でハンドルされていない例外が発生しました: Microsoft C++ の例外: cv::Exception (メモリの場所 0x0034faa0)。
と表示されました。
いろいろ調べてみたのですが、わからないので恥ずかしながらも掲示板で聞くことにしました。
参考書のコードは以下の通りです。
是非ともご指導お願いします。
#include <windows.h>
#include <stdio.h>
#include <opencv2/opencv.hpp> // OpenCVヘッダ
#pragma comment(lib,"opencv_imgproc249d.lib") // OpenCVライブラリ
#pragma comment(lib,"opencv_core249d.lib") // OpenCVライブラリ
#pragma comment(lib,"opencv_highgui249d.lib") // OpenCVライブラリ
CvCapture* getInfo(const char* input,
int* width, int* height, int* frameRate,
int* encode, int* numOfFrames)
{
CvCapture* capture=NULL;
if(stricmp("camera", input)==0) // 引数の数をチェック
{
capture=cvCaptureFromCAM(0); // 映像取得(カメラ映像)
*frameRate=30;
*numOfFrames=-1;
*encode=CV_FOURCC('M','J','P','G');
}
else
{
capture=cvCaptureFromAVI(input); // 映像取得(aviファイル)
*frameRate=(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
*numOfFrames=(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT);
*encode=(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FOURCC);
}
*width=(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH);
*height=(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT);
printf("入力 = %s\n", input);
printf("動画サイズ = %d x %d\n", *width, *height);
printf("フレームレート = %d / sec.\n", *frameRate);
printf("フレーム数 = %d\n", *numOfFrames);
return capture;
}
//--------------------------------------------------------------------------
//main
int
main(int argc,char* argv[])
{
CvCapture* capture=NULL;
IplImage *srcOld=NULL, *srcCur=NULL, *dst=NULL;
CvVideoWriter* rec=NULL;
char input[256]="camera";
int width, height, frameRate, encode, numOfFrames;
int wait=1;
if(argc>1)
strcpy(input, argv[1]); //引数無しならカメラ
capture=getInfo(input, &width, &height,
&frameRate, &encode, &numOfFrames);
if(capture==NULL)
{ // 映像を取得できない場合
fprintf(stderr, "映像源が見つかりません.\n");
return -1;
}
if(argc>2)
rec=cvCreateVideoWriter(argv[2], // ビデオファイル書き込みの設定
encode, frameRate,
cvSize(width, height));
else
if((wait=1000/frameRate)<1 ||
stricmp("camera", input)==0)
wait=1;
cvNamedWindow(input);
srcCur=cvQueryFrame(capture); // 取得
dst=cvCloneImage(srcCur);
while(1)
{
srcOld=cvCloneImage(srcCur);
if(srcOld==NULL)
break;
srcCur=cvQueryFrame(capture); // 取得
if(srcCur==NULL)
break;
cvSub(srcOld, srcCur, dst); // dst=old-current
cvShowImage(input, dst); // 表示
if(rec!=NULL)
cvWriteFrame(rec, dst); // フレーム書き込み
if(cvWaitKey(wait)>=0)
break; // キーを押したら終了
}
cvDestroyAllWindows();
cvReleaseCapture(&capture);
if(rec!=NULL)
cvReleaseVideoWriter(&rec);
return 0;
}