?? minigrabsamplemfc.cpp
字號:
//-----------------------------------------------------------------------------
// (c) 2002 by Basler Vision Technologies
// Section: Vision Components
// Project: BCAM
// $Header: MiniGrabSampleMfc.cpp, 2, 17.09.2002 17:06:20, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
\file MiniGrabSampleMfc.cpp
\brief Defines the entry point for the console application.
*/
#include "stdafx.h"
#include "MiniGrabSampleMfc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else if (CBcam::DeviceNames().size() == 0)
{
cerr << _T("No camera present!") << endl;
nRetCode = 2;
}
else
{
// Get the devicename of the first camera
CString DeviceName = *(CBcam::DeviceNames().begin());
// Create the driver object and open the driver
CBcam Bcam;
Bcam.Open(DeviceName);
// Setting VideoFormat=0, VideoMode=5 yields 640 x 480, Mono8
Bcam.SetVideoMode(DCS_Format0, DCS_Mode5, DCS_15fps);
// Create image buffer
const int ImageSize = 640 * 480;
char *pBuffer = new char[ImageSize];
// Allocate Resources (MaxBuffers, MaxBufferSize)
Bcam.AllocateResources(1, ImageSize);
// Grab the image
Bcam.GrabImage(pBuffer, ImageSize, 3000 ); // timeout 3 sec.
// image processing...
// clean up
delete[] pBuffer;
}
return nRetCode;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -