Code Samples

Not sure where to start with the DELTA SDK? Start with the code examples prepared here.

The examples are organized by feature so that each SDK workflow can be tested as easily as possible. Each sample is written as a single main function, so you can build and run it directly to check event data, streaming output, playback, saving, and processing results. The examples also show how to use DVS event data in several output formats designed for event-based vision applications. See the categorized list below to choose the example that matches your use case.

For lower-level API details, see the API pages.

Live Streaming Examples

Use these examples when a DELTA camera is connected and you want to work with live USB stream data.

Example File Description
Device Connection device_connection_example.cpp Finds a connected camera, opens it, applies sensor settings, checks stream version, and closes the device.
Single Streaming single_streaming_example.cpp Streams one camera, generates ColorFrame output, and displays it with OpenCV.
Stereo Streaming stereo_streaming_example.cpp Detects stereo mode and displays camera 0 and camera 1 frames side by side.
Stream Status Display callback_from_stream_example.cpp Shows live data rate, frame rate, event count, and frame count on the preview window.

Playback Examples

Use these examples when you already have a saved .dvs raw data file.

Example File Description
Playback playback_example.cpp Opens a .dvs file, replays it as generated frames, and supports pause/resume control.
Playback Status Display callback_from_playback_example.cpp Shows playback event count, frame count, and file read-over status.

Saving Examples

Use these examples when you want to save raw stream data or generated frame images.

Example File Description
Raw Data Saving save_rawdata_example.cpp Saves live camera data as .dvs raw data by continuous mode, time, size, event count, or frame count.
Frame Saving From Stream save_frame_from_stream_example.cpp Saves generated frame images from a live stream.
Frame Saving From Playback save_frame_from_playback_example.cpp Saves generated frame images from a playback file.

Processing Output Examples

Use these examples when you want to inspect SDK processing outputs directly instead of only displaying or saving rendered frames.

Example File Output Type Description
Event Output event_output_example.cpp ClassicEvents, CompactEvents Exports event data to CSV for offline analysis.
Timestamp Output timestamp_output_example.cpp TimestampFrame Exports per-pixel timestamp frames as binary data.
Polarity Output polarity_output_example.cpp PolarityFrame Displays and optionally saves per-pixel polarity frames.

If you are using the SDK for the first time, follow this order:

  1. Device Connection
  2. Single Streaming
  3. Raw Data Saving
  4. Playback
  5. Processing output examples: Event Output, Timestamp Output, and Polarity Output

After the basic flow is working, use Stream Status Display or Playback Status Display to monitor stream or playback status in real time.