📄 minigrabsample.cpp
字号:
//-----------------------------------------------------------------------------
// (c) 2002 by Basler Vision Technologies
// Section: Vision Components
// Project: BCAM
// $Header: MiniGrabSample.cpp, 2, 17.09.2002 17:33:04, Nebelung, H.$
//-----------------------------------------------------------------------------
/**
\file MiniGrabSample.cpp
\brief grab a single image using Bcam-API calls
*/
#include "stdafx.h"
int main(int argc, char* argv[])
{
if (CBcam::DeviceNames().size() == 0)
{
cerr << "No camera present!" << endl;
return 1;
}
// 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 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -