Spinnaker C
4.3.0.189
 
Sequencer_C.c

Sequencer_C.c shows how to use the sequencer to grab images with various settings. It relies on information provided in the Enumeration_C, Acquisition_C, and NodeMapInfo_C examples.

It can also be helpful to familiarize yourself with the ImageFormatControl_C and Exposure_C examples as these provide a strong introduction to camera customization.

The sequencer is another very powerful tool that can be used to create and store multiple sets of customized image settings. A very useful application of the sequencer is creating high dynamic range images.

This example is probably the most complex and definitely the longest. As such, the configuration has been split between three functions. The first prepares the camera to set the sequences, the second sets the settings for a single sequence (it is run five times), and the third configures the camera to use the sequencer when it acquires images.

Please leave us feedback at: https://www.surveymonkey.com/r/TDYMVAPI More source code examples at: https://github.com/Teledyne-MV/Spinnaker-Examples Need help? Check out our forum at: https://teledynevisionsolutions.zendesk.com/hc/en-us/community/topics

//=============================================================================
// Copyright (c) 2025 FLIR Integrated Imaging Solutions, Inc. All Rights Reserved.
//
// This software is the confidential and proprietary information of FLIR
// Integrated Imaging Solutions, Inc. ("Confidential Information"). You
// shall not disclose such Confidential Information and shall use it only in
// accordance with the terms of the license agreement you entered into
// with FLIR Integrated Imaging Solutions, Inc. (FLIR).
//
// FLIR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
// SOFTWARE, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE, OR NON-INFRINGEMENT. FLIR SHALL NOT BE LIABLE FOR ANY DAMAGES
// SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
// THIS SOFTWARE OR ITS DERIVATIVES.
//=============================================================================
#include "SpinnakerC.h"
#include "stdio.h"
#include "string.h"
// This macro helps with C-strings.
#define MAX_BUFF_LEN 256
// Helper for getting error messages
{
// Note: lastErrorMessage is shared across multiple threads; a different thread could overwrite the last error
// message before this function is called to grab the latest message
}
// This function helps to check if a node is readable
{
bool8_t pbReadable = False;
spinError err = spinNodeIsReadable(hNode, &pbReadable);
{
printf("Unable to retrieve node readability, with error %s [%d]...\n\n", GetLastErrorMessage(), err);
}
return pbReadable;
}
// This function helps to check if a node is writable
{
bool8_t pbWritable = False;
spinError err = spinNodeIsWritable(hNode, &pbWritable);
{
printf("Unable to retrieve node writability, with error %s [%d]...\n\n", GetLastErrorMessage(), err);
}
return pbWritable;
}
// This function handles the error prints when a node or entry is
// not readable/writable on the connected camera
void PrintRetrieveNodeFailure(char node[], char name[])
{
printf("Unable to get %s (%s %s retrieval failed).\n\n", node, name, node);
printf("The %s may not be readable or writable on all camera models...\n", node);
printf("Please try a Blackfly S camera.\n\n");
}
// This function prepares the sequencer to accept custom configurations by
// ensuring sequencer mode is off (this is a requirement to the enabling of
// sequencer configuration mode), disabling automatic gain and exposure, and
// turning sequencer configuration mode on.
{
spinError err = SPINNAKER_ERR_SUCCESS;
printf("\n\n*** SEQUENCER CONFIGURATION ***\n\n");
//
// Ensure sequencer is off for configuration
//
// *** NOTES ***
// In order to set a new sequencer configuration, sequencer mode must
// be disabled and sequencer configuration mode must be enabled. In
// order to manually disable sequencer mode, the sequencer configuration
// must be valid; otherwise, we know that sequencer mode is off, but an
// exception will be raised when we try to manually disable it.
//
// Therefore, in order to ensure that sequencer mode is off, we first
// check whether the current sequencer configuration is valid. If it
// isn't, then we know that sequencer mode is off and we can move on;
// however, if it is, then we know it is safe to manually disable
// sequencer mode.
//
// Also note that sequencer configuration mode needs to be off in order
// to manually disable sequencer mode. It should be off by default, so
// the example skips checking this.
//
spinNodeHandle hSequencerConfigurationValid = NULL;
spinNodeHandle hSequencerConfigurationValidCurrent = NULL;
spinNodeHandle hSequencerConfigurationValidYes = NULL;
spinNodeHandle hSequencerMode = NULL;
spinNodeHandle hSequencerModeOff = NULL;
int64_t sequencerModeOff = 0;
// Validate sequencer configuration
err = spinNodeMapGetNode(hNodeMap, "SequencerConfigurationValid", &hSequencerConfigurationValid);
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationValid");
}
if (!IsReadable(hSequencerConfigurationValid))
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationValid");
}
err = spinEnumerationGetCurrentEntry(hSequencerConfigurationValid, &hSequencerConfigurationValidCurrent);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid current");
}
if (!IsReadable(hSequencerConfigurationValidCurrent))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid current");
}
err = spinEnumerationGetEntryByName(hSequencerConfigurationValid, "Yes", &hSequencerConfigurationValidYes);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid 'Yes'");
}
if (!IsReadable(hSequencerConfigurationValidYes))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid 'Yes'");
}
// If valid, disable sequencer mode; otherwise, do nothing
if (hSequencerConfigurationValidCurrent == hSequencerConfigurationValidYes)
{
err = spinNodeMapGetNode(hNodeMap, "SequencerMode", &hSequencerMode);
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
if (!IsReadable(hSequencerMode))
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
err = spinEnumerationGetEntryByName(hSequencerMode, "Off", &hSequencerModeOff);
{
PrintRetrieveNodeFailure("entry", "SequencerMode 'Off'");
}
if (!IsReadable(hSequencerModeOff))
{
PrintRetrieveNodeFailure("entry", "SequencerMode 'Off'");
}
err = spinEnumerationEntryGetIntValue(hSequencerModeOff, &sequencerModeOff);
{
printf("Unable to disable sequencer mode (entry int value retrieval). Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerMode))
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
err = spinEnumerationSetIntValue(hSequencerMode, sequencerModeOff);
{
printf("Unable to disable sequencer mode (entry int value setting). Aborting with error %d...\n\n", err);
}
}
printf("Sequencer mode disabled...\n");
//
// Turn off automatic exposure mode
//
// *** NOTES ***
// Automatic exposure prevents the manual configuration of exposure
// times and needs to be turned off for this example.
//
// *** LATER ***
// If exposure time is not being manually set for a specific reason, it
// is best to let the camera take care of exposure time automatically.
//
spinNodeHandle hExposureAuto = NULL;
spinNodeHandle hExposureAutoOff = NULL;
int64_t exposureAutoOff;
err = spinNodeMapGetNode(hNodeMap, "ExposureAuto", &hExposureAuto);
{
PrintRetrieveNodeFailure("node", "ExposureAuto");
}
if (!IsReadable(hExposureAuto))
{
PrintRetrieveNodeFailure("node", "ExposureAuto");
}
err = spinEnumerationGetEntryByName(hExposureAuto, "Off", &hExposureAutoOff);
{
PrintRetrieveNodeFailure("entry", "ExposureAuto 'Off'");
}
if (!IsReadable(hExposureAutoOff))
{
PrintRetrieveNodeFailure("entry", "ExposureAuto 'Off'");
}
err = spinEnumerationEntryGetIntValue(hExposureAutoOff, &exposureAutoOff);
{
printf("Unable to disable automatic exposure (entry int value retrieval). Aborting with error %d...\n\n", err);
}
if (!IsWritable(hExposureAuto))
{
PrintRetrieveNodeFailure("node", "ExposureAuto");
}
err = spinEnumerationSetIntValue(hExposureAuto, exposureAutoOff);
{
printf("Unable to disable automatic exposure (entry int value setting). Aborting with error %d...\n\n", err);
}
printf("Automatic exposure disabled...\n");
//
// Turn off automatic gain
//
// *** NOTES ***
// Automatic gain prevents the manual configuration of gain and needs to
// be turned off for this example.
//
// *** LATER ***
// If gain is not being manually set for a specific reason, it is best
// to let the camera take care of gain automatically.
//
spinNodeHandle hGainAuto = NULL;
spinNodeHandle hGainAutoOff = NULL;
int64_t gainAutoOff;
err = spinNodeMapGetNode(hNodeMap, "GainAuto", &hGainAuto);
{
PrintRetrieveNodeFailure("node", "GainAuto");
}
if (!IsReadable(hGainAuto))
{
PrintRetrieveNodeFailure("node", "GainAuto");
}
err = spinEnumerationGetEntryByName(hGainAuto, "Off", &hGainAutoOff);
{
PrintRetrieveNodeFailure(" entry", "GainAuto 'Off'");
}
if (!IsReadable(hGainAutoOff))
{
PrintRetrieveNodeFailure(" entry", "GainAuto 'Off'");
}
err = spinEnumerationEntryGetIntValue(hGainAutoOff, &gainAutoOff);
{
printf("Unable to disable automatic gain. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hGainAuto))
{
PrintRetrieveNodeFailure("node", "GainAuto");
}
err = spinEnumerationSetIntValue(hGainAuto, gainAutoOff);
{
printf("Unable to disable automatic gain. Aborting with error %d...\n\n", err);
}
printf("Automatic gain disabled...\n");
//
// Turn configuration mode on
//
// *** NOTES ***
// Once sequencer mode is off, enabling sequencer configuration mode
// allows for the setting of individual sequences.
//
// *** LATER ***
// Before sequencer mode is turned back on, sequencer configuration
// mode must be turned off.
//
spinNodeHandle hSequencerConfigurationMode = NULL;
spinNodeHandle hSequencerConfigurationModeOn = NULL;
int64_t sequencerConfigurationModeOn = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerConfigurationMode", &hSequencerConfigurationMode);
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationMode");
}
if (!IsReadable(hSequencerConfigurationMode))
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationMode");
}
err = spinEnumerationGetEntryByName(hSequencerConfigurationMode, "On", &hSequencerConfigurationModeOn);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationMode 'On'");
}
if (!IsReadable(hSequencerConfigurationModeOn))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationMode 'On'");
}
err = spinEnumerationEntryGetIntValue(hSequencerConfigurationModeOn, &sequencerConfigurationModeOn);
{
printf("Unable to enable sequencer configuration mode. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerConfigurationMode))
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationMode");
}
err = spinEnumerationSetIntValue(hSequencerConfigurationMode, sequencerConfigurationModeOn);
{
printf("Unable to enable sequencer configuration mode. Aborting with error %d...\n\n", err);
}
printf("Sequencer configuration mode enabled...\n\n");
return 0;
}
// This function sets a single state. It sets the sequence number, applies
// custom settings, selects the trigger type and next state number, and saves
// the state. The custom values that are applied are all calculated in the
// function that calls this one, RunSingleCamera().
unsigned int sequenceNumber,
int64_t widthToSet,
int64_t heightToSet,
double exposureTimeToSet,
double gainToSet)
{
spinError err = SPINNAKER_ERR_SUCCESS;
//
// Select the sequence number
//
// *** NOTES ***
// Select the index of the state to be set.
//
// *** LATER ***
// The next state - i.e. the state to be linked to -
// also needs to be set before saving the current state.
//
spinNodeHandle hSequencerSetSelector = NULL;
err = spinNodeMapGetNode(hNodeMap, "SequencerSetSelector", &hSequencerSetSelector);
{
printf("Unable to select current sequence. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerSetSelector))
{
printf("Unable to select current sequence. Aborting with error %d...\n\n", err);
}
err = spinIntegerSetValue(hSequencerSetSelector, sequenceNumber);
{
printf("Unable to select current sequence. Aborting with error %d...\n\n", err);
}
printf("Customizing sequence %d...\n", sequenceNumber);
//
// Set desired settings for the current state
//
// *** NOTES ***
// Width, height, exposure time, and gain are set in this example. If
// the sequencer isn't working properly, it may be important to ensure
// that each feature is enabled on the sequencer. Features are enabled
// by default, so this is not explored in this example.
//
// Changing the height and width for the sequencer is not readable/writable
// for all camera models.
//
// Set width; width recorded in pixels
spinNodeHandle hWidth = NULL;
int64_t widthInc = 0;
err = spinNodeMapGetNode(hNodeMap, "Width", &hWidth);
{
printf("Unable to set width. Aborting with error %d...\n\n", err);
}
if (IsReadable(hWidth) && IsWritable(hWidth))
{
err = spinIntegerGetInc(hWidth, &widthInc);
{
printf("Unable to set width. Aborting with error %d...\n\n", err);
}
if (widthToSet % widthInc != 0)
{
widthToSet = (widthToSet / widthInc) * widthInc;
}
err = spinIntegerSetValue(hWidth, widthToSet);
{
printf("Unable to set width. Aborting with error %d...\n\n", err);
}
printf("\tWidth set to %d...\n", (int)widthToSet);
}
else
{
printf("\tUnable to get or set width; width for sequencer not readable/writable on all camera models...\n");
}
// Set height; height recorded in pixels
spinNodeHandle hHeight = NULL;
int64_t heightInc = 0;
err = spinNodeMapGetNode(hNodeMap, "Height", &hHeight);
{
printf("Unable to set height. Aborting with error %d...\n\n", err);
}
if (IsReadable(hHeight) && IsWritable(hHeight))
{
err = spinIntegerGetInc(hHeight, &heightInc);
{
printf("Unable to set height. Aborting with error %d...\n\n", err);
}
if (heightToSet % heightInc != 0)
{
heightToSet = (heightToSet / heightInc) * heightInc;
}
err = spinIntegerSetValue(hHeight, heightToSet);
{
printf("Unable to set height. Aborting with error %d...\n\n", err);
}
printf("\tHeight set to %d...\n", (int)heightToSet);
}
else
{
printf("\tUnable to set height; height for sequencer not readable/writable on all camera models...\n");
}
// Set exposure time; exposure time recorded in microseconds
spinNodeHandle hExposureTime = NULL;
err = spinNodeMapGetNode(hNodeMap, "ExposureTime", &hExposureTime);
{
printf("Unable to set exposure. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hExposureTime))
{
printf("Unable to set exposure. Aborting with error %d...\n\n", err);
}
err = spinFloatSetValue(hExposureTime, exposureTimeToSet);
{
printf("Unable to set exposure. Aborting with error %d...\n\n", err);
}
printf("\tExposure time set to %f...\n", exposureTimeToSet);
// Set gain; gain recorded in decibels
spinNodeHandle hGain = NULL;
err = spinNodeMapGetNode(hNodeMap, "Gain", &hGain);
{
printf("Unable to set gain. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hGain))
{
printf("Unable to set gain. Aborting with error %d...\n\n", err);
}
err = spinFloatSetValue(hGain, gainToSet);
{
printf("Unable to set gain. Aborting with error %d...\n\n", err);
}
printf("\tGain set to %f...\n", gainToSet);
//
// Set the trigger type for the current sequence
//
// *** NOTES ***
// It is a requirement of every state to have its trigger source set.
// The trigger source refers to the moment when the sequencer changes
// from one state to the next.
//
spinNodeHandle hSequencerTriggerSource = NULL;
spinNodeHandle hSequencerTriggerSourceFrameStart = NULL;
int64_t sequencerTriggerSourceFrameStart = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerTriggerSource", &hSequencerTriggerSource);
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hSequencerTriggerSource))
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
err = spinEnumerationGetEntryByName(hSequencerTriggerSource, "FrameStart", &hSequencerTriggerSourceFrameStart);
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hSequencerTriggerSourceFrameStart))
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
err = spinEnumerationEntryGetIntValue(hSequencerTriggerSourceFrameStart, &sequencerTriggerSourceFrameStart);
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerTriggerSource))
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hSequencerTriggerSource, sequencerTriggerSourceFrameStart);
{
printf("Unable to set trigger source. Aborting with error %d...\n\n", err);
}
printf("\tTrigger source set to start of frame...\n");
//
// Set the next state in the sequence
//
// *** NOTES ***
// When setting the next state in the sequence, ensure it does not
// exceed the maximum and that the states loop appropriately.
//
spinNodeHandle hSequencerSetNext = NULL;
const unsigned int finalSequenceIndex = 4;
unsigned int nextSequence = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerSetNext", &hSequencerSetNext);
{
printf("Unable to set next sequence. Aborting with err %d...\n\n", err);
}
if (!IsWritable(hSequencerSetNext))
{
printf("Unable to set next sequence. Aborting with err %d...\n\n", err);
}
if (sequenceNumber != finalSequenceIndex)
{
nextSequence = sequenceNumber + 1;
}
err = spinIntegerSetValue(hSequencerSetNext, nextSequence);
{
printf("Unable to set next sequence. Aborting with err %d...\n\n", err);
}
printf("\tNext sequence set to %d...\n", nextSequence);
//
// Save current state
//
// *** NOTES ***
// Once all appropriate settings have been configured, make sure to
// save the state to the sequence. Notice that these settings will be
// lost when the camera is power-cycled.
//
spinNodeHandle hSequencerSetSave = NULL;
err = spinNodeMapGetNode(hNodeMap, "SequencerSetSave", &hSequencerSetSave);
{
printf("Unable to save sequence. Aborting with err %d...\n\n", err);
}
if (!IsWritable(hSequencerSetSave))
{
printf("Unable to save sequence. Aborting with err %d...\n\n", err);
}
err = spinCommandExecute(hSequencerSetSave);
{
printf("Unable to save sequence. Aborting with err %d...\n\n", err);
}
printf("\tSequence %d saved...\n\n", sequenceNumber);
return 0;
}
// Now that the states have all been set, this function readies the camera
// to use the sequencer during image acquisition.
{
spinError err = SPINNAKER_ERR_SUCCESS;
//
// Turn configuration mode off
//
// *** NOTES ***
// Once all desired states have been set, turn sequencer
// configuration mode off in order to turn sequencer mode on.
//
spinNodeHandle hSequencerConfigurationMode = NULL;
spinNodeHandle hSequencerConfigurationModeOff = NULL;
int64_t sequencerConfigurationModeOff = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerConfigurationMode", &hSequencerConfigurationMode);
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationMode");
}
if (!IsWritable(hSequencerConfigurationMode))
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationMode");
}
err = spinEnumerationGetEntryByName(hSequencerConfigurationMode, "Off", &hSequencerConfigurationModeOff);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationMode 'Off'");
}
if (!IsReadable(hSequencerConfigurationModeOff))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationMode 'Off'");
}
err = spinEnumerationEntryGetIntValue(hSequencerConfigurationModeOff, &sequencerConfigurationModeOff);
{
printf("Unable to disable sequencer configuration mode. Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hSequencerConfigurationMode, sequencerConfigurationModeOff);
{
printf("Unable to disable sequencer configuration mode. Aborting with error %d...\n\n", err);
}
printf("Sequencer configuration mode disabled...\n");
//
// Turn sequencer mode on
//
// *** NOTES ***
// Once sequencer mode is turned on, the camera will begin using the
// saved states in the order that they were set.
//
// *** LATER ***
// Once all images have been captured, disable the sequencer in order
// to restore the camera to its initial state.
//
spinNodeHandle hSequencerMode = NULL;
spinNodeHandle hSequencerModeOn = NULL;
int64_t sequencerModeOn = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerMode", &hSequencerMode);
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
if (!IsReadable(hSequencerMode))
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
err = spinEnumerationGetEntryByName(hSequencerMode, "On", &hSequencerModeOn);
{
PrintRetrieveNodeFailure("entry", "SequencerMode 'On'");
}
if (!IsReadable(hSequencerModeOn))
{
PrintRetrieveNodeFailure("entry", "SequencerMode 'On'");
}
err = spinEnumerationEntryGetIntValue(hSequencerModeOn, &sequencerModeOn);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerMode))
{
PrintRetrieveNodeFailure("node", "SequencerMode");
}
err = spinEnumerationSetIntValue(hSequencerMode, sequencerModeOn);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
printf("Sequencer mode enabled...\n");
//
// Validate sequencer settings
//
// *** NOTES ***
// Once all states have been set, it is a good idea to
// validate them. Although this node cannot ensure that the states
// have been set up correctly, it does ensure that the states have
// been set up in such a way that the camera can function.
//
spinNodeHandle hSequencerConfigurationValid = NULL;
spinNodeHandle hSequencerConfigurationValidCurrent = NULL;
spinNodeHandle hSequencerConfigurationValidYes = NULL;
int64_t sequencerConfigurationValidCurrent = 0;
int64_t sequencerConfigurationValidYes = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerConfigurationValid", &hSequencerConfigurationValid);
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationValid");
}
if (!IsReadable(hSequencerConfigurationValid))
{
PrintRetrieveNodeFailure("node", "SequencerConfigurationValid");
}
err = spinEnumerationGetCurrentEntry(hSequencerConfigurationValid, &hSequencerConfigurationValidCurrent);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid current");
}
if (!IsReadable(hSequencerConfigurationValidCurrent))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid current");
}
err = spinEnumerationGetEntryByName(hSequencerConfigurationValid, "Yes", &hSequencerConfigurationValidYes);
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid 'Yes'");
}
if (!IsReadable(hSequencerConfigurationValidYes))
{
PrintRetrieveNodeFailure("entry", "SequencerConfigurationValid 'Yes'");
}
err = spinEnumerationEntryGetIntValue(hSequencerConfigurationValidCurrent, &sequencerConfigurationValidCurrent);
{
printf(
"Unable to validate sequencer configuration ('current' value retrieval). Aborting with error %d...\n\n",
err);
}
err = spinEnumerationEntryGetIntValue(hSequencerConfigurationValidYes, &sequencerConfigurationValidYes);
{
printf(
"Unable to validate sequencer configuration ('yes' value retrieval). Aborting with error %d...\n\n", err);
}
if (sequencerConfigurationValidCurrent != sequencerConfigurationValidYes)
{
printf("Sequencer configuration not valid. Aborting with error %d...\n\n", err);
}
printf("Sequencer configuration valid...\n\n");
return 0;
}
// This function restores the camera to its default state by turning sequencer
// mode off and re-enabling automatic exposure and gain.
{
spinError err = SPINNAKER_ERR_SUCCESS;
//
// Turn sequencer mode back off
//
// *** NOTES ***
// The sequencer is turned off in order to return the camera to its default
// state.
//
spinNodeHandle hSequencerMode = NULL;
spinNodeHandle hSequencerModeOff = NULL;
int64_t sequencerModeOff = 0;
err = spinNodeMapGetNode(hNodeMap, "SequencerMode", &hSequencerMode);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hSequencerMode))
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
err = spinEnumerationGetEntryByName(hSequencerMode, "Off", &hSequencerModeOff);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hSequencerModeOff))
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
err = spinEnumerationEntryGetIntValue(hSequencerModeOff, &sequencerModeOff);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hSequencerMode))
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hSequencerMode, sequencerModeOff);
{
printf("Unable to enable sequencer mode. Aborting with error %d...\n\n", err);
}
printf("Sequencer mode disabled...\n");
//
// Turn automatic exposure back on
//
// *** NOTES ***
// Automatic exposure is turned on in order to return the camera to its
// default state.
//
spinNodeHandle hExposureAuto = NULL;
spinNodeHandle hExposureAutoContinuous = NULL;
int64_t exposureAutoContinuous;
err = spinNodeMapGetNode(hNodeMap, "ExposureAuto", &hExposureAuto);
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hExposureAuto))
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
err = spinEnumerationGetEntryByName(hExposureAuto, "Continuous", &hExposureAutoContinuous);
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hExposureAutoContinuous))
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
err = spinEnumerationEntryGetIntValue(hExposureAutoContinuous, &exposureAutoContinuous);
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hExposureAuto))
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hExposureAuto, exposureAutoContinuous);
{
printf("Unable to enable automatic exposure. Aborting with error %d...\n\n", err);
}
printf("Automatic exposure enabled...\n");
//
// Turn automatic gain back on
//
// *** NOTES ***
// Automatic gain is turned on in order to return the camera to its
// default state.
//
spinNodeHandle hGainAuto = NULL;
spinNodeHandle hGainAutoContinuous = NULL;
int64_t gainAutoContinuous;
err = spinNodeMapGetNode(hNodeMap, "GainAuto", &hGainAuto);
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hGainAuto))
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
err = spinEnumerationGetEntryByName(hGainAuto, "Continuous", &hGainAutoContinuous);
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hGainAutoContinuous))
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
err = spinEnumerationEntryGetIntValue(hGainAutoContinuous, &gainAutoContinuous);
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
if (!IsWritable(hGainAuto))
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hGainAuto, gainAutoContinuous);
{
printf("Unable to enable automatic gain. Aborting with error %d...\n\n", err);
}
printf("Automatic gain enabled...\n\n");
return 0;
}
// This function prints the device information of the camera from the transport
// layer; please see NodeMapInfo_C example for more in-depth comments on
// printing device information from the nodemap.
{
spinError err = SPINNAKER_ERR_SUCCESS;
unsigned int i = 0;
printf("\n*** DEVICE INFORMATION ***\n\n");
// Retrieve device information category node
spinNodeHandle hDeviceInformation = NULL;
err = spinNodeMapGetNode(hNodeMap, "DeviceInformation", &hDeviceInformation);
{
printf("Unable to retrieve node. Non-fatal error %d...\n\n", err);
}
if (!IsReadable(hDeviceInformation))
{
printf("Unable to retrieve node. Non-fatal error %d...\n\n", err);
}
// Retrieve number of nodes within device information node
size_t numFeatures = 0;
err = spinCategoryGetNumFeatures(hDeviceInformation, &numFeatures);
{
printf("Unable to retrieve number of nodes. Non-fatal error %d...\n\n", err);
}
// Iterate through nodes and print information
for (i = 0; i < numFeatures; i++)
{
spinNodeHandle hFeatureNode = NULL;
err = spinCategoryGetFeatureByIndex(hDeviceInformation, i, &hFeatureNode);
{
printf("Unable to retrieve node. Non-fatal error %d...\n\n", err);
continue;
}
spinNodeType featureType = UnknownNode;
char featureName[MAX_BUFF_LEN];
size_t lenFeatureName = MAX_BUFF_LEN;
err = spinNodeGetName(hFeatureNode, featureName, &lenFeatureName);
{
strcpy(featureName, "Unknown name");
}
if (IsReadable(hFeatureNode))
{
err = spinNodeGetType(hFeatureNode, &featureType);
{
printf("Unable to retrieve node type. Non-fatal error %d...\n\n", err);
continue;
}
}
else
{
printf("%s: Node not readable\n", featureName);
continue;
}
char featureValue[MAX_BUFF_LEN];
size_t lenFeatureValue = MAX_BUFF_LEN;
err = spinNodeToString(hFeatureNode, featureValue, &lenFeatureValue);
{
strcpy(featureValue, "Unknown value");
}
printf("%s: %s\n", featureName, featureValue);
}
return 0;
}
// This function acquires and saves 10 images from a device; please see
// Acquisition_C example for more in-depth comments on the acquisition of
// images.
int AcquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice, uint64_t timeout)
{
spinError err = SPINNAKER_ERR_SUCCESS;
printf("\n*** IMAGE ACQUISITION ***\n\n");
// Set acquisition mode to continuous
spinNodeHandle hAcquisitionMode = NULL;
spinNodeHandle hAcquisitionModeContinuous = NULL;
int64_t acquisitionModeContinuous = 0;
err = spinNodeMapGetNode(hNodeMap, "AcquisitionMode", &hAcquisitionMode);
{
printf("Unable to set acquisition mode to continuous (node retrieval). Aborting with error %d...\n\n", err);
}
if (!IsReadable(hAcquisitionMode))
{
printf("Unable to set acquisition mode to continuous (node retrieval). Aborting with error %d...\n\n", err);
}
err = spinEnumerationGetEntryByName(hAcquisitionMode, "Continuous", &hAcquisitionModeContinuous);
{
printf(
"Unable to set acquisition mode to continuous (entry 'continuous' retrieval). Aborting with error "
"%d...\n\n",
err);
}
if (!IsReadable(hAcquisitionModeContinuous))
{
printf(
"Unable to set acquisition mode to continuous (entry 'continuous' retrieval). Aborting with error "
"%d...\n\n",
err);
}
err = spinEnumerationEntryGetIntValue(hAcquisitionModeContinuous, &acquisitionModeContinuous);
{
printf(
"Unable to set acquisition mode to continuous (entry int value retrieval). Aborting with error %d...\n\n",
err);
}
if (!IsWritable(hAcquisitionMode))
{
printf("Unable to set acquisition mode to continuous (node retrieval). Aborting with error %d...\n\n", err);
}
err = spinEnumerationSetIntValue(hAcquisitionMode, acquisitionModeContinuous);
{
printf(
"Unable to set acquisition mode to continuous (entry int value setting). Aborting with error %d...\n\n",
err);
}
printf("Acquisition mode set to continuous...\n");
// Begin acquiring images
{
printf("Unable to begin image acquisition. Aborting with error %d...\n\n", err);
}
printf("Acquiring images...\n");
// Retrieve device serial number for filename
spinNodeHandle hDeviceSerialNumber = NULL;
char deviceSerialNumber[MAX_BUFF_LEN];
size_t lenDeviceSerialNumber = MAX_BUFF_LEN;
err = spinNodeMapGetNode(hNodeMapTLDevice, "DeviceSerialNumber", &hDeviceSerialNumber);
{
strcpy(deviceSerialNumber, "");
lenDeviceSerialNumber = 0;
}
else
{
if (!IsReadable(hDeviceSerialNumber))
{
strcpy(deviceSerialNumber, "");
lenDeviceSerialNumber = 0;
}
else
{
err = spinStringGetValue(hDeviceSerialNumber, deviceSerialNumber, &lenDeviceSerialNumber);
{
strcpy(deviceSerialNumber, "");
lenDeviceSerialNumber = 0;
}
printf("Device serial number retrieved as %s...\n", deviceSerialNumber);
}
}
printf("\n");
// Retrieve, convert, and save images
const unsigned int k_numImages = 10;
unsigned int imageCnt = 0;
//
// Create Image Processor context for post processing images
//
spinImageProcessor hImageProcessor = NULL;
err = spinImageProcessorCreate(&hImageProcessor);
{
printf("Unable to create image processor. Non-fatal error %d...\n\n", err);
}
//
// Set default image processor color processing method
//
// *** NOTES ***
// By default, if no specific color processing algorithm is set, the image
// processor will default to NEAREST_NEIGHBOR method.
//
{
printf("Unable to set image processor color processing method. Non-fatal error %d...\n\n", err);
}
for (imageCnt = 0; imageCnt < k_numImages; imageCnt++)
{
// Retrieve next received image
spinImage hResultImage = NULL;
err = spinCameraGetNextImageEx(hCam, timeout, &hResultImage);
{
printf("Unable to get next image. Non-fatal error %d...\n\n", err);
continue;
}
// Ensure image completion
bool8_t isIncomplete = False;
bool8_t hasFailed = False;
err = spinImageIsIncomplete(hResultImage, &isIncomplete);
{
printf("Unable to determine image completion. Non-fatal error %d...\n\n", err);
hasFailed = True;
}
if (isIncomplete)
{
spinImageStatus imageStatus = SPINNAKER_IMAGE_STATUS_NO_ERROR;
err = spinImageGetStatus(hResultImage, &imageStatus);
{
printf("Unable to retrieve image status. Non-fatal error %d...\n\n", err);
}
else
{
printf("Image incomplete with image status %d...\n", imageStatus);
}
hasFailed = True;
}
// Release incomplete or failed image
if (hasFailed)
{
err = spinImageRelease(hResultImage);
{
printf("Unable to release image. Non-fatal error %d...\n\n", err);
}
continue;
}
// Print image information
size_t width = 0;
size_t height = 0;
err = spinImageGetWidth(hResultImage, &width);
{
printf("Unable to retrieve image width. Non-fatal error %d...\n", err);
}
err = spinImageGetHeight(hResultImage, &height);
{
printf("Unable to retrieve image height. Non-fatal error %d...\n", err);
}
printf("Grabbed image %u, width = %u, height = %u\n", imageCnt, (unsigned int)width, (unsigned int)height);
// Convert image to mono 8
spinImage hConvertedImage = NULL;
err = spinImageCreateEmpty(&hConvertedImage);
{
printf("Unable to create image. Non-fatal error %d...\n\n", err);
hasFailed = True;
}
err = spinImageProcessorConvert(hImageProcessor, hResultImage, hConvertedImage, PixelFormat_Mono8);
{
printf("Unable to convert image. Non-fatal error %d...\n\n", err);
hasFailed = True;
}
// Create unique file name
char filename[MAX_BUFF_LEN];
if (lenDeviceSerialNumber == 0)
{
sprintf(filename, "Sequencer-C-%d.jpg", imageCnt);
}
else
{
sprintf(filename, "Sequencer-C-%s-%d.jpg", deviceSerialNumber, imageCnt);
}
// Save image
err = spinImageSave(hConvertedImage, filename, SPINNAKER_IMAGE_FILE_FORMAT_JPEG);
{
printf("Unable to save image. Non-fatal error %d...\n", err);
}
else
{
printf("Image saved at %s\n\n", filename);
}
// Destroy converted image
err = spinImageDestroy(hConvertedImage);
{
printf("Unable to destroy image. Non-fatal error %d...\n\n", err);
}
// Release image
err = spinImageRelease(hResultImage);
{
printf("Unable to release image. Non-fatal error %d...\n\n", err);
}
}
//
// Destroy Image Processor context
//
// *** NOTES ***
// Image processor context needs to be destroyed after all image processing
// are complete to avoid memory leaks.
//
err = spinImageProcessorDestroy(hImageProcessor);
{
printf("Unable to destroy image processor. Non-fatal error %d...\n\n", err);
}
// End acquisition
{
printf("Unable to end acquisition. Non-fatal error %d...\n\n", err);
}
return 0;
}
// This function acts very similarly to the RunSingleCamera() functions of other
// examples, except that the values for the sequences are also calculated here;
// please see NodeMapInfo example for additional information on the steps in
// this function.
{
spinError err = SPINNAKER_ERR_SUCCESS;
int result = 0;
// Retrieve TL device nodemap and print device information
spinNodeMapHandle hNodeMapTLDevice = NULL;
err = spinCameraGetTLDeviceNodeMap(hCam, &hNodeMapTLDevice);
{
printf("Unable to retrieve TL device nodemap. Non-fatal error %d...\n\n", err);
}
else
{
result = PrintDeviceInfo(hNodeMapTLDevice);
}
// Initialize camera
err = spinCameraInit(hCam);
{
printf("Unable to initialize camera. Aborting with error %d...\n\n", err);
}
// Retrieve GenICam nodemap
spinNodeMapHandle hNodeMap = NULL;
err = spinCameraGetNodeMap(hCam, &hNodeMap);
{
printf("Unable to retrieve GenICam nodemap. Aborting with error %d...\n\n", err);
}
// Configure sequencer to be ready to set sequences
if (ConfigureSequencerPartOne(hNodeMap) != 0)
{
}
//
// Set sequences
//
// *** NOTES ***
// In the following section, the sequencer values are calculated. This
// section does not appear in the configuration, as the values
// calculated are somewhat arbitrary: width and height are both set to
// 25% of their maximum values, incrementing by 10%; exposure time is
// set to its minimum, also incrementing by 10% of its maximum; and gain
// is set to its minimum, incrementing by 2% of its maximum.
//
const unsigned int k_numSequences = 5;
// Retrieve maximum width; width recorded in pixels
spinNodeHandle hWidth = NULL;
int64_t widthMax = 0;
err = spinNodeMapGetNode(hNodeMap, "Width", &hWidth);
{
printf("Unable to get max width (node retrieval). Aborting with error %d...\n\n", err);
}
if (!IsReadable(hWidth))
{
printf("Unable to get max width (node retrieval). Aborting with error %d...\n\n", err);
}
err = spinIntegerGetMax(hWidth, &widthMax);
{
printf("Unable to get max width (max retrieval). Aborting with error %d...\n\n", err);
}
// Retrieve maximum height; height recorded in pixels
spinNodeHandle hHeight = NULL;
int64_t heightMax = 0;
err = spinNodeMapGetNode(hNodeMap, "Height", &hHeight);
{
printf("Unable to get max height (node retrieval). Aborting with error %d...\n\n", err);
}
if (!IsReadable(hHeight))
{
printf("Unable to get max height (node retrieval). Aborting with error %d...\n\n", err);
}
err = spinIntegerGetMax(hHeight, &heightMax);
{
printf("Unable to get max height (max retrieval). Aborting with error %d...\n\n", err);
}
// Retrieve maximum exposure time; exposure time recorded in microseconds
spinNodeHandle hExposureTime = NULL;
const double exposureTimeMaxToSet = 2000000.0;
double exposureTimeMax = 0.0;
double exposureTimeMin = 0.0;
err = spinNodeMapGetNode(hNodeMap, "ExposureTime", &hExposureTime);
{
printf("Unable to retrieve exposure time node. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hHeight))
{
printf("Unable to retrieve exposure time node. Aborting with error %d...\n\n", err);
}
err = spinFloatGetMax(hExposureTime, &exposureTimeMax);
{
printf("Unable to retrieve maximum exposure time. Aborting with error %d...\n\n", err);
}
if (exposureTimeMax > exposureTimeMaxToSet)
{
exposureTimeMax = exposureTimeMaxToSet;
}
err = spinFloatGetMin(hExposureTime, &exposureTimeMin);
{
printf("Unable to retrieve minimum exposure time. Aborting with error %d...\n\n", err);
}
// Retrieve maximum and minimum gain; gain recorded in decibels
spinNodeHandle hGain = NULL;
double gainMax = 0.0;
double gainMin = 0.0;
err = spinNodeMapGetNode(hNodeMap, "Gain", &hGain);
{
printf("Unable to retrieve gain node. Aborting with error %d...\n\n", err);
}
if (!IsReadable(hGain))
{
printf("Unable to retrieve gain node. Aborting with error %d...\n\n", err);
}
err = spinFloatGetMax(hGain, &gainMax);
{
printf("Unable to retrieve maximum gain. Aborting with error %d...\n\n", err);
}
err = spinFloatGetMin(hGain, &gainMin);
{
printf("Unable to retrieve minimum gain. Aborting with error %d...\n\n", err);
}
// Set individual sequences
unsigned int sequenceNumber;
int64_t widthToSet = widthMax / 4;
int64_t heightToSet = heightMax / 4;
double exposureTimeToSet = exposureTimeMin;
double gainToSet = gainMin;
for (sequenceNumber = 0; sequenceNumber < k_numSequences; sequenceNumber++)
{
if (SetSingleState(hNodeMap, sequenceNumber, widthToSet, heightToSet, exposureTimeToSet, gainToSet) != 0)
{
}
widthToSet += widthMax / 10;
heightToSet += heightMax / 10;
exposureTimeToSet += exposureTimeMax / 10.0;
gainToSet += gainMax / 50.0;
}
// Calculate appropriate acquisition grab timeout window based on exposure time
// Note: exposureTimeToSet is in microseconds and needs to be converted to milliseconds
uint64_t timeout = (uint64_t)((exposureTimeToSet / 1000) + 1000);
// Configure sequencer to acquire images
if (ConfigureSequencerPartTwo(hNodeMap) != 0)
{
}
// Acquire images
if (AcquireImages(hCam, hNodeMap, hNodeMapTLDevice, timeout) != 0)
{
}
// Reset sequencer
if (ResetSequencer(hNodeMap) != 0)
{
}
// Deinitialize camera
err = spinCameraDeInit(hCam);
{
printf("Unable to deinitialize camera. Non-fatal error %d...\n\n", err);
}
return result;
}
// Example entry point; please see Enumeration_C example for more in-depth
// comments on preparing and cleaning up the system.
int main(/*int argc, char** argv*/)
{
int errReturn = 0;
spinError err = SPINNAKER_ERR_SUCCESS;
unsigned int i = 0;
// Since this application saves images in the current folder
// we must ensure that we have permission to write to this folder.
// If we do not have permission, fail right away.
FILE* tempFile;
tempFile = fopen("test.txt", "w+");
if (tempFile == NULL)
{
printf("Failed to create file in current folder. Please check "
"permissions.\n");
printf("Press Enter to exit...\n");
getchar();
}
fclose(tempFile);
remove("test.txt");
// Print application build information
printf("Application build date: %s %s \n\n", __DATE__, __TIME__);
// Retrieve singleton reference to system object
spinSystem hSystem = NULL;
err = spinSystemGetInstance(&hSystem);
{
printf("Unable to retrieve system instance. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
// Print out current library version
spinLibraryVersion hLibraryVersion;
spinSystemGetLibraryVersion(hSystem, &hLibraryVersion);
printf(
"Spinnaker library version: %d.%d.%d.%d\n\n",
hLibraryVersion.major,
hLibraryVersion.minor,
hLibraryVersion.type,
hLibraryVersion.build);
// Retrieve list of cameras from the system
spinCameraList hCameraList = NULL;
err = spinCameraListCreateEmpty(&hCameraList);
{
printf("Unable to create camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
err = spinSystemGetCameras(hSystem, hCameraList);
{
printf("Unable to retrieve camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
// Retrieve number of cameras
size_t numCameras = 0;
err = spinCameraListGetSize(hCameraList, &numCameras);
{
printf("Unable to retrieve number of cameras. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
printf("Number of cameras detected: %u\n\n", (unsigned int)numCameras);
// Finish if there are no cameras
if (numCameras == 0)
{
// Clear and destroy camera list before releasing system
err = spinCameraListClear(hCameraList);
{
printf("Unable to clear camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
err = spinCameraListDestroy(hCameraList);
{
printf("Unable to destroy camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
// Release system
err = spinSystemReleaseInstance(hSystem);
{
printf("Unable to release system instance. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
printf("Not enough cameras!\n");
printf("Done! Press Enter to exit...\n");
getchar();
return -1;
}
// Run example on each camera
for (i = 0; i < numCameras; i++)
{
printf("\nRunning example for camera %d...\n", i);
// Select camera
spinCamera hCamera = NULL;
err = spinCameraListGet(hCameraList, i, &hCamera);
{
printf("Unable to retrieve camera from list. Aborting with error %d...\n\n", err);
errReturn = -1;
}
else
{
// Run example
if (RunSingleCamera(hCamera) != 0)
{
errReturn = -1;
}
}
// Release camera
err = spinCameraRelease(hCamera);
{
errReturn = -1;
printf("Unable to release camera instance. Aborting with error %d...\n\n", err);
continue;
}
printf("Camera %d example complete...\n\n", i);
}
// Clear and destroy camera list before releasing system
err = spinCameraListClear(hCameraList);
{
printf("Unable to clear camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
err = spinCameraListDestroy(hCameraList);
{
printf("Unable to destroy camera list. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
// Release system
err = spinSystemReleaseInstance(hSystem);
{
printf("Unable to release system instance. Aborting with error %d...\n\n", err);
printf("\nDone! Press Enter to exit...\n");
getchar();
}
printf("\nDone! Press Enter to exit...\n");
getchar();
return errReturn;
}
spinCameraRelease
SPINNAKERC_API spinCameraRelease(spinCamera hCamera)
Releases a camera.
spinCameraGetNodeMap
SPINNAKERC_API spinCameraGetNodeMap(spinCamera hCamera, spinNodeMapHandle *phNodeMap)
Retrieves the GenICam nodemap from a camera.
spinImageGetWidth
SPINNAKERC_API spinImageGetWidth(spinImage hImage, size_t *pWidth)
Retrieves the width of an image.
SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR
@ SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR
Well-balanced speed and quality.
Definition: SpinnakerDefsC.h:322
spinCameraListClear
SPINNAKERC_API spinCameraListClear(spinCameraList hCameraList)
Clears a camera list.
spinImageIsIncomplete
SPINNAKERC_API spinImageIsIncomplete(spinImage hImage, bool8_t *pbIsIncomplete)
Checks whether an image is incomplete.
spinCameraEndAcquisition
SPINNAKERC_API spinCameraEndAcquisition(spinCamera hCamera)
Has a camera stop acquiring images.
spinFloatSetValue
SPINNAKERC_API spinFloatSetValue(spinNodeHandle hNode, double value)
Sets the value of a float node.
spinCameraBeginAcquisition
SPINNAKERC_API spinCameraBeginAcquisition(spinCamera hCamera)
Has a camera start acquiring images.
MAX_BUFF_LEN
#define MAX_BUFF_LEN
Definition: Sequencer_C.c:49
spinImageCreateEmpty
SPINNAKERC_API spinImageCreateEmpty(spinImage *phImage)
Creates an empty image; images created this way must be destroyed.
spinSystemReleaseInstance
SPINNAKERC_API spinSystemReleaseInstance(spinSystem hSystem)
Releases the system; make sure handle is cleaned up properly by setting it to NULL after system is re...
PrintRetrieveNodeFailure
void PrintRetrieveNodeFailure(char node[], char name[])
Definition: Sequencer_C.c:89
lastErrorMessage
char lastErrorMessage[MAX_BUFF_LEN]
Definition: Sequencer_C.c:51
GetLastErrorMessage
char * GetLastErrorMessage()
Definition: Sequencer_C.c:55
spinImage
void * spinImage
Handle for image functionality.
Definition: SpinnakerDefsC.h:91
spinFloatGetMax
SPINNAKERC_API spinFloatGetMax(spinNodeHandle hNode, double *pValue)
Retrieves the maximum value of a float node; all potential values must be lesser than or equal to the...
ConfigureSequencerPartTwo
int ConfigureSequencerPartTwo(spinNodeMapHandle hNodeMap)
Definition: Sequencer_C.c:740
spinErrorGetLastMessage
SPINNAKERC_API spinErrorGetLastMessage(char *pBuf, size_t *pBufLen)
Retrieves the error message of the last error.
spinSystemGetCameras
SPINNAKERC_API spinSystemGetCameras(spinSystem hSystem, spinCameraList hCameraList)
Retrieves a list of detected (and enumerable) cameras on the system; camera lists must be created and...
spinStringGetValue
SPINNAKERC_API spinStringGetValue(spinNodeHandle hNode, char *pBuf, size_t *pBufLen)
Retrieves the value of a string node as a c-string.
spinNodeMapHandle
void * spinNodeMapHandle
Handle for nodemap functionality.
Definition: SpinnakerGenApiDefsC.h:39
SpinnakerC.h
spinEnumerationSetIntValue
SPINNAKERC_API spinEnumerationSetIntValue(spinNodeHandle hEnumNode, int64_t value)
Sets a new entry using its integer value retrieved from a call to spinEnumerationEntryGetIntValue(); ...
spinNodeGetType
SPINNAKERC_API spinNodeGetType(spinNodeHandle hNode, spinNodeType *pType)
Retrieves the type of a node (as an enum, spinNodeType)
spinNodeGetName
SPINNAKERC_API spinNodeGetName(spinNodeHandle hNode, char *pBuf, size_t *pBufLen)
Retrieves the name of a node (no whitespace)
spinCategoryGetNumFeatures
SPINNAKERC_API spinCategoryGetNumFeatures(spinNodeHandle hCategoryNode, size_t *pValue)
Retrieves the number of a features (or child nodes) or a category node.
spinEnumerationEntryGetIntValue
SPINNAKERC_API spinEnumerationEntryGetIntValue(spinNodeHandle hNode, int64_t *pValue)
Retrieves the integer value of an entry node; note that enumeration entry int and enum values are dif...
IsWritable
bool8_t IsWritable(spinNodeHandle hNode)
Definition: Sequencer_C.c:76
PrintDeviceInfo
int PrintDeviceInfo(spinNodeMapHandle hNodeMap)
Definition: Sequencer_C.c:1132
ResetSequencer
int ResetSequencer(spinNodeMapHandle hNodeMap)
Definition: Sequencer_C.c:945
spinImageGetHeight
SPINNAKERC_API spinImageGetHeight(spinImage hImage, size_t *pHeight)
Retrieves the height of an image.
spinImageDestroy
SPINNAKERC_API spinImageDestroy(spinImage hImage)
Destroys an image.
spinSystemGetLibraryVersion
SPINNAKERC_API spinSystemGetLibraryVersion(spinSystem hSystem, spinLibraryVersion *hLibraryVersion)
Get current library version of Spinnaker.
RunSingleCamera
int RunSingleCamera(spinCamera hCam)
Definition: Sequencer_C.c:1509
SPINNAKER_ERR_ACCESS_DENIED
@ SPINNAKER_ERR_ACCESS_DENIED
Definition: SpinnakerDefsC.h:243
spinCommandExecute
SPINNAKERC_API spinCommandExecute(spinNodeHandle hNode)
Executes the action associated to a command node.
spinSystem
void * spinSystem
Handle for system functionality.
Definition: SpinnakerDefsC.h:51
spinImageProcessor
void * spinImageProcessor
Handle for image processor functionality.
Definition: SpinnakerDefsC.h:107
spinCameraInit
SPINNAKERC_API spinCameraInit(spinCamera hCamera)
Initializes a camera, allowing for much more interaction.
False
static const bool8_t False
Definition: SpinnakerDefsC.h:36
spinIntegerSetValue
SPINNAKERC_API spinIntegerSetValue(spinNodeHandle hNode, int64_t value)
Sets the value of an integer node.
spinIntegerGetMax
SPINNAKERC_API spinIntegerGetMax(spinNodeHandle hNode, int64_t *pValue)
Retrieves the maximum value of an integer node; all potential values must be lesser than or equal to ...
spinImageProcessorConvert
SPINNAKERC_API spinImageProcessorConvert(spinImageProcessor hImageProcessor, spinImage hSrcImage, spinImage hDestImage, spinPixelFormatEnums destFormat)
Converts the source image buffer to the specified destination pixel format and stores the result in t...
spinImageProcessorSetColorProcessing
SPINNAKERC_API spinImageProcessorSetColorProcessing(spinImageProcessor hImageProcessor, spinColorProcessingAlgorithm colorAlgorithm)
Sets the color processing algorithm used at the time of the spinImageProcessorConvert() call,...
spinCameraListDestroy
SPINNAKERC_API spinCameraListDestroy(spinCameraList hCameraList)
Destroys a camera list.
SPINNAKER_ERR_ERROR
@ SPINNAKER_ERR_ERROR
The error codes in the range of -1000 to -1999 are reserved for Spinnaker exceptions.
Definition: SpinnakerDefsC.h:239
UnknownNode
@ UnknownNode
Definition: SpinnakerGenApiDefsC.h:85
spinIntegerGetInc
SPINNAKERC_API spinIntegerGetInc(spinNodeHandle hNode, int64_t *pValue)
Retrieves the increment of an integer node; all possible values must be divisible by the increment.
spinNodeIsWritable
SPINNAKERC_API spinNodeIsWritable(spinNodeHandle hNode, bool8_t *pbResult)
Checks whether a node is writable.
spinCameraList
void * spinCameraList
Handle for interface functionality.
Definition: SpinnakerDefsC.h:75
spinImageProcessorDestroy
SPINNAKERC_API spinImageProcessorDestroy(spinImageProcessor hImageProcessor)
Destroys a image list.
spinSystemGetInstance
SPINNAKERC_API spinSystemGetInstance(spinSystem *phSystem)
Retrieves an instance of the system object; the system is a singleton, so there will only ever be one...
main
int main()
Definition: Sequencer_C.c:1736
SPINNAKER_IMAGE_FILE_FORMAT_JPEG
@ SPINNAKER_IMAGE_FILE_FORMAT_JPEG
JPEG.
Definition: SpinnakerDefsC.h:355
SPINNAKER_IMAGE_STATUS_NO_ERROR
@ SPINNAKER_IMAGE_STATUS_NO_ERROR
Image is returned from GetNextImage() call without any errors.
Definition: SpinnakerDefsC.h:388
spinCameraGetNextImageEx
SPINNAKERC_API spinCameraGetNextImageEx(spinCamera hCamera, uint64_t grabTimeout, spinImage *phImage)
Retrieves an image from a camera; manually set the timeout in milliseconds.
spinCameraListGet
SPINNAKERC_API spinCameraListGet(spinCameraList hCameraList, size_t index, spinCamera *phCamera)
Retrieves a camera from a camera list using an index.
ConfigureSequencerPartOne
int ConfigureSequencerPartOne(spinNodeMapHandle hNodeMap)
Definition: Sequencer_C.c:100
bool8_t
uint8_t bool8_t
Definition: SpinnakerDefsC.h:35
spinCamera
void * spinCamera
Handle for camera functionality.
Definition: SpinnakerDefsC.h:82
spinFloatGetMin
SPINNAKERC_API spinFloatGetMin(spinNodeHandle hNode, double *pValue)
Retrieves the minimum value of a float node; all potential values must be greater than or equal to th...
spinNodeHandle
void * spinNodeHandle
Handle for node functionality.
Definition: SpinnakerGenApiDefsC.h:45
IsReadable
bool8_t IsReadable(spinNodeHandle hNode)
Definition: Sequencer_C.c:64
spinNodeIsReadable
SPINNAKERC_API spinNodeIsReadable(spinNodeHandle hNode, bool8_t *pbResult)
Checks whether a node is readable.
SetSingleState
int SetSingleState(spinNodeMapHandle hNodeMap, unsigned int sequenceNumber, int64_t widthToSet, int64_t heightToSet, double exposureTimeToSet, double gainToSet)
Definition: Sequencer_C.c:421
spinEnumerationGetEntryByName
SPINNAKERC_API spinEnumerationGetEntryByName(spinNodeHandle hEnumNode, const char *pName, spinNodeHandle *phEntry)
Retrieves an entry node from an enum node using the entry's symbolic.
spinEnumerationGetCurrentEntry
SPINNAKERC_API spinEnumerationGetCurrentEntry(spinNodeHandle hEnumNode, spinNodeHandle *phEntry)
Retrieves the currently selected entry node from an enum node.
spinImageSave
SPINNAKERC_API spinImageSave(spinImage hImage, const char *pFilename, spinImageFileFormat format)
Saves an image using a specified file format (using an enum, spinImageFileFormat)
spinNodeMapGetNode
SPINNAKERC_API spinNodeMapGetNode(spinNodeMapHandle hNodeMap, const char *pName, spinNodeHandle *phNode)
Retrieves a node from the nodemap by name.
spinCameraListGetSize
SPINNAKERC_API spinCameraListGetSize(spinCameraList hCameraList, size_t *pSize)
Retrieves the number of cameras on a camera list.
spinCameraDeInit
SPINNAKERC_API spinCameraDeInit(spinCamera hCamera)
Deinitializes a camera, greatly reducing functionality.
spinCameraGetTLDeviceNodeMap
SPINNAKERC_API spinCameraGetTLDeviceNodeMap(spinCamera hCamera, spinNodeMapHandle *phNodeMap)
Retrieves the transport layer device nodemap from a camera.
spinImageProcessorCreate
SPINNAKERC_API spinImageProcessorCreate(spinImageProcessor *phImageProcessor)
Creates an image processor.
AcquireImages
int AcquireImages(spinCamera hCam, spinNodeMapHandle hNodeMap, spinNodeMapHandle hNodeMapTLDevice, uint64_t timeout)
Definition: Sequencer_C.c:1219
True
static const bool8_t True
Definition: SpinnakerDefsC.h:37
spinCategoryGetFeatureByIndex
SPINNAKERC_API spinCategoryGetFeatureByIndex(spinNodeHandle hCategoryNode, size_t index, spinNodeHandle *phFeature)
Retrieves a node from a category node using an index.
spinImageRelease
SPINNAKERC_API spinImageRelease(spinImage hImage)
Releases an image.
lenLastErrorMessage
size_t lenLastErrorMessage
Definition: Sequencer_C.c:52
spinImageGetStatus
SPINNAKERC_API spinImageGetStatus(spinImage hImage, spinImageStatus *pStatus)
Retrieves the image status of an image.
SPINNAKER_ERR_SUCCESS
@ SPINNAKER_ERR_SUCCESS
An error code of 0 means that the function has run without error.
Definition: SpinnakerDefsC.h:233
spinCameraListCreateEmpty
SPINNAKERC_API spinCameraListCreateEmpty(spinCameraList *phCameraList)
Creates an empty camera list (camera lists created this way must be destroyed)
spinNodeToString
SPINNAKERC_API spinNodeToString(spinNodeHandle hNode, char *pBuf, size_t *pBufLen)
Retrieves the value of any node type as a c-string.
PixelFormat_Mono8
@ PixelFormat_Mono8
Definition: CameraDefsC.h:732