VisionBox Interface Library  1.7.5.0 (2021-12-10)
VIB::CameraLinkIn Class Reference
+ Inheritance diagram for VIB::CameraLinkIn:

Detailed Description

This class represents the Camera Link grabber module.

One instance of this class controls one or two Camera Link input connectors which are physically combined on the same hardware. Depending on the hardware and firmware, Camera Link Base (single or dual port), Medium, Full and Deca configurations are supported. The function GetNumberOfInputs() can be used to determine which configurations are available.

Required steps for image acquisition

  • Initialization
    • First, the desired mode must be configured by calling ConfigureModule().
    • The function ConfigureCLInput() must then be called to specify the image size, the data format and additional options like ignoring the FVAL (frame valid) signal when using line scan cameras.
    • Next, image buffers have to be allocated by calling AllocateImageBuffer().
    • Allocated buffers can then be added to an acquisition queue with AddImageBufferForCapturing(). Ownership of the buffer is transferred to the library.
  • Acquisition loop
    • WaitForImageBuffer() is used to wait for completion of a frame. Ownership of the returned buffer is transferred to the user again.
    • After the user has finished processing the image data, the buffer can be transferred back to the acquisition queue again by calling AddImageBufferForCapturing().
  • Stopping image acquisition
    • AbortWaitingForDMA() can be used to abort all threads that are waiting for a new image.
    • AbortBufferUsage() forces the FPGA and library to stop using new buffers in the acquisition queue.
    • Then, the user has to call WaitForImageBuffer() to obtain the control over the buffers and release them with FreeImageBuffer().
    • The device has to be closed before it can be reconfigured again.

The grabber starts filling an image buffer with the beginning of the next camera frame (or line for line scan cameras), as long as buffers are available in the acquisition queue. Using multiple buffers helps to avoid dropped frames.

Multiple threads can call WaitForImageBuffer() in parallel to check for new images. This can help to enable image processing using multiple CPU cores.

+ Example code

This example demonstrates a simple use case for acquiring images from a camera.

The following assumptions are made:

  • A camera is connected on the first Camera Link connector
  • The camera is running in free-run mode
  • The camera delivers images with 8-bit Camera Link Base configuration and a resolution of at least VGA (640 × 480)
VIB::CameraLinkIn cameraLink;
void *pBuffer = NULL;
const unsigned short Width = 640;
const unsigned short Height = 480;
const unsigned int channel = 0;
const unsigned int buffers = 4;
bool isImgValid;
// Open the first CameraLinkIn device
cameraLink.Open(0);
// Select Camera Link Base configuration
// set the image size, the AOI and the byte order/format
cameraLink.ConfigureCLInput(
channel,
Width,
Height);
// allocate image buffers and add them to the acquisition queue
for (unsigned int i = 0; i < buffers; i++)
{
cameraLink.AllocateImageBuffer(channel, &pBuffer);
cameraLink.AddImageBufferForCapturing(channel, pBuffer);
}
// start capturing images
while (running)
{
// wait for a new image using a timeout of 1000 ms
cameraLink.WaitForImageBuffer(channel, 1000, &pBuffer, isImgValid);
if (pBuffer != NULL)
{
if (isImgValid)
{
// work with the buffer
ProcessImage(pBuffer);
}
else
{
printf("Frame is invalid\n");
}
// add the buffer into the acquisition queue again
cameraLink.AddImageBufferForCapturing(channel, pBuffer);
}
else
{
printf("Frame timeout\n");
}
}
// Abort image acquisition
cameraLink.AbortBufferUsage(channel);
// Get image buffers from library and release them
while (1)
{
cameraLink.WaitForImageBuffer(channel, 0, &pBuffer, isImgValid);
if (pBuffer == NULL)
break;
cameraLink.FreeImageBuffer(channel, pBuffer);
}

Please note that error checking was removed to keep the code as simple as possible.

Triggering Camera Link cameras

The Camera Link interface defines four output signals which are mainly used for triggering cameras, also known as CC-Lines. The state of every line can be individually configured with ConfigureCC(). The Multiplexer output signals are available as source for the CC line.

+ Example: generate a fixed frequency trigger signal

The internal TriggerGenerator is configured to generate a 10 Hz signal and then used as camera trigger on the CC1 line.

VIB::Multiplexer multiplexer;
VIB::CameraLinkIn cameraLink;
const unsigned int channel = 0;
// Open devices: Multiplexer, Trigger Unit and Camera Link
multiplexer.Open();
triggerUnit.Open();
cameraLink.Open();
// Configure the Camera Link device (required before ConfigureCC() can be used
// Trigger Unit: configure a signal generator to 10Hz and connect it to output 0 of the unit
triggerUnit.ConfigureSet("GenA_tLow=50ms GenA_tHigh=50ms TrigOut0_Mux=GenA");
// Multiplexer: connect multiplexer output 0 to the trigger unit
// Connect the CC1 line to the multiplexer output
cameraLink.ConfigureCC( channel
1, // CC-line index for CC1
VIB::CameraLinkIn::CL_IN_CC_SRC_MUX_OUT0, //source for the CC line
false ); // no inversion of the signal
// ...

Please note that error checking was removed to keep the code as simple as possible.

+ Example: derive trigger signal from an incremental encoder

The internal TriggerGenerator is configured to divide the encoder signal and then use it as camera trigger on the CC1 line.

VIB::Multiplexer multiplexer;
VIB::CameraLinkIn cameraLink;
const unsigned int channel = 0;
// Open devices: Multiplexer, Trigger Unit and Camera Link
multiplexer.Open();
triggerUnit.Open();
cameraLink.Open();
// Configure the Camera Link device (required before ConfigureCC() can be used
// Multiplexer: make encoder A/B available for the trigger unit
// Trigger Unit: use DividerA to reduce the frequency of the encoder signal by 10
triggerUnit.ConfigureSet("DividerA=10,TrigIn0/1_Both");
// Trigger Unit: connect divider output to output 0 of the unit
triggerUnit.ConfigureSet("MuxIntern0=DividerA TrigOut0_Mux=TrigIntern0");
// Multiplexer: connect multiplexer output 2 to the trigger unit
// Connect the CC1 line to the multiplexer output
cameraLink.ConfigureCC( channel
1, // CC-line index for CC1
VIB::CameraLinkIn::CL_IN_CC_SRC_MUX_OUT2, //source for the CC line
false ); // no inversion of the signal

Please note that error checking was removed to keep the code as simple as possible.

Using embedded image, trigger and timestamp counters

Three counters can be enabled in order to embed additional information at the beginning of each frame or each line for line scan cameras. The counters are controlled by the InFlags parameter for ConfigureCLInput():

The image counter can be used for detection of dropped camera frames or lines which are caused by insufficient acquisition buffers. With area scan cameras, the image counter increases with every frame received from the camera (FVAL signal). With line scan cameras (CL_IN_INMODE_FLAGS_IGNORE_FVAL is used), the counter increases with every line received from the camera (LVAL signal).

The CC1 trigger counter is used in triggered mode for detection of ignored trigger events, for example when the trigger signal on CC1 is arriving too fast for the camera.

If a counter is enabled, the original pixel data from the camera is overwritten by the corresponding counter value. The location of the counter values is fixed, see example below.

Note
When using line scan cameras (CL_IN_INMODE_FLAGS_IGNORE_FVAL), the counters are inserted into every line.
Depending on the processing pipeline delay of the camera, the inserted trigger counter can be inaccurate if the image data arrives later than the next trigger event. This is mainly an issue with line scan cameras.
+ Example code for reading embedded counters with area scan cameras

bool checkCounters = false;
unsigned short frameCounter[2];
unsigned short trgCounter[2];
unsigned int timestamp[2];
...
// enable all counters
cameraLink.ConfigureCLInput(
channel,
Width,
Height);
...
while (running)
{
bool isImgValid;
// wait for a new image using a timeout of 1000 ms
cameraLink.WaitForImageBuffer(channel, 1000, &pBuffer, isImgValid);
if (pBuffer != NULL)
{
if (isImgValid)
{
// read the counter values from the beginning of the image:
frameCounter[0] = ((unsigned short *)pBuffer)[0];
trgCounter[0] = ((unsigned short *)pBuffer)[1];
timestamp[0] = ((unsigned int *)pBuffer)[1];
if (checkCounters)
{
unsigned short counterDiff;
// check the received sensor frames
counterDiff = frameCounter[0] - frameCounter[1];
if (counterDiff != 1)
printf("%u camera frames dropped\n", counterDiff);
// check the trigger counter
counterDiff = trgCounter[0] - trgCounter[1];
if (counterDiff != 1)
printf("%u CC1 trigger events dropped\n", counterDiff);
printf("Frame period: %u us\n", timestamp[0] - timestamp[1]);
}
else
{
// delayed start of counter check
checkCounters = true;
}
// store values for the next cycle
frameCounter[1] = frameCounter[0];
trgCounter[1] = trgCounter[0];
timestamp[1] = timestamp[0];
}
else
{
printf("Frame is invalid\n");
}
// add the buffer into the acquisition queue again
cameraLink.AddImageBufferForCapturing(channel, pBuffer);
}
else
{
printf("Frame timeout\n");
}
}

Please note that no error checking is performed in the examples in order to simplify the code.

Serial Communication API

The Rs232 device can be used to enable communication with the connected camera through the Camera Link cable.

When using a Windows platform, the Serial Communications API defined by the Camera Link Specification can also be used. This allows access by third party configuration tools for different cameras.

The IMAGO SDK Installer configures the following registry values for finding the required DLL clserima.dll:

  • Windows 32 bit:
    HKEY_LOCAL_MACHINE\software\cameralink
    -> CLSERIALPATH (REG_SZ) = (Path to AGE-X SDK)\bin\clserima\x86
  • Windows 64 bit:
    HKEY_LOCAL_MACHINE\software\cameralink
    -> CLSERIALPATH (REG_SZ) = (Path to AGE-X SDK)\bin\clserima\x64
    HKEY_LOCAL_MACHINE\software\Wow6432Node\cameralink
    -> CLSERIALPATH (REG_SZ) = (Path to AGE-X SDK)\bin\clserima\x86

Hardware, library and firmware dependencies

+ Available features depend on the combination of hardware type, software library and FPGA version (click to expand the table):
Hardware Precondition Supported capabilities
Library Version FPGA Version Camera Link Deca Unused byte for 24 bit RGB
PCIe Camera Link Card 1.6.5.7 SYST_CL: 1.0.0.11 yes 0xff
1.6.4.0 SYST_CL: 1.0.0.6 no 0xff
VisionBox AGE-X2 1.6.0.0 SYST_BASEBOARD: 1.0.0.24
SYST_CL: 1.0.0.7
no 0xff
SYST_BASEBOARD: 1.0.0.24
SYST_CL: 1.0.0.2
random
VisionBox AGE-X5 1.6.8.0 SYST_BASEBOARD: 1.0.0.45
SYST_CL: 1.0.0.12
yes 0xff
VisionCam XM 1.6.4.0 SYST_BASEBOARD: 1.0.0.30 no 0xff

Please note that the VisionCam XM doesn't have a Camera Link connector, but uses Camera Link signaling internally for the sensor. This API is normally not invoked directly by the user, but by the FGCamera library.

Public Types

enum  CC_SOURCE
 The source signals for the Camera Link CC lines, used by ConfigureCC() More...
 
enum  INMODE_FLAGS
 Special or additional configuration modes, used by ConfigureCLInput() More...
 
enum  INMODE_TYPE
 The data organization on the Camera Link cable, used by ConfigureCLInput() More...
 
enum  MODULE_CONFIGURATION
 Type of Camera Link module configuration ConfigureModule() More...
 

Public Member Functions

bool AbortBufferUsage (const unsigned int ChannelIndex)
 Forces the driver to stop using image buffers. More...
 
bool AbortWaitingForDMA (const unsigned int ChannelIndex)
 Forces all waiting threads to return from the WaitForImageBuffer() function call. More...
 
bool AddImageBufferForCapturing (const unsigned int ChannelIndex, void *ptr)
 Adds an image buffer to the acquisition queue for capturing new camera frames. More...
 
bool AllocateImageBuffer (const unsigned int ChannelIndex, void **pptr)
 Allocates a image buffer for capturing. More...
 
 CameraLinkIn ()
 Default constructor for the device object More...
 
bool ConfigureCC (const unsigned int ChannelIndex, const unsigned int CCIndex, const VIB::CameraLinkIn::CC_SOURCE src, const bool Invert)
 Selects the source for the given CameraLink-CC line. More...
 
bool ConfigureCLInput (unsigned int ChannelIndex, VIB::CameraLinkIn::INMODE_TYPE InType, unsigned int InFlags, unsigned int AOI_Width, unsigned int AOI_Height, unsigned int AOI_X=0, unsigned int AOI_Y=0)
 Configures a camera channel. More...
 
bool ConfigureCLInput (unsigned int ChannelIndex, VIB::CameraLinkIn::INMODE_TYPE InType, unsigned int InFlags, unsigned short Width, unsigned short Height, unsigned short AOI_X, unsigned short AOI_Y, unsigned short AOI_Width, unsigned short AOI_Height)
 Configures a camera channel. More...
 
bool ConfigureModule (const VIB::CameraLinkIn::MODULE_CONFIGURATION ModuleConfig)
 Configures the module to the given mode. More...
 
bool FreeImageBuffer (const unsigned int ChannelIndex, void *ptr)
 Frees the specified buffer. More...
 
bool GetAOI (unsigned int ChannelIndex, unsigned int &AOI_X, unsigned int &AOI_Y, unsigned int &AOI_Width, unsigned int &AOI_Height)
 Returns the configured AOI size. More...
 
bool GetBitsPerPixel (unsigned int ChannelIndex, unsigned int &ValidBits, unsigned int &BufferBits)
 Returns the number of bits for each pixel. More...
 
bool GetBufferSize (unsigned int ChannelIndex, unsigned int &Bytes)
 Returns the number of bytes allocated for each image buffer. More...
 
bool GetNumberOfInputs (const VIB::CameraLinkIn::MODULE_CONFIGURATION ModuleConfig, unsigned int &NumberOfInputs)
 Returns the number of independent Camera Link input channels. More...
 
bool Reset ()
 Resets the device to default settings. More...
 
bool WaitForImageBuffer (const unsigned int ChannelIndex, const unsigned int msTimeOut, void **pPtr, bool &IsContentValid)
 Waits for completion of image buffers and transfers ownership to the user. More...
 
- Public Member Functions inherited from VIB::iDevice
bool Close ()
 Closes a device More...
 
 iDevice (const iDevice &device)
 The copy constructor makes a copy of the existing device object More...
 
bool isOpen (bool &state)
 Returns the open state of a device object More...
 
bool Open (unsigned int Index=0)
 Opens a device More...
 
iDeviceoperator= (const iDevice &device)
 The assignment operator makes a copy of the existing device object More...
 
virtual ~iDevice ()
 Deletes the device object More...
 

Member Enumeration Documentation

◆ CC_SOURCE

The source signals for the Camera Link CC lines, used by ConfigureCC()

Enumerator
CL_IN_CC_SRC_OFF 

static off

CL_IN_CC_SRC_ON 

static on

CL_IN_CC_SRC_MUX_OUT0 

Multiplexer Output 0.

CL_IN_CC_SRC_MUX_OUT1 

Multiplexer Output 1.

CL_IN_CC_SRC_MUX_OUT2 

Multiplexer Output 2.

CL_IN_CC_SRC_MUX_OUT3 

Multiplexer Output 3.

CL_IN_CC_SRC_MUX_OUT4 

Multiplexer Output 4.

CL_IN_CC_SRC_MUX_OUT5 

Multiplexer Output 5.

CL_IN_CC_SRC_MUX_OUT6 

Multiplexer Output 6.

CL_IN_CC_SRC_MUX_OUT7 

Multiplexer Output 7.

CL_IN_CC_SRC_MUX_OUT8 

Multiplexer Output 8.

CL_IN_CC_SRC_MUX_OUT9 

Multiplexer Output 9.

CL_IN_CC_SRC_MUX_OUT10 

Multiplexer Output 10.

CL_IN_CC_SRC_MUX_OUT11 

Multiplexer Output 11.

CL_IN_CC_SRC_MUX_OUT12 

Multiplexer Output 12.

CL_IN_CC_SRC_MUX_OUT13 

Multiplexer Output 13.

CL_IN_CC_SRC_MUX_OUT14 

Multiplexer Output 14.

CL_IN_CC_SRC_MUX_OUT15 

Multiplexer Output 15.

◆ INMODE_FLAGS

Special or additional configuration modes, used by ConfigureCLInput()

Enumerator
CL_IN_INMODE_FLAGS_DEFAULT 

Default value if no special behavior required.

CL_IN_INMODE_FLAGS_IGNORE_FVAL 

Use this value for linescan cameras.

CL_IN_INMODE_FLAGS_IGNORE_DVAL 

Ignore the Camera Link DVAL signal (data valid)

CL_IN_INMODE_FLAGS_INSERT_IMAGE_COUNTER 

Insert a 16 bit frame / line counter at the beginning of each frame / line.

CL_IN_INMODE_FLAGS_INSERT_CC1_COUNTER 

Insert a 16 bit CC1 trigger counter at the beginning of each frame / line.

CL_IN_INMODE_FLAGS_INSERT_TIMESTAMP 

Insert a 32 bit timestamp into the beginning of each frame / line (1 µs time base)

◆ INMODE_TYPE

The data organization on the Camera Link cable, used by ConfigureCLInput()

Enumerator
CL_IN_INMODE_TYPE_1TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over one Tap.

CL_IN_INMODE_TYPE_1TAP_10BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over one Tap.

CL_IN_INMODE_TYPE_1TAP_12BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over one Tap.

CL_IN_INMODE_TYPE_1TAP_14BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over one Tap.

CL_IN_INMODE_TYPE_1TAP_16BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over one Tap.

CL_IN_INMODE_TYPE_2TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over two Taps.

CL_IN_INMODE_TYPE_2TAP_10BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over two Taps.

CL_IN_INMODE_TYPE_2TAP_12BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over two Taps.

CL_IN_INMODE_TYPE_3TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over three Taps.

CL_IN_INMODE_TYPE_1TAP_24BIT_RGB 

The Image(Buffer) has the total size of 4 * AOI_Width * AOI_Height, one pixel is three bytes long (+ one unused byte), delivered over one Tap.

CL_IN_INMODE_TYPE_4TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over four Taps.

CL_IN_INMODE_TYPE_4TAP_10BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over four Taps.

CL_IN_INMODE_TYPE_4TAP_12BIT 

The Image(Buffer) has the total size of 2 * AOI_Width * AOI_Height, one pixel is two bytes long, delivered over four Taps.

CL_IN_INMODE_TYPE_6TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over six Taps.

CL_IN_INMODE_TYPE_1TAP_30BIT_RGB 

The Image(Buffer) has the total size of 8 * AOI_Width * AOI_Height, one pixel is six bytes long (+ one unused word), delivered over one Tap.

CL_IN_INMODE_TYPE_1TAP_36BIT_RGB 

The Image(Buffer) has the total size of 8 * AOI_Width * AOI_Height, one pixel is six bytes long (+ one unused word), delivered over one Tap.

CL_IN_INMODE_TYPE_2TAP_24BIT_RGB 

The Image(Buffer) has the total size of 4 * AOI_Width * AOI_Height, one pixel is three bytes long (+ one unused byte), delivered over two Taps.

CL_IN_INMODE_TYPE_8TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over eight Taps.

CL_IN_INMODE_TYPE_10TAP_8BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height, one pixel is one byte long, delivered over ten Taps.

CL_IN_INMODE_TYPE_8TAP_10BIT 

The Image(Buffer) has the total size of AOI_Width * AOI_Height * 10 / 8, eight bytes containing the MSBs for eight pixels are followed by two bytes conaining the remaining two LSBs for these pixels.

◆ MODULE_CONFIGURATION

Type of Camera Link module configuration ConfigureModule()

Enumerator
CL_IN_MODULECONFIG_BASE 

CL-Base input, one cable for one camera.

CL_IN_MODULECONFIG_MEDIUM 

CL-Medium input, two cables for one camera.

CL_IN_MODULECONFIG_FULL 

CL-Full input, two cables for one camera.

CL_IN_MODULECONFIG_DECA 

CL-Deca input, two cables for one camera.

Constructor & Destructor Documentation

◆ CameraLinkIn()

VIB::CameraLinkIn::CameraLinkIn ( )

Default constructor for the device object

The device must be opened with Open() before it can be used.

Member Function Documentation

◆ AbortBufferUsage()

bool VIB::CameraLinkIn::AbortBufferUsage ( const unsigned int  ChannelIndex)

Forces the driver to stop using image buffers.

After return of this function, the user can obtain ownership of the buffers by calling WaitForImageBuffer(). The buffers can then be freed by the user.

The grabber enters the reset state when calling this function. The unit has to be reinitialized again.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ AbortWaitingForDMA()

bool VIB::CameraLinkIn::AbortWaitingForDMA ( const unsigned int  ChannelIndex)

Forces all waiting threads to return from the WaitForImageBuffer() function call.

WaitForImageBuffer() calls normally return with an error, but they may also return with a buffer or a timeout depending on the timing.

New calls to WaitForImageBuffer() are not allowed until this function returns.

Image acquisition is not affected by this function, the library continues using the buffers in the aquisition queue until AbortBufferUsage() is called.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ AddImageBufferForCapturing()

bool VIB::CameraLinkIn::AddImageBufferForCapturing ( const unsigned int  ChannelIndex,
void *  ptr 
)

Adds an image buffer to the acquisition queue for capturing new camera frames.

After a buffer was added to the queue using this function it is controlled by the library. It’s not allowed to access or free this buffer until the buffer is delivered to the user by calling WaitForImageBuffer().

For area scan cameras, the grabber will fill available image buffers in the queue with valid camera frames. If no buffers are available, camera frames will get dropped.

For line scan cameras (see CL_IN_INMODE_FLAGS_IGNORE_FVAL), the grabber will accumulate valid camera lines into available buffers. If no buffers are available, camera lines will get dropped.

There is no rule in which sequence the added buffers are used.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
ptrPointer to a valid image buffer, allocated with AllocateImageBuffer()
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ AllocateImageBuffer()

bool VIB::CameraLinkIn::AllocateImageBuffer ( const unsigned int  ChannelIndex,
void **  pptr 
)

Allocates a image buffer for capturing.

The allocated buffer size can be obtained with GetBufferSize().

Note
It is not allowed to use a buffer with a channel which was allocated for a different channel.
Furthermore, the buffer must be released by FreeImageBuffer(), not by free() or delete().
Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
pptrPointer to the new image buffer
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ ConfigureCC()

bool VIB::CameraLinkIn::ConfigureCC ( const unsigned int  ChannelIndex,
const unsigned int  CCIndex,
const VIB::CameraLinkIn::CC_SOURCE  src,
const bool  Invert 
)

Selects the source for the given CameraLink-CC line.

See Triggering Camera Link cameras for example code.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
CCIndexIndex for the CC-Line [1...4]
srcThe desired source signal
InvertPolarity of the output signal
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ ConfigureCLInput() [1/2]

bool VIB::CameraLinkIn::ConfigureCLInput ( unsigned int  ChannelIndex,
VIB::CameraLinkIn::INMODE_TYPE  InType,
unsigned int  InFlags,
unsigned int  AOI_Width,
unsigned int  AOI_Height,
unsigned int  AOI_X = 0,
unsigned int  AOI_Y = 0 
)

Configures a camera channel.

To reconfigure the channel, after the first call, the complete device has to be closed and opened again.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
InTypeDefine the desired Pixel/Data or streaming format
InFlagsBitwise OR of configuration flags defined in INMODE_FLAGS
Use CL_IN_INMODE_FLAGS_DEFAULT for area scan cameras and CL_IN_INMODE_FLAGS_IGNORE_FVAL for line scan cameras
AOI_WidthAOI width
AOI_HeightAOI height
AOI_XHorizontal start position
AOI_Yvertical start position
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ ConfigureCLInput() [2/2]

bool VIB::CameraLinkIn::ConfigureCLInput ( unsigned int  ChannelIndex,
VIB::CameraLinkIn::INMODE_TYPE  InType,
unsigned int  InFlags,
unsigned short  Width,
unsigned short  Height,
unsigned short  AOI_X,
unsigned short  AOI_Y,
unsigned short  AOI_Width,
unsigned short  AOI_Height 
)

Configures a camera channel.

To reconfigure the channel, after the first call, the complete device has to be closed and opened again.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
InTypeDefine the desired Pixel/Data or streaming format
InFlagsBitwise OR of configuration flags defined in INMODE_FLAGS
Use CL_IN_INMODE_FLAGS_DEFAULT for area scan cameras and CL_IN_INMODE_FLAGS_IGNORE_FVAL for line scan cameras
WidthThe complete camera image width
HeightThe complete camera image Height
AOI_XHorizontal start position
AOI_Yvertical start position
AOI_WidthAOI width
AOI_HeightAOI height
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ ConfigureModule()

bool VIB::CameraLinkIn::ConfigureModule ( const VIB::CameraLinkIn::MODULE_CONFIGURATION  ModuleConfig)

Configures the module to the given mode.

This function can only be called once after the device was opened.

Parameters
ModuleConfigthe new working mode for the whole module
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ FreeImageBuffer()

bool VIB::CameraLinkIn::FreeImageBuffer ( const unsigned int  ChannelIndex,
void *  ptr 
)

Frees the specified buffer.

It is only allowed to clean up buffers which are owned by the user. Use AbortBufferUsage() and WaitForImageBuffer() to gain ownership for buffers in the acquisition queue.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
ptrPointer to the image buffer
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetAOI()

bool VIB::CameraLinkIn::GetAOI ( unsigned int  ChannelIndex,
unsigned int &  AOI_X,
unsigned int &  AOI_Y,
unsigned int &  AOI_Width,
unsigned int &  AOI_Height 
)

Returns the configured AOI size.

The camera channel must be configured with ConfigureCLInput() before calling this function.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
AOI_XHorizontal AOI start position
AOI_YVertical AOI start position
AOI_WidthAOI width
AOI_HeightAOI height
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetBitsPerPixel()

bool VIB::CameraLinkIn::GetBitsPerPixel ( unsigned int  ChannelIndex,
unsigned int &  ValidBits,
unsigned int &  BufferBits 
)

Returns the number of bits for each pixel.

The camera channel must be configured with ConfigureCLInput() before calling this function.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
ValidBitsNumber of usable bits per pixel
BufferBitsNumber of bits per pixel used in the image buffers, including the unused padding bits
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetBufferSize()

bool VIB::CameraLinkIn::GetBufferSize ( unsigned int  ChannelIndex,
unsigned int &  Bytes 
)

Returns the number of bytes allocated for each image buffer.

The camera channel must be configured with ConfigureCLInput() before calling this function.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
BytesNumber of bytes
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ GetNumberOfInputs()

bool VIB::CameraLinkIn::GetNumberOfInputs ( const VIB::CameraLinkIn::MODULE_CONFIGURATION  ModuleConfig,
unsigned int &  NumberOfInputs 
)

Returns the number of independent Camera Link input channels.

The number depends on hardware, firmware and the specified Camera Link configuration. The returned number can be 0 for 'not supported', 1 for one channel / camera and 2 for two cameras (Camera Link Base only).

Parameters
ModuleConfigSpecifies the configuration for which the function returns the number of channels
NumberOfInputsReturns the number of channels / cameras which can be connected
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ Reset()

bool VIB::CameraLinkIn::Reset ( )

Resets the device to default settings.

Only the CC lines are currently affected when calling this function. All signals are turned off (CL_IN_CC_SRC_OFF).

Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ WaitForImageBuffer()

bool VIB::CameraLinkIn::WaitForImageBuffer ( const unsigned int  ChannelIndex,
const unsigned int  msTimeOut,
void **  pPtr,
bool &  IsContentValid 
)

Waits for completion of image buffers and transfers ownership to the user.

Multiple threads can call this function simultaneously. The first caller returns first with the next completed buffer.

After successful return of the function, one of three events have occured:

  • The returned image buffer in pPtr is valid and IsContentValid is true:
    The ownership of the buffer is transfered to the user and image acquisition was successful.
  • The returned image buffer in pPtr is valid and IsContentValid is false:
    The ownership of the buffer is transfered to the user, but the image acquisition was not successful. The contens of the image buffer are not valid or only partially valid. The cause can be an incorrectly configured frame size and format, a problem with the Camera Link signals, or after call of AbortBufferUsage().
  • The returned image buffer in pPtr is invalid (NULL):
    The timeout expired or AbortWaitingForDMA() was called. Image buffers remain in the acquisition queue. After a timeout, the user can call this function again to check for ready images.

After a valid buffer was returned, it can be released with FreeImageBuffer() or added to the acquisition queue again with WaitForImageBuffer().

This function is also used to obtain buffers after AbortBufferUsage() was called.

Parameters
ChannelIndexCamera index, 0 ... GetNumberOfInputs()
msTimeOutTimeOut in milliseconds, 0 ... INFINITE
pPtrDouble pointer for storing the new image buffer or NULL
IsContentValidIf pPtr is valid, this flag indicates if image acquisition was successful
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
VIB::Multiplexer::MUX_SRC_SYNC_0
@ MUX_SRC_SYNC_0
SYNC group 0, signal 0.
Definition: VIB_Interface.h:758
VIB::Multiplexer::ConnectOutput
bool ConnectOutput(unsigned int OutputIndex, Multiplexer::MUX_SOURCE Source)
Selects the source signal for the specified output line.
Definition: Multiplexer.cpp:428
VIB::TriggerGenerator::ConfigureSet
bool ConfigureSet(const char Command[])
Generic function for controlling the FPGA trigger unit.
Definition: TriggerGenerator.cpp:632
VIB::TriggerGenerator
This class controls the FPGA Trigger Unit.
Definition: VIB_Interface.h:710
VIB::Multiplexer::MUX_SRC_TRIGGEN_OUT0
@ MUX_SRC_TRIGGEN_OUT0
TriggerGenerator output 0.
Definition: VIB_Interface.h:762
VIB::Multiplexer
This class controls the Multiplexer unit which connects signal sources and sinks with each other.
Definition: VIB_Interface.h:733
VIB::Multiplexer::MUX_SRC_SYNC_1
@ MUX_SRC_SYNC_1
SYNC group 0, signal 1.
Definition: VIB_Interface.h:759
VIB::iDevice::Open
bool Open(unsigned int Index=0)
Opens a device
Definition: iDevice.cpp:109