# coding=utf-8
# =============================================================================
# Copyright (c) 2026 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.
# =============================================================================
#
# AcquisitionGenDC.py demonstrates how to acquire multi-component images using
# the GenDC (Generic Data Container) payload format. This example is specifically for
# cameras that support GenDC.
#
# GenDC is a standardized container format that allows cameras to transmit multiple
# data components (images, metadata, etc.) in a single synchronized payload. This is
# useful for multi-sensor cameras, stereo cameras, or cameras with multiple data streams
# such as intensity + depth.
#
# This example relies on information provided in the Enumeration example. Also check out
# the ExceptionHandling and NodeMapInfo examples if you haven't already. For standard
# single-image acquisition, see the Acquisition example.
#
# 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
import os
import PySpin
import sys
# Component selection toggles for GenDC acquisition
# These flags control which components are enabled during GenDC acquisition
ENABLE_COMPONENT_0 = True # Typically intensity/main image component
ENABLE_COMPONENT_1 = True # Additional component such as depth or range image (if available)
NUM_IMAGE_SETS = 10 # number of GenDC image sets to grab
def image_payload_type_to_string(payload_type):
"""
Convert ImagePayloadType enum value to string name.
:param payload_type: The ImagePayloadType enum value.
:type payload_type: int
:return: String representation of the payload type.
:rtype: str
"""
payload_type_map = {
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_UNKNOWN: "SPINNAKER_IMAGE_PAYLOAD_TYPE_UNKNOWN",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_IMAGE: "SPINNAKER_IMAGE_PAYLOAD_TYPE_IMAGE",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_EXTENDED_CHUNK: "SPINNAKER_IMAGE_PAYLOAD_TYPE_EXTENDED_CHUNK",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_JPEG: "SPINNAKER_IMAGE_PAYLOAD_TYPE_JPEG",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_LOSSLESS_COMPRESSED: "SPINNAKER_IMAGE_PAYLOAD_TYPE_LOSSLESS_COMPRESSED",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_LOSSY_COMPRESSED: "SPINNAKER_IMAGE_PAYLOAD_TYPE_LOSSY_COMPRESSED",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_JPEG_LOSSLESS_COMPRESSED: "SPINNAKER_IMAGE_PAYLOAD_TYPE_JPEG_LOSSLESS_COMPRESSED",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR1: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR1",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR2: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR2",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RECTIFIED_SENSOR1: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RECTIFIED_SENSOR1",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RECTIFIED_SENSOR2: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RECTIFIED_SENSOR2",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_DISPARITY_SENSOR1: "SPINNAKER_IMAGE_PAYLOAD_TYPE_DISPARITY_SENSOR1",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_GENDC_GENERIC: "SPINNAKER_IMAGE_PAYLOAD_TYPE_GENDC_GENERIC",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RANGE_SENSOR1: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RANGE_SENSOR1",
PySpin.SPINNAKER_IMAGE_PAYLOAD_TYPE_RANGE_SENSOR2: "SPINNAKER_IMAGE_PAYLOAD_TYPE_RANGE_SENSOR2",
}
return payload_type_map.get(payload_type, "UNKNOWN (%d)" % payload_type)
def configure_gvcp_heartbeat(cam, enable_heartbeat):
"""
This function configures the GVCP heartbeat for GEV cameras.
:param cam: Camera to configure heartbeat.
:param enable_heartbeat: Enable or disable the heartbeat.
:type cam: CameraPtr
:type enable_heartbeat: bool
:return: True if successful, False otherwise.
:rtype: bool
"""
# Retrieve TL device nodemap
nodemap_tldevice = cam.GetTLDeviceNodeMap()
# Retrieve GenICam nodemap
nodemap = cam.GetNodeMap()
# Check if this is a GEV camera
node_device_type = PySpin.CEnumerationPtr(nodemap_tldevice.GetNode('DeviceType'))
if not PySpin.IsReadable(node_device_type):
return True
if node_device_type.GetIntValue() != PySpin.DeviceType_GigEVision:
return True
if enable_heartbeat:
print('\nResetting heartbeat...\n')
else:
print('\nDisabling heartbeat...\n')
node_heartbeat = PySpin.CBooleanPtr(nodemap.GetNode('GevGVCPHeartbeatDisable'))
if not PySpin.IsWritable(node_heartbeat):
print('Unable to configure heartbeat. Continuing with execution as this may be non-fatal...\n')
else:
node_heartbeat.SetValue(not enable_heartbeat)
if not enable_heartbeat:
print('WARNING: Heartbeat has been disabled for the rest of this example run.')
print(' Heartbeat will be reset upon the completion of this run. If the')
print(' example is aborted unexpectedly before the heartbeat is reset, the')
print(' camera may need to be power cycled to reset the heartbeat.\n')
else:
print('Heartbeat has been reset.\n')
return True
def configure_gendc(cam, nodemap):
"""
This function checks if the camera supports GenDC and configures component selection.
:param cam: Camera to configure.
:param nodemap: Device nodemap.
:type cam: CameraPtr
:type nodemap: INodeMap
:return: True if successful, False otherwise.
:rtype: bool
"""
print('\n*** CONFIGURING GENDC ***')
try:
#
# Check for GenDC support by looking for GenDC-specific nodes
#
# *** NOTES ***
# GenDC cameras expose specific Transport Layer Control nodes for GenDC streaming:
# GenDCStreamingMode and GenDCStreamingStatus. These nodes are part of the camera's
# GenICam nodemap (obtained via GetNodeMap()) and are required for multi-component image acquisition.
#
print('\nChecking camera GenDC support...')
node_gendc_streaming_mode = PySpin.CEnumerationPtr(nodemap.GetNode('GenDCStreamingMode'))
node_gendc_streaming_status = PySpin.CEnumerationPtr(nodemap.GetNode('GenDCStreamingStatus'))
if not PySpin.IsReadable(node_gendc_streaming_mode) or not PySpin.IsReadable(node_gendc_streaming_status):
# Retrieve TL device nodemap to get serial number
nodemap_tldevice = cam.GetTLDeviceNodeMap()
node_serial = PySpin.CStringPtr(nodemap_tldevice.GetNode('DeviceSerialNumber'))
serial_number = ''
if PySpin.IsReadable(node_serial):
serial_number = node_serial.GetValue()
print('Device serial number %s is not a valid GenDC camera. Skipping...' % serial_number)
return False
#
# Display GenDC streaming mode
#
# *** NOTES ***
# GenDCStreamingMode indicates the current mode of GenDC streaming.
# This could include values like "Off", "On", "Automatic", or other streaming modes
# depending on the camera implementation.
#
if PySpin.IsReadable(node_gendc_streaming_mode):
current_mode = node_gendc_streaming_mode.GetCurrentEntry()
if PySpin.IsReadable(current_mode):
print(' GenDC Streaming Mode: %s' % current_mode.GetSymbolic())
if current_mode.GetSymbolic() == "Off":
print(" GenDC streaming is currently off. Setting GenDC Streaming Mode to 'On'...")
if not PySpin.IsWritable(node_gendc_streaming_mode):
print("Unable to set GenDC Streaming Mode to 'On'. GenDCStreamingMode is not Writable. Skipping...")
return False
on_mode = node_gendc_streaming_mode.GetEntryByName("On")
if PySpin.IsReadable(on_mode):
node_gendc_streaming_mode.SetIntValue(on_mode.GetValue())
new_mode = node_gendc_streaming_mode.GetCurrentEntry()
print(" GenDC Streaming Mode now set to : %s" % new_mode.GetSymbolic())
else:
print("Unable to set GenDC Streaming Mode to 'On' (entry retrieval). Skipping...")
return False
#
# Display GenDC streaming status
#
# *** NOTES ***
# GenDCStreamingStatus indicates the current status of GenDC streaming.
# This provides information about whether GenDC streaming is active,
# ready, or in another state.
#
if PySpin.IsReadable(node_gendc_streaming_status):
current_status = node_gendc_streaming_status.GetCurrentEntry()
if PySpin.IsReadable(current_status):
print(' GenDC Streaming Status: %s' % current_status.GetSymbolic())
if current_status.GetSymbolic() != "On":
print(' GenDC Streaming Status is not On. Skipping...')
return False
#
# Configure components if ComponentSelector is available
#
# *** NOTES ***
# If the camera exposes ComponentSelector and ComponentEnable nodes,
# we can configure individual components. Otherwise, GenDC streaming
# will use the default component configuration.
#
node_component_selector = PySpin.CEnumerationPtr(nodemap.GetNode('ComponentSelector'))
node_component_enable = PySpin.CBooleanPtr(nodemap.GetNode('ComponentEnable'))
if PySpin.IsReadable(node_component_selector) and PySpin.IsReadable(node_component_enable):
print('\nConfiguring GenDC components...')
component_entries = node_component_selector.GetEntries()
if len(component_entries) == 0:
print('Warning: No components available for selection.')
else:
print(' Available components: %d' % len(component_entries))
for i in range(len(component_entries)):
component_entry = PySpin.CEnumEntryPtr(component_entries[i])
if PySpin.IsReadable(component_entry):
# Select the component
node_component_selector.SetIntValue(component_entry.GetValue())
component_name = component_entry.GetSymbolic()
print(' Component %d: %s - ' % (i, component_name), end='')
# Enable/disable component based on toggle
if PySpin.IsWritable(node_component_enable):
enable_component = True
# This example only demonstrates toggling two components;
# for cameras with more components, extend this logic as needed.
if i == 0:
enable_component = ENABLE_COMPONENT_0
elif i == 1:
enable_component = ENABLE_COMPONENT_1
node_component_enable.SetValue(enable_component)
print('Enabled' if enable_component else 'Disabled')
else:
print('ComponentEnable not writable for this component')
else:
print('\nComponentSelector/ComponentEnable not available.')
print('Using default component configuration.')
print('\nGenDC configuration complete.')
except PySpin.SpinnakerException as ex:
print('ERROR: Exception during GenDC configuration: %s' % ex)
return False
return True
def acquire_gendc_images(cam, nodemap, nodemap_tldevice):
"""
This function acquires and saves 10 GenDC image sets from a device.
:param cam: Camera to acquire images from.
:param nodemap: Device nodemap.
:param nodemap_tldevice: Transport layer device nodemap.
:type cam: CameraPtr
:type nodemap: INodeMap
:type nodemap_tldevice: INodeMap
:return: True if successful, False otherwise.
:rtype: bool
"""
print('\n\n*** GENDC IMAGE ACQUISITION ***\n')
try:
result = True
#
# Set acquisition mode to continuous
#
# *** NOTES ***
# Because the example acquires and saves 10 image sets, setting acquisition
# mode to continuous lets the example finish. If set to single frame
# or multiframe (at a lower number of images), the example would just
# hang. This would happen because the example has been written to
# acquire 10 image sets while the camera would have been programmed to
# retrieve less than that.
#
# Setting the value of an enumeration node is slightly more complicated
# than other node types. Two nodes must be retrieved: first, the
# enumeration node is retrieved from the nodemap; and second, the entry
# node is retrieved from the enumeration node. The integer value of the
# entry node is then set as the new value of the enumeration node.
#
# Notice that both the enumeration and the entry nodes are checked for
# availability and readability/writability. Enumeration nodes are
# generally readable and writable whereas their entry nodes are only
# ever readable.
#
# Retrieve enumeration node from nodemap
node_acquisition_mode = PySpin.CEnumerationPtr(nodemap.GetNode('AcquisitionMode'))
if not PySpin.IsReadable(node_acquisition_mode) or not PySpin.IsWritable(node_acquisition_mode):
print('Unable to set acquisition mode to continuous (enum retrieval). Aborting...\n')
return False
# Retrieve entry node from enumeration node
node_acquisition_mode_continuous = node_acquisition_mode.GetEntryByName('Continuous')
if not PySpin.IsReadable(node_acquisition_mode_continuous):
print('Unable to set acquisition mode to continuous (entry retrieval). Aborting...\n')
return False
# Retrieve integer value from entry node
acquisition_mode_continuous = node_acquisition_mode_continuous.GetValue()
# Set integer value from entry node as new value of enumeration node
node_acquisition_mode.SetIntValue(acquisition_mode_continuous)
print('Acquisition mode set to continuous...')
#
# Begin acquiring images
#
# *** NOTES ***
# What happens when the camera begins acquiring images depends on the
# acquisition mode. Single frame captures only a single image, multi
# frame captures a set number of images, and continuous captures a
# continuous stream of images. Because the example calls for the
# retrieval of 10 image sets, continuous mode has been set.
#
# *** LATER ***
# Image acquisition must be ended when no more images are needed.
#
cam.BeginAcquisition()
print('Acquiring GenDC image sets...')
#
# Retrieve device serial number for filename
#
# *** NOTES ***
# The device serial number is retrieved in order to keep cameras from
# overwriting one another. Grabbing image IDs could also accomplish
# this.
#
device_serial_number = ''
node_device_serial_number = PySpin.CStringPtr(nodemap_tldevice.GetNode('DeviceSerialNumber'))
if PySpin.IsReadable(node_device_serial_number):
device_serial_number = node_device_serial_number.GetValue()
print('Device serial number retrieved as %s...' % device_serial_number)
print('')
#
# Create ImageProcessor instance for post processing images
#
processor = PySpin.ImageProcessor()
#
# 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.
#
processor.SetColorProcessing(PySpin.SPINNAKER_COLOR_PROCESSING_ALGORITHM_HQ_LINEAR)
for image_cnt in range(NUM_IMAGE_SETS):
try:
#
# Retrieve next synchronized GenDC ImageList
#
# *** NOTES ***
# GetNextImageSync() is specifically designed for multi-stream/multi-component cameras.
# It returns an ImageList containing synchronized images from all enabled streams/components.
# Each image in the list represents a different component from the GenDC container.
#
# The ImageList object is a container for one or more ImagePtr objects, where each
# image corresponds to a component in the GenDC container. All components in the list
# are synchronized by frame ID, ensuring temporal consistency.
#
# This function will block for the specified timeout period until images from all
# enabled components arrive.
#
# IMPORTANT: GetNextImageSync() cannot be used together with GetNextImage(). Using
# both will result in indeterministic behavior and could lead to missing or lost images.
#
# *** LATER ***
# Once images from the ImageList are saved and/or no longer needed, the ImageList
# must be released in order to keep the buffers from filling up.
#
image_list = cam.GetNextImageSync(1000)
component_count = image_list.GetSize()
print('Grabbed GenDC ImageList %d, components: %d' % (image_cnt, component_count))
#
# Validate that we received components
#
if component_count == 0:
print(' Warning: Received empty ImageList')
image_list.Release()
continue
#
# Process each component in the ImageList
#
# *** NOTES ***
# Each image in the ImageList represents a component from the GenDC container.
# Components are synchronized by frame ID and can have different dimensions,
# pixel formats, and payload types.
#
# Common component types include:
# - SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR1: Primary intensity image
# - SPINNAKER_IMAGE_PAYLOAD_TYPE_RAW_SENSOR2: Secondary intensity image
# - SPINNAKER_IMAGE_PAYLOAD_TYPE_RANGE_SENSOR1: Range/depth data
# - SPINNAKER_IMAGE_PAYLOAD_TYPE_DISPARITY_SENSOR1: Disparity data
# - SPINNAKER_IMAGE_PAYLOAD_TYPE_EXTENDED_CHUNK: Extended chunk metadata
#
for component_idx in range(component_count):
try:
# Get the component image from the ImageList
component_image = image_list.GetByIndex(component_idx)
#
# Check component completion status
#
if component_image.IsIncomplete():
print(' Component %d incomplete with image status %d ...' %
(component_idx, component_image.GetImageStatus()))
continue
#
# Retrieve component information
#
# *** NOTES ***
# Each component has its own metadata: e.g. dimensions, pixel format,
# payload type, frame ID, and timestamp. This information is useful for
# understanding what type of data each component contains.
#
width = component_image.GetWidth()
height = component_image.GetHeight()
image_payload_type = component_image.GetImagePayloadType()
image_payload_type_name = image_payload_type_to_string(image_payload_type)
pixel_format = component_image.GetPixelFormat()
frame_id = component_image.GetFrameID()
timestamp = component_image.GetTimeStamp()
print(' Component %d: %dx%d' % (component_idx, width, height))
print(' Image Payload Type: %s' % image_payload_type_name)
print(' Pixel Format: %s' % component_image.GetPixelFormatName())
print(' Frame ID: %d, Timestamp: %d' % (frame_id, timestamp))
#
# Convert component image to Mono8 for saving
#
# *** NOTES ***
# Components can be converted between pixel formats just like standard images.
# The converted image does not need to be released as it does not affect the
# camera buffer.
#
converted_image = processor.Convert(component_image, PySpin.PixelFormat_Mono8)
#
# Create filename with component index
#
# *** NOTES ***
# We include the component index in the filename to distinguish between
# different components from the same GenDC container. This allows you to
# see which files correspond to which data streams.
#
if device_serial_number:
filename = 'AcquisitionGenDC-%s-Frame%d-Component%d.jpg' % \
(device_serial_number, image_cnt, component_idx)
else:
filename = 'AcquisitionGenDC-Frame%d-Component%d.jpg' % \
(image_cnt, component_idx)
# Save the component image
converted_image.Save(filename)
print(' Saved: %s' % filename)
except PySpin.SpinnakerException as ex:
print(' Error processing component %d: %s' % (component_idx, ex))
#
# Release ImageList
#
# *** NOTES ***
# ImageLists retrieved from GetNextImageSync() must be released to keep
# the buffers from filling up. Releasing the ImageList releases all images
# contained within it.
#
image_list.Release()
print('')
except PySpin.SpinnakerException as ex:
print('Error: %s' % ex)
result = False
#
# End acquisition
#
# *** NOTES ***
# Ending acquisition appropriately helps ensure that devices clean up
# properly and do not need to be power-cycled to maintain integrity.
#
cam.EndAcquisition()
except PySpin.SpinnakerException as ex:
print('Error: %s' % ex)
return False
return result
def print_device_info(nodemap):
"""
This function prints the device information of the camera from the transport
layer; please see NodeMapInfo example for more in-depth comments on printing
device information from the nodemap.
:param nodemap: Transport layer device nodemap.
:type nodemap: INodeMap
:returns: True if successful, False otherwise.
:rtype: bool
"""
print('*** DEVICE INFORMATION ***\n')
try:
result = True
node_device_information = PySpin.CCategoryPtr(nodemap.GetNode('DeviceInformation'))
if PySpin.IsReadable(node_device_information):
features = node_device_information.GetFeatures()
for feature in features:
node_feature = PySpin.CValuePtr(feature)
print('%s: %s' % (node_feature.GetName(),
node_feature.ToString() if PySpin.IsReadable(node_feature) else 'Node not readable'))
else:
print('Device control information not readable.')
except PySpin.SpinnakerException as ex:
print('Error: %s' % ex)
return False
return result
def run_single_camera(cam):
"""
This function acts as the body of the example; please see NodeMapInfo example
for more in-depth comments on setting up cameras.
:param cam: Camera to run on.
:type cam: CameraPtr
:return: True if successful, False otherwise.
:rtype: bool
"""
try:
result = True
# Retrieve TL device nodemap and print device information
nodemap_tldevice = cam.GetTLDeviceNodeMap()
result &= print_device_info(nodemap_tldevice)
# Initialize camera
cam.Init()
# Retrieve GenICam nodemap
nodemap = cam.GetNodeMap()
# Configure GenDC components - exit if not supported
if not configure_gendc(cam, nodemap):
cam.DeInit()
return False
# Configure heartbeat for GEV camera
# In debug mode, disable heartbeat; otherwise reset it
if sys.gettrace() is not None:
result &= configure_gvcp_heartbeat(cam, False)
else:
result &= configure_gvcp_heartbeat(cam, True)
# Acquire images
result &= acquire_gendc_images(cam, nodemap, nodemap_tldevice)
# Reset heartbeat for GEV camera (if it was disabled)
if sys.gettrace() is not None:
result &= configure_gvcp_heartbeat(cam, True)
# Deinitialize camera
cam.DeInit()
except PySpin.SpinnakerException as ex:
print('Error: %s' % ex)
result = False
return result
def main():
"""
Example entry point; please see Enumeration example for more in-depth
comments on preparing and cleaning up the system.
:return: True if successful, False otherwise.
:rtype: bool
"""
# 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.
try:
test_file = open('test.txt', 'w+')
except IOError:
print('Unable to write to current directory. Please check permissions.')
input('Press Enter to exit...')
return False
test_file.close()
os.remove(test_file.name)
result = True
# Print GenDC component configuration status
print('*** GENDC COMPONENT CONFIGURATION ***')
print('Component 0 (Primary): %s' % ('ENABLED' if ENABLE_COMPONENT_0 else 'DISABLED'))
print('Component 1 (Secondary): %s' % ('ENABLED' if ENABLE_COMPONENT_1 else 'DISABLED'))
print('')
print('NOTE: To change component settings, modify the flags at the top of the source file:')
print(' - ENABLE_COMPONENT_0: Enable/disable primary component')
print(' - ENABLE_COMPONENT_1: Enable/disable secondary component')
print('')
print('IMPORTANT: This example requires a camera with GenDC support.')
print(' For standard single-image acquisition, use the Acquisition example.')
print('')
# Retrieve singleton reference to system object
system = PySpin.System.GetInstance()
# Get current library version
version = system.GetLibraryVersion()
print('Library version: %d.%d.%d.%d' % (version.major, version.minor, version.type, version.build))
# Retrieve list of cameras from the system
cam_list = system.GetCameras()
num_cameras = cam_list.GetSize()
print('Number of cameras detected: %d\n' % num_cameras)
# Finish if there are no cameras
if num_cameras == 0:
# Clear camera list before releasing system
cam_list.Clear()
# Release system instance
system.ReleaseInstance()
print('Not enough cameras!')
input('Done! Press Enter to exit...')
return False
# Run example on each camera
for i, cam in enumerate(cam_list):
print('\nRunning example for camera %d...' % i)
result &= run_single_camera(cam)
print('Camera %d example complete...\n' % i)
# Release reference to camera
# NOTE: Unlike the C++ examples, we cannot rely on pointer objects being automatically
# cleaned up when going out of scope.
# The usage of del is preferred to assigning the variable to None.
del cam
# Clear camera list before releasing system
cam_list.Clear()
# Release system instance
system.ReleaseInstance()
print('\nDone! Press Enter to exit...')
input()
return result
if __name__ == '__main__':
if main():
sys.exit(0)
else:
sys.exit(1)