Specifications

sharpVISION™ Camera
sharpVISION SDK Reference
12
2.5. Synchronous Streaming Data Grab
To grab an image from steaming data, you need to allocate an image buffer of sufficient size,
fill out a SV_FRAME structure, then call a grab function. Here is an example of a simple,
synchronous frame grab:
SV_FRAME frame;
unsigned long nSizeInBytes;
// Image size depends on the current ROI & image format.
SvGetCameraInfo( hCamera, SVI_IMG_SIZE, &nSizeInBytes );
// Fill out fields in SV_FRAME structure.
frame.pBuffer = malloc(nSizeInBytes*sizeof(BYTE));
frame.bufferSize = nSizeInBytes;
// Do synchronous image grab with a 5 sec time out
SvGrabOneFrame( hCamera, &frame );
// Process the data
...
// free the buffer
free(frame.pBuffer);
Most applications will use the asynchronous grab function. The asynchronous function is
required for capturing images at full speed; it also provides the ability to abort image capture.
The asynchronous function is covered below.