Instruction manual

Chapter 6. Samples
6.1. Programming example
This small programming example shows how to use the basic API functions to setup the grabber
hardware for getting a snap shot from the camera into memory.
The import library eleye716.lib (compiler dependent) has to be specified in your development tool.
#include "elpceye7.h"
#define IMAGE_WIDTH 560
#define IMAGE_HEIGHT 480
int main(int argc, char* argv[])
{
long Err, nRet = 0;
long wBoardID;
long wBufID;
void ** ppVideoMemory;
// open the grabber
wBoardID = el_OpenHW(0, 1);
if( wBoardID < 0)
{
printf( "Errorcode:%d\n", el_GetErrorCode() );
return false;
}
// initialize with default values
nRet = el_InitContext(wBoardID, NULL);
if( nRet != 0)
{
printf( "Errorcode:%d\n", el_GetErrorCode() );
return false;
}
wBufID = 0;
// initialize HW and allocate memory for the image
ppVideoMemory = el_InitHW(wBoardID, NULL, IMAGE_WIDTH, IMAGE_HEIGHT, 1, 0,
&wBufID);
if ( !ppVideoMemory )
{
printf( "Errorcode:%d\n", el_GetErrorCode() );
return false;
}
.
.
. setup the display
.
.
// aquire one snap shot
nRet = el_Acquire(wBoardID, EL_SNAP);
if( nRet != 0)
{
printf( "Errorcode:%d\n", el_GetErrorCode() );
return false;
88