#include "stdafx.h"
#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include "cvcam.h"
void callbackStereo(IplImage* image1,IplImage* image2)
{
// Do your Image Processing Code here.
}
int _tmain(int argc, _TCHAR* argv[])
{
int cvCamOne,cvCamTwo;
int height=240;
int width=320;
cvNamedWindow("Camera 1",1);
cvNamedWindow("Camera 2",1);
HWND hwnd1 = (HWND)cvGetWindowHandle("Camera 1");
HWND hwnd2 = (HWND)cvGetWindowHandle("Camera 2");
int numCams = cvcamGetCamerasCount();
cvcamSetProperty(1,CVCAM_PROP_WINDOW,&hwnd2);
cvcamSetProperty(1,CVCAM_STEREO_CALLBACK,callbackStereo);
cvcamSetProperty(1,CVCAM_RNDWIDTH,&width);
cvcamSetProperty(1,CVCAM_RNDHEIGHT,&height);
cvcamInit();
cvcamStart();
cvWaitKey(0);
cvcamStop();
cvcamExit();
return 0;
}
- void CallBack(IplImage* frame)
- {
-
- }
- BOOL xxxxxxxDlg::OnInitDialog()
- {
-
-
- int nSelected = cvcamGetCamerasCount();
- if(nSelected)
- {
- CRect camRect;
- int height,width;
- GetDlgItem(IDC_OPENCV_CAM)->GetWindowRect(&camRect);
- width=camRect.Width();
- height=camRect.Height();
- cvcamSetProperty(0, CVCAM_PROP_ENABLE, CVCAMTRUE);
- cvcamSetProperty(0, CVCAM_PROP_RENDER, CVCAMTRUE);
- cvcamSetProperty(0, CVCAM_PROP_WINDOW, &GetDlgItem(IDC_OPENCV_CAM)->m_hWnd);
- cvcamSetProperty(0, CVCAM_RNDWIDTH, &width);
- cvcamSetProperty(0, CVCAM_RNDHEIGHT, &height);
- cvcamSetProperty(0, CVCAM_PROP_CALLBACK, CallBack);
- cvcamInit();
- cvcamStart();
- }
- else
- {
- MessageBox(L"No Cam...");
-
- }
- return TRUE;
- }
void CallBack(IplImage* frame)
{
// 알아서 영상 처리~
}
BOOL xxxxxxxDlg::OnInitDialog()
{
// 생략
// TODO :
int nSelected = cvcamGetCamerasCount();
if(nSelected)
{
CRect camRect;
int height,width;
GetDlgItem(IDC_OPENCV_CAM)->GetWindowRect(&camRect);
width=camRect.Width();
height=camRect.Height();
cvcamSetProperty(0, CVCAM_PROP_ENABLE, CVCAMTRUE);
cvcamSetProperty(0, CVCAM_PROP_RENDER, CVCAMTRUE);
cvcamSetProperty(0, CVCAM_PROP_WINDOW, &GetDlgItem(IDC_OPENCV_CAM)->m_hWnd);
cvcamSetProperty(0, CVCAM_RNDWIDTH, &width);
cvcamSetProperty(0, CVCAM_RNDHEIGHT, &height);
cvcamSetProperty(0, CVCAM_PROP_CALLBACK, CallBack);
cvcamInit();
cvcamStart();
}
else
{
MessageBox(L"No Cam...");
//CDialog::DestroyWindow();
}
return TRUE;
}