IC Imaging Control C++

FrameSnapSink::create Method

FrameSnapSink::create Method

Creates a new FrameSnapSink.
Syntax:
static tFrameSnapSinkPtr   create( size_t bufferCountToAllocateAfterConnect = 0 );
static tFrameSnapSinkPtr   create( const FrameTypeInfo& type, size_t bufferCountToAllocateAfterConnect = 0 );
static tFrameSnapSinkPtr   create( const FrameTypeInfoArray& acceptedFrameTypes, size_t bufferCountToAllocateAfterConnect = 0 );

Parameter Description
bufferCountToAllocateAfterConnect

Specifies the count of buffers to pre-allocate, when this sink gets connected in a Grabber object.

type

Specifies the FrameTypeInfo of the sink itself.

acceptedFrameTypes

Specifies a list of acceptable frame types for the sink.

Return Value:

A pointer to the new FrameSnapSink, or NULL,if an error occurred.

Examples:

This is a simple example on how to create and use a FrameSnapSink to snap a single image and save it to a file.

// Create a FrameSnapSink, specify buffer type as RGB32, pre-allocate one buffer on connect
auto pSink = FrameSnapSink::create( MEDIASUBTYPE_RGB32, 1 );
// Use the sink and start grabber
grabber.setSinkType( pSink );
grabber.startLive();
// Snap 1 image with 3 second timeout
auto pBuffer = pSink->snapSingle( 3000 );
// Save image
saveToFileBMP( *pBuffer, "test.bmp" );

See also: FrameSnapSink, tFrameSnapSinkPtr, FrameTypeInfo, FrameTypeInfoArray

<< FrameSnapSink

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us