Skip to content

C# (.NET) Examples

Ready-to-run examples shipped with the Spinnaker SDK. Source files are located under src/{ExampleName}/ in the SDK source tree.

Standard Examples

Example Description
Acquisition_CSharp.cs Acquisition_CSharp.cs demonstrates the acquisition of images. It relies on information provided in the Enumeration_CSharp example. Following this, check out the ExceptionHandling_CSharp and NodeMapInfo_CSharp examples if you haven't already. ExceptionHandling_CSharp shows how to handle standard and Spinnaker exceptions while NodeMapInfo_CSharp explores retrieving information from various node types.
AcquisitionMultipleCamera_CSharp.cs AcquisitionMultipleCamera_CSharp.cs shows how to capture images from multiple cameras simultaneously. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
AcquisitionMultipleThread_CSharp.cs AcquisitionMultipleThread_CSharp.cs shows how to capture images from multiple cameras simultaneously on multiple threads. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
AcquisitionUserBuffer_CSharp.cs
BufferHandling_CSharp.cs
ChunkData_CSharp.cs ChunkData_CSharp.cs shows how to get chunk data on an image, either from the nodemap or from the image itself. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
CounterAndTimer_CSharp.cs CounterAndTimer_CSharp.cs shows how to setup a Pulse Width Modulation (PWM) signal using counters and timers. The camera will output the PWM signal via strobe, and capture images at a rate defined by the PWM signal as well. Users should take care to use a PWM signal within the camera's max framerate (by default, the PWM signal is set to 50 Hz).
Enumeration_CSharp.cs Enumeration_CSharp.cs shows how to enumerate interfaces and cameras. Knowing this is mandatory for doing anything with the Spinnaker SDK, and is therefore the best place to start learning how to use the SDK.
EnumerationEvents_CSharp.cs EnumerationEvents_CSharp.cs explores arrival and removal events on interfaces and the system. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
ExceptionHandling_CSharp.cs
Exposure_CSharp.cs Exposure_CSharp.cs shows how to set a custom exposure time on a device. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
ImageEvents_CSharp.cs ImageEvents_CSharp.cs shows how to acquire images using the image event handler. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
ImageFormatControl_CSharp.cs ImageFormatControl_CSharp.cs shows how to apply custom image settings to the camera. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
Inference_CSharp.cs Inference_CSharp.cs shows how to perform the following: - Upload custom inference neural networks to the camera (DDR or Flash) - Inject sample test image - Enable/Configure chunk data - Enable/Configure trigger inference ready sync - Acquire images - Display inference data from acquired image chunk data - Disable previously configured camera configurations
Logging_CSharp.cs Logging_CSharp.cs shows how to log events on the system. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
LookupTable_CSharp.cs LookupTable_CSharp.cs shows how to configure lookup tables on the camera. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
NodeMapCallback_CSharp.cs NodeMapCallback_CSharp.cs shows how to use GenICam-defined callbacks. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples. As callbacks are very similar to events, it may be a good idea to explore this example prior to tackling the events examples.
NodeMapInfo_CSharp.cs NodeMapInfo_CSharp.cs shows how to retrieve node map information. It relies on information provided in the Enumeration_CSharp example. Following this, check out the Acquisition_CSharp and ExceptionHandling_CSharp example if you haven't already. It explores acquiring images.
Polarization_CSharp.cs Polarization_CSharp.cs shows how to extract and create images from a source image of Polarized8 or BayerRGPolarized8 pixel format using methods from the ImageUtilityPolarization, ImageUtility and ImageUtilityHeatmap classes. It relies on information provided in the Enumeration, Acquisition, and NodeMapInfo examples.
SaveToVideo_CSharp.cs SaveToVideo_CSharp.cs shows how to create a video from a list of images. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
Sequencer_CSharp.cs Sequencer_CSharp.cs shows how to use the sequencer to grab images with various settings. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
Trigger_CSharp.cs Trigger_CSharp.cs shows how to trigger the camera. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.

QuickSpin Examples

The QuickSpin API provides a simplified, type-safe interface to common camera properties without requiring direct GenICam node access.

Example Description
Enumeration_CSharp_QuickSpin.cs Enumeration_CSharp_QuickSpin.cs shows how to enumerate interfaces and cameras using the QuickSpin API. QuickSpin is a subset of the Spinnaker library that allows for simpler node access and control. This is a great example to start learning about QuickSpin.
Exposure_CSharp_QuickSpin.cs Exposure_CSharp_QuickSpin.cs shows how to customize image exposure time using the QuickSpin API. QuickSpin is a subset of the Spinnaker library that allows for simpler node access and control.
ImageFormatControl_CSharp_QuickSpin.cs ImageFormatControl_CSharp.cs shows how to apply custom image settings to the camera. It relies on information provided in the Enumeration_CSharp, Acquisition_CSharp, and NodeMapInfo_CSharp examples.
NodeMapInfo_CSharp_QuickSpin.cs NodeMapInfo_CSharp_QuickSpin.cs shows how to interact with nodes using the QuickSpin API. QuickSpin is a subset of the Spinnaker library that allows for simpler node access and control.
Trigger_CSharp_QuickSpin.cs Trigger_CSharp_QuickSpin.cs shows how to capture images with the trigger using the QuickSpin API. QuickSpin is a subset of the Spinnaker library that allows for simpler node access and control.