Samples

Dive straight into programming the Zivid camera with your preferred programming language.

Note

Some Zivid Samples require Sample Data.

List of samples

  • Camera

    • Basic

      • Capture - Capture colored point cloud, save 2D image, save 3D ZDF, and export PLY, using the Zivid camera.

      • CaptureFromFileCamera - Capture point clouds, with color, with the Zivid file camera.

      • CaptureHDRCompleteSettings - Capture point clouds, with color, from the Zivid camera with fully configured settings.

      • CaptureWithSettingsFromYML - Capture images and point clouds, with and without color, from the Zivid camera with settings from YML file.

      • Connect - Connect to a Zivid camera using the different available methods.

      • CreateFileCameraFromZDFWithDiagnostics - Capture a frame with diagnostics enabled and create a file camera from it.

    • Advanced

    • InfoUtilOther

      • CameraInfo - List connected cameras and print camera version and state information for each connected camera.

      • CameraUserData - Store user data on the Zivid camera.

      • CaptureWithDiagnostics - Capture a 2D+3D frame and a 2D frame from the Zivid camera with diagnostics enabled.

      • CheckHealth - Poll the camera health check from a separate thread while capturing, printing statuses and values each second.

      • FirmwareUpdater - Update firmware on the Zivid camera.

      • FrameInfo - Read frame info from the Zivid camera.

      • GetCameraIntrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud.

      • MeasureSceneConditions - Measure ambient light in the scene and report the flickering frequency when flickering is detected.

      • Warmup - Short example of a basic way to warm up the camera with specified time and capture cycle.

      • Network

    • Maintenance

  • Applications

Go to the zivid-ros Github repository.

Installation

  1. Install Zivid Software

  2. Download Zivid Sample Data

Windows

Launch the Command Prompt by pressing Win + R keys on the keyboard, then type cmd and press Enter.

Navigate to a location where you want to clone the repository, then run the following command:

git clone https://github.com/zivid/zivid-cpp-samples

Configure the sample solution with CMake, open it in Visual Studio, build it, run it. For more information see Configure C++ Samples With CMake and Build Them in Visual Studio in Windows.

Ubuntu

Open the Terminal by pressing Ctrl + Alt + T keys on the keyboard.

Navigate to a location where you want to clone the repository, then run the following command:

git clone https://github.com/zivid/zivid-cpp-samples
cd zivid-cpp-samples

Build the project:

mkdir build
cd build
cmake <options, see below> ../source
cmake --build .

Some of the samples depend on external libraries, in particular Eigen 3, OpenCV, PCL or HALCON. If you don’t want to install those, you can disable the samples depending on them by passing the following options, respectively, to cmake: -DUSE_EIGEN3=OFF, -DUSE_OPENCV=OFF, -DUSE_PCL=OFF, -DUSE_HALCON=OFF.

See Configure C++ Samples With Optional Dependencies for instructions on how to install the optional dependencies and configure the samples to use them.

The samples can now be run from the build directory, for instance like this:

./CaptureFromFileCameraVis3D

For more information visit the GitHub zivid-cpp-samples repository.

  1. Install Zivid Software

  2. Download Zivid Sample Data

Launch the Command Prompt by pressing Win + R keys on the keyboard, then type cmd and press Enter.

Navigate to a location where you want to clone the repository, then run the following command:

git clone https://github.com/zivid/zivid-csharp-samples

Open ZividNETSamples.sln in Visual Studio, build it and run it. If you are uncertain about doing this, check out Build C# Samples using Visual Studio.

Some of the samples depend on external libraries, in particular MathNet.Numerics and System.ValueTuple. These libraries will be installed automatically through NuGet when building the sample.

For more information visit the GitHub zivid-csharp-samples repository.

Note

The recommended Python version for these samples is 3.7 - 3.9.

Note that Open3D is not available for Python 3.13 and later.

  1. Install Zivid Software.

  2. Download Zivid Sample Data.

  3. Check out the Zivid Python samples repository:

    git clone http://github.com/zivid/zivid-python-samples.git
    
  4. Install the runtime requirements using IDE or command line:

cd zivid-python-samples
pip install -r requirements.txt

Note

If Open3D fails to install, ensure you are using a Python version supported by Open3D. Alternatively, you can install only dependencies required for non-Open3D samples by running:

pip install ./modules
  1. Open and run one of the samples.

    Note

    Running GUI samples on Windows should be done via pythonw.

For more information visit the GitHub zivid-python-samples repository.

Zivid offers two ways of interfacing with HALCON:

  1. Through the Zivid SDK, utilizing the C++/C# libraries available for HALCON. We provide samples for both C++ and C#. (Recommended)

  2. Directly through a GenICam GenTL producer that comes with the Zivid Software.

Zivid and HALCON are compatible with Windows 10 and 11, and Ubuntu 20.04, 22.04, 24.04, 26.04.

Note

Support for Ubuntu 18.04 is removed since SDK 2.10.

To set up and use Zivid in one of these operating systems, please follow their respective instructions on the following pages:

For more information visit the GitHub zivid-halcon-samples repository.

Support for MATLAB has been deprecated. Please visit an older version (<= 2.15) for support.

For more information visit the GitHub zivid-matlab-samples repository.

Check out the zivid-ros GitHub repository for installation instructions, code samples and how to get started with the Zivid ROS 2 driver. If you are using ROS 1, see the zivid-ros-1 branch.

Sample parity

Camera

Sample

C++

C#

Python

HDevelop

Basic

Capture

✓

✓

✓

✓

CaptureFromFileCamera

✓

✓

✓

CaptureHdrCompleteSettings

✓

✓

✓

✓

CaptureSavePly

✓

CaptureWithSettingsFromYml

✓

✓

✓

✓

Connect

✓

✓

✓

ConnectToSerialNumberCamera

✓

CreateFileCameraFromZdfWithDiagnostics

✓

✓

✓

Advanced

AllocateMemoryForPointCloudData

✓

Capture2DAnd3D

✓

✓

CaptureAndPrintNormals

✓

✓

✓

CaptureHalconViaGenICam

✓

✓

CaptureHalconViaZivid

✓

✓

CaptureViaGenICam

✓

Advanced/MultiCamera

MultiCameraCaptureInParallel

✓

MultiCameraCaptureSequentially

✓

MultiCameraCaptureSequentiallyWithInterleavedProcessing

✓

InfoUtilOther

adapt_settings_for_flickering_ambient_light

✓

CameraInfo

✓

✓

✓

CameraUserData

✓

✓

✓

CaptureWithDiagnostics

✓

✓

✓

CheckHealth

✓

✓

✓

context_manager_with_zivid

✓

ExploreSettingsMetaData

✓

FirmwareUpdater

✓

✓

✓

FrameInfo

✓

✓

✓

GetCameraIntrinsics

✓

✓

✓

MeasureSceneConditions

✓

✓

✓

QuerySettingsAndParameters

✓

SettingsInfo

✓

Warmup

✓

✓

✓

✓

ZividBenchmark

✓

InfoUtilOther/Network

AutomaticNetworkConfigurationForCameras

✓

✓

✓

NetworkConfiguration

✓

✓

✓

Maintenance

CorrectCameraInField

✓

✓

✓

ResetCameraInField

✓

✓

✓

VerifyCameraInField

✓

✓

✓

VerifyCameraInFieldFromZdf

✓

✓

✓

visualize_benchmark_results

✓

Applications

Sample

C++

C#

Python

HDevelop

Basic/Visualization

CaptureAndVisualizeNormals

✓

✓

CaptureFromFileCameraVis3D

✓

✓

✓

CaptureVis3D

✓

✓

✓

CaptureWritePclVis3D

✓

ProjectImageStartAndStop

✓

✓

✓

ReadPclVis3D

✓

read_zdf_vis_3d

✓

Basic/FileFormats

ConvertZdf

✓

✓

ReadIterateZdf

✓

✓

✓

ReadPly

✓

Zdf2Ply

✓

Advanced

auto_2d_settings

✓

CaptureUndistort2D

✓

✓

color_balance

✓

CreateDepthMap

✓

✓

Downsample

✓

✓

✓

GammaCorrection

✓

✓

MaskPointCloud

✓

✓

✓

Advanced/Visualization

CaptureVis3DInLoop

✓

✓

✓

CaptureVis3DInLoopWithKeypressExit

✓

✓

✓

Advanced/Cuda

CaptureAndConvertImageWithOpenCvOnCuda

✓

CaptureAndConvertToDlpackTensorOnCuda

✓

✓

capture_and_process_image_with_cupy_on_cuda

✓

capture_and_render_point_cloud_with_opengl_on_cuda

✓

capture_and_segment_image_with_pytorch_on_cuda

✓

Advanced/Transform

get_checkerboard_pose_from_zdf

✓

TransformPointCloudFromMillimetersToMeters

✓

✓

✓

TransformPointCloudViaArucoMarker

✓

✓

✓

TransformPointCloudViaCheckerboard

✓

✓

✓

Advanced/Roi

RoiBoxViaArucoMarker

✓

✓

✓

RoiBoxViaCheckerboard

✓

✓

✓

Advanced/Stitching

StitchContinuouslyRotatingObject

✓

✓

✓

StitchUsingRobotMountedCamera

✓

✓

✓

StitchViaLocalPointCloudRegistration

✓

✓

✓

Advanced/Barcode

BarcodeDetector

✓

✓

Advanced/HandEyeCalibration

EyeInHandCalibration3DObject

✓

EyeInHandCalibrationMvTecPlate

✓

HandEyeCalibration

✓

✓

✓

hand_eye_gui

✓

JsonHomogeneousMatrixToHalconPose

✓

pose_conversion_gui

✓

PoseConversions

✓

✓

✓

UtilizeHandEyeCalibration

✓

✓

✓

verify_hand_eye_with_visualization

✓

Advanced/HandEyeCalibration/UrHandEyeCalibration

universal_robots_perform_hand_eye_calibration

✓

Advanced/HandEyeCalibration/RobodkHandEyeCalibration

robodk_hand_eye_calibration

✓

robodk_verify_hand_eye_calibration

✓

Advanced/MultiCamera

MultiCameraCalibration

✓

✓

✓

MultiCameraCalibrationFromZdf

✓

✓

StitchByTransformation

✓

✓

StitchByTransformationFromZdf

✓

✓

Advanced/Projector

ProjectAndFindMarker

✓

✓

ReadProjectAndCaptureImage

✓

✓

✓

ReprojectPoints

✓

✓

Advanced/RobotGuidance

robodk_robot_guidance

✓

Advanced/ObjectMatching

SurfaceMatchingCreateModel

✓

SurfaceMatchingCreateModelFromFile

✓

SurfaceMatchingFindModel

✓

SurfaceMatchingFindModelFromFile

✓

Procedures

Sample

C++

C#

Python

HDevelop

CalcCalplatePoseEyeInHand

✓

CalcCalplatePoseEyeToHand

✓

GenerateRGBAndRgbImages

✓

GetFirstAvailableZividDevice

✓

GetSettingsForZividCameraModel

✓

GetZividCameraWidth

✓

GetZividPresetFile

✓

GetZividSampleDataDir

✓

Modules

Sample

C++

C#

Python

HDevelop

Zividsamples

calibration_board_utils

✓

camera_verification

✓

color_to_grayscale

✓

display

✓

paths

✓

robodk_tools

✓

save_load_matrix

✓

save_load_transformation_matrix

✓

save_residuals

✓

settings_utils

✓

transformation_matrix

✓

white_balance_calibration

✓