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 point clouds, with color, from the Zivid camera.
Capture2D - Capture 2D images from the Zivid camera.
CaptureAssistant - Capture Assistant to capture point clouds, with color, from the Zivid camera.
CaptureFromFileCamera - Capture point clouds, with color, from the Zivid file camera. Currently supported by Zivid One.
CaptureHDR - Capture HDR point clouds, with color, from the Zivid camera.
CaptureHDRCompleteSettings - Capture point clouds, with color, from the Zivid camera with fully configured settings.
CaptureWithSettingsFromYML - Capture point clouds, with color, from the Zivid camera, with settings from YML file.
Advanced
AllocateMemoryForPointCloudData - Two methods to copy point cloud data from GPU memory to CPU memory, to be consumed by OpenCV.
Capture2D+3D - Capture 2D and then 3D using various capture strategies, optimizing for both 2D quality and 2D acquisition speed.
CaptureHalconViaGenICam - Capture and save a point cloud, with colors, using GenICam interface and Halcon C++ SDK.
CaptureHalconViaZivid - Capture a point cloud, with colors, using Zivid SDK, transform it to a Halcon point cloud and save it using Halcon C++ SDK.
CaptureHDRLoop - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise.
CaptureHDRPrintNormals - Capture Zivid point clouds, compute normals and print a subset.
MultiCameraCaptureInParallel - Capture point clouds with multiple cameras in parallel.
MultiCameraCaptureSequentially - Capture point clouds with multiple cameras sequentially.
InfoUtilOther
CameraUserData - Store user data on the Zivid camera.
CaptureWithDiagnostics - Capture point clouds, with color, from the Zivid camera, with settings from YML file and diagnostics enabled.
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.
PrintVersionInfo - List connected cameras and print version information.
SettingsInfo - Read settings info from the Zivid camera.
Warmup - Short example of a basic way to warm up the camera with specified time and capture cycle.
ZividBenchmark - Zividbenchmarks is a sample that will test the average speed of different operations on your computer. It will provide
Maintenance
CorrectCameraInField - Correct the dimension trueness of a Zivid camera.
ResetCameraInField - Reset in-field correction on a camera.
VerifyCameraInField - Check the dimension trueness of a Zivid camera.
Applications
Basic
Visualization
CaptureFromFileCameraVis3D - Capture point clouds, with color, from the virtual Zivid camera, and visualize it. Currently supported by Zivid One.
CaptureHDRVisNormals - Capture Zivid point clouds, with color and normals, and visualize it in 3D and as a normal map.
CaptureVis3D - Capture point clouds, with color, from the Zivid camera, and visualize it.
CaptureWritePCLVis3D - Capture point clouds, with color, from the Zivid camera, save it to PCD file format, and visualize it.
ReadPCLVis3D - Read point cloud from PCL file and visualize it.
FileFormats
ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
Advanced
CaptureUndistortRGB - Use camera intrinsics to undistort an RGB image.
CreateDepthMap - Convert point cloud from a ZDF file to OpenCV format, extract depth map and visualize it.
Downsample - Downsample point cloud from a ZDF file.
GammaCorrection - Capture 2D image with gamma correction.
HandEyeCalibration - Perform Hand-Eye calibration.
MaskPointCloud - Mask point cloud from a ZDF file and convert to PCL format, extract depth map and visualize it.
ROIBoxViaArucoMarker - Filter the point cloud based on a ROI box given relative to the ArUco marker.
ROIBoxViaCheckerboard - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board.
TransformPointCloudFromMillimetersToMeters - Transform point cloud data from millimeters to meters.
TransformPointCloudViaArucoMarker - Transform a point cloud from camera to ArUco Marker coordinate frame by estimating the marker’s pose from the
TransformPointCloudViaCheckerboard - Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API.
HandEyeCalibration
PoseConversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector)
UtilizeHandEyeCalibration - Transform single data point or entire point cloud from camera frame to robot base frame using Hand-Eye calibration
MultiCamera
MultiCameraCalibration - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from connected cameras.
MultiCameraCalibrationFromZDF - Use captures of a calibration object to generate transformation matrices to a single coordinate frame, from a ZDF files.
StitchByTransformation - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from connected cameras.
StitchByTransformationFromZDF - Use transformation matrices from Multi-Camera calibration to transform point clouds into single coordinate frame, from a ZDF files.
Camera
Basic
Capture - Capture point clouds, with color, from the Zivid camera.
Capture2D - Capture 2D images from the Zivid camera.
CaptureAssistant - Use Capture Assistant to capture point clouds, with color, from the Zivid camera.
CaptureFromFileCamera - Capture point clouds, with color, from the Zivid file camera.
CaptureHDR - Capture point clouds, with color, from the Zivid camera.
CaptureHDRCompleteSettings - Capture point clouds, with color, from the Zivid camera with fully configured settings.
CaptureWithSettingsFromYML - Capture point clouds, with color, from the Zivid camera, with settings from YML file.
Advanced
CaptureHalconViaGenICam - Capture and save a point cloud, with colors, using GenICam interface and Halcon C++ SDK.
CaptureHalconViaZivid - Capture a point cloud, with colors, using Zivid SDK, transform it to a Halcon point cloud and save it using Halcon C++ SDK.
CaptureHDRLoop - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise.
CaptureHDRPrintNormals - Capture Zivid point clouds, compute normals and print a subset.
InfoUtilOther
CameraUserData - Store user data on the Zivid camera.
CaptureWithDiagnostics - Capture point clouds, with color, from the Zivid camera, with settings from YML file and diagnostics enabled.
FirmwareUpdater - Update firmware on the Zivid camera.
GetCameraIntrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud.
PrintVersionInfo - List connected cameras and print version information.
Warmup - A basic warm-up method for a Zivid camera with specified time and capture cycle.
Applications
Basic
Visualization
CaptureFromFileCameraVis3D - Capture point clouds, with color, from the Zivid file camera, and visualize them.
CaptureVis3D - Capture point clouds, with color, from the Zivid camera, and visualize them.
FileFormats
ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
ZDF2PLY - Convert point cloud from a ZDF file to a PLY file.
Advanced
Downsample - Downsample point cloud from a ZDF file.
HandEyeCalibration - Perform Hand-Eye calibration.
MultiCameraCalibration - Use captures of a calibration object to generate transformation matrices to a single coordinate frame.
TransformPointCloudFromMillimetersToMeters - Transform point cloud data from millimeters to meters.
TransformPointCloudViaCheckerboard - Transform a point cloud from camera to checkerboard (Zivid Calibration Board) coordinate frame by getting checkerboard pose from the API.
HandEyeCalibration
PoseConversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector)
UtilizeHandEyeCalibration - Transform single data point or entire point cloud from camera frame to robot base frame using Hand-Eye calibration
camera
basic
capture - Capture point clouds, with color, from the Zivid camera.
capture_2d - Capture 2D images from the Zivid camera.
capture_2d_with_settings_from_yml - Capture 2D images from the Zivid camera, with settings from YML file.
capture_assistant - Use Capture Assistant to capture point clouds, with color, from the Zivid camera.
capture_from_file_camera - Capture point clouds, with color, from the Zivid file camera.
capture_hdr - Capture point clouds, with color, from the Zivid camera.
capture_hdr_complete_settings - Capture point clouds, with color, from the Zivid camera with fully configured settings.
capture_with_settings_from_yml - Capture point clouds, with color, from the Zivid camera, with settings from YML file.
advanced
capture_hdr_loop - Cover the same dynamic range in a scene with different acquisition settings to optimize for quality, speed, or to find a compromise.
capture_hdr_print_normals - Capture Zivid point clouds, compute normals and print a subset.
info_util_other
camera_user_data - Store user data on the Zivid camera.
capture_with_diagnostics - Capture point clouds, with color, from the Zivid camera, with settings from YML file and diagnostics enabled.
firmware_updater - Update firmware on the Zivid camera.
get_camera_intrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud.
print_version_info - Print version information for Python, zivid-python and Zivid SDK, then list cameras and print camera info for each connected camera.
warmup - A basic warm-up method for a Zivid camera with specified time and capture cycle.
maintenance
correct_camera_in_field - Correct the dimension trueness of a Zivid camera.
reset_camera_in_field - Reset in-field correction on a camera.
verify_camera_in_field - Check the dimension trueness of a Zivid camera.
applications
basic
visualization
capture_hdr_vis_normals - Capture Zivid point clouds, compute normals and convert to color map and display.
capture_vis_3d - Capture point clouds, with color, from the Zivid camera, and visualize it.
read_zdf_vis_3d - Read point cloud data from a ZDF file and visualize it.
file_formats
convert_zdf - Convert point cloud data from a ZDF file to your preferred format (PLY, CSV, TXT, PNG, JPG, BMP, TIFF).
read_iterate_zdf - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
advanced
auto_2d_settings - Automatically find 2D settings for a 2D capture by using a Zivid calibration board.
color_balance - Balance color of a 2D image by using a Zivid calibration board.
create_depth_map - Read point cloud data from a ZDF file, convert it to OpenCV format, then extract and visualize depth map.
downsample - Downsample point cloud from a ZDF file.
gamma_correction - Capture 2D image with gamma correction.
get_checkerboard_pose_from_zdf - Read point cloud data of a Zivid calibration board from a ZDF file, estimate the
hand_eye_calibration - Perform Hand-Eye calibration.
mask_point_cloud - Read point cloud data from a ZDF file, apply a binary mask, and visualize it.
roi_box_via_checkerboard - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board.
hand_eye_calibration
pose_conversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector).
robodk_hand_eye_calibration - Generate a dataset and perform hand-eye calibration using the Robodk interface.
utilize_hand_eye_calibration - Transform single data point or entire point cloud from camera frame to robot base frame using Hand-Eye calibration
verify_hand_eye_with_visualization - Verify hand-eye calibration by transforming all dataset point clouds and
ur_hand_eye_calibration
universal_robots_perform_hand_eye_calibration - Script to generate a dataset and perform hand-eye calibration using a Universal Robot UR5e robot.
sample_utils
calibration_board_utils - Utility functions for the Zivid calibration board.
display - Display relevant data for Zivid Samples.
paths - Get relevant paths for Zivid Samples.
robodk_tools - Robot Control Module
save_load_matrix - try:
white_balance_calibration - Balance color for 2D capture using white surface as reference.
applications
advanced
verify_hand_eye_calibration
robodk_verify_hand_eye_calibration - Perform a touch test with a robot to verify Hand-Eye Calibration using the RoboDK interface.
Camera
Basic
Capture - Capture a 3D color point cloud from the camera and use it to generate a HALCON ObjectModel3D which is then visualized.
CaptureHDR - Capture an HDR image from the camera and use it to generate a HALCON ObjectModel3D which is then visualized.
CaptureHDRCompleteSettings - Capture an HDR image from the Zivid camera with fully configured settings for each frame.
CaptureSavePLY - Capture a 3D color point cloud from the camera and save it to a PLY file format.
ConnectToSerialNumberCamera - Connect to a specific Zivid 3D camera based on its serial number.
Advanced
CaptureHDRLoop - Capture HDR images from the camera in a loop (while actively changing some HDR settings).
InfoUtilOther
QuerySettingsAndParameters - Query information about the image acquisition interface and selected specific parameters of Zivid camera.
Warmup - A basic warm-up method for a Zivid camera with specified time and capture cycle.
Applications
Basic
FileFormats
ReadPLY - Import and display a Zivid point cloud from a PLY file.
Advanced
ObjectMatching
SurfaceMatchingCreateModel - Create a model for HALCON surface-based 3D matching algorithm from a Zivid point cloud captured by a camera.
SurfaceMatchingCreateModelFromFile - Create a model for HALCON surface-based 3D matching algorithm from a Zivid point cloud loaded from a ZDF file.
SurfaceMatchingFindModel - Utilize surface-based 3D matching on data taken with a Zivid camera.
SurfaceMatchingFindModelFromFile - Utilize surface-based 3D matching on data taken with a Zivid camera.
Camera
Basic
Capture - Capture point clouds, with color, from the Zivid camera.
Capture2D - Capture 2D images from the Zivid camera.
CaptureAssistant - Capture Assistant to capture point clouds, with color, from the Zivid camera.
CaptureFromFileCamera - Capture point clouds, with color, from the Zivid file camera. Currently supported by Zivid One.
CaptureHDR - Capture HDR point clouds, with color, from the Zivid camera.
zividApplication - application = zividApplication(folder)
InfoUtilOther
GetCameraIntrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model).
Applications
Basic
Visualization
CaptureFromFileCameraVis3D - Capture point clouds, with color, from the virtual Zivid camera, and visualize it. Currently supported by Zivid One.
CaptureVis3D - Capture point clouds, with color, from the Zivid camera, and visualize it.
FileFormats
convertZDF - convertZDF(inputFileName,outputFileFormat)
ReadIterateZDF - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
readZDF - [xyz,rgba,snr] = readZDF(dataFile)
Advanced
Downsample - Downsample point cloud from ZDF file.
Go to the GitHub zivid-ros repository.
Installation
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 to 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 to 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
make -j
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
.
If you do want to use them:
Eigen 3: Set
-DEIGEN3_INCLUDE_DIR=<path>
where<path>
is the root directory of your Eigen3 installation (the folder containing Eigen/Core, Eigen/Dense etc.)PCL and OpenCV: If a recent enough version is installed on your system, these should just work. If not, set
-DPCL_DIR=<path>
/-DOpenCV_DIR=<path>
where<path>
is the directory containingPCLConfig.cmake
andOpenCVConfig.cmake
, respectively.HALCON: If a recent enough version is installed on your system, these should just work.
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.
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 to 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
.
These libraries will be installed automatically through NuGet when building the sample.
For more information visit the GitHub zivid-csharp-samples repository.
Install Zivid Python. Note: The recommended Python version for these samples is 3.6 - 3.9.
Install the runtime requirements using IDE or command line:
pip install -r requirements.txt
Add the directory source to PYTHONPATH. Navigate to the root of the repository and run:
PowerShell:
$env:PYTHONPATH=$env:PYTHONPATH + ";$PWDsource"
cmd:
set PYTHONPATH="$PYTHONPATH;$PWDsource"
bash:
export PYTHONPATH="$PYTHONPATH:$PWD/source"
Open and run one of the samples.
For more information visit the GitHub zivid-python-samples repository.
If you want to use Zivid in HALCON, we provide a GenICam GenTL producer that comes with the Zivid Software.
Zivid and HALCON are compatible with Windows 10 and Ubuntu 18.04, 20.04, 22.04.
Note
Support for Ubuntu 16.04 is removed since SDK 2.7.
To setup and use Zivid in one of these operating systems, please follow their respective instructions in the following pages:
The following HALCON versions have been tested and confirmed to work with Zivid cameras:
19.05 Progress, 20.05 Progress, 21.11 Progress
We recommend to use one of the HALCON versions we have tested.
For more information visit the GitHub zivid-halcon-samples repository.
Install MATLAB Software. Note: The version tested with Zivid cameras is 2019a.
See Create a MATLAB “Hello World” Application With Reference to Zivid .NET API
For more information visit the GitHub zivid-matlab-samples repository.
Check out our zivid-ros GitHub repository for installation instructions, getting started and samples for Zivid ROS driver.
Sample parity
Camera
Sample |
C++ |
C# |
Python |
HDevelop |
MATLAB |
---|---|---|---|---|---|
Basic |
|||||
Capture |
|||||
Capture2D |
|||||
capture_2d_with_settings_from_yml |
|||||
CaptureAssistant |
|||||
CaptureFromFileCamera |
|||||
CaptureHdr |
|||||
CaptureHdrCompleteSettings |
|||||
CaptureSavePly |
|||||
CaptureWithSettingsFromYml |
|||||
ConnectToSerialNumberCamera |
|||||
ZividApplication |
|||||
Advanced |
|||||
AllocateMemoryForPointCloudData |
|||||
Capture2D+3D |
|||||
CaptureHalconViaGenICam |
|||||
CaptureHalconViaZivid |
|||||
CaptureHdrLoop |
|||||
CaptureHdrPrintNormals |
|||||
MultiCameraCaptureInParallel |
|||||
MultiCameraCaptureSequentially |
|||||
InfoUtilOther |
|||||
CameraUserData |
|||||
CaptureWithDiagnostics |
|||||
FirmwareUpdater |
|||||
FrameInfo |
|||||
GetCameraIntrinsics |
|||||
PrintVersionInfo |
|||||
QuerySettingsAndParameters |
|||||
SettingsInfo |
|||||
Warmup |
|||||
ZividBenchmark |
|||||
Maintenance |
|||||
CorrectCameraInField |
|||||
ResetCameraInField |
|||||
VerifyCameraInField |
Applications
Sample |
C++ |
C# |
Python |
HDevelop |
MATLAB |
---|---|---|---|---|---|
Basic/Visualization |
|||||
CaptureFromFileCameraVis3D |
|||||
CaptureHdrVisNormals |
|||||
CaptureVis3D |
|||||
CaptureWritePclVis3D |
|||||
ReadPclVis3D |
|||||
read_zdf_vis_3d |
|||||
Basic/FileFormats |
|||||
ConvertZdf |
|||||
ReadIterateZdf |
|||||
ReadPly |
|||||
ReadZdf |
|||||
Zdf2Ply |
|||||
Advanced |
|||||
auto_2d_settings |
|||||
CaptureUndistortRgb |
|||||
color_balance |
|||||
CreateDepthMap |
|||||
Downsample |
|||||
GammaCorrection |
|||||
get_checkerboard_pose_from_zdf |
|||||
HandEyeCalibration |
|||||
MaskPointCloud |
|||||
MultiCameraCalibration |
|||||
RoiBoxViaArucoMarker |
|||||
RoiBoxViaCheckerboard |
|||||
TransformPointCloudFromMillimetersToMeters |
|||||
TransformPointCloudViaArucoMarker |
|||||
TransformPointCloudViaCheckerboard |
|||||
Advanced/HandEyeCalibration |
|||||
PoseConversions |
|||||
robodk_hand_eye_calibration |
|||||
UtilizeHandEyeCalibration |
|||||
verify_hand_eye_with_visualization |
|||||
Advanced/HandEyeCalibration/UrHandEyeCalibration |
|||||
universal_robots_perform_hand_eye_calibration |
|||||
Advanced/MultiCamera |
|||||
MultiCameraCalibration |
|||||
MultiCameraCalibrationFromZdf |
|||||
StitchByTransformation |
|||||
StitchByTransformationFromZdf |
|||||
Advanced/ObjectMatching |
|||||
SurfaceMatchingCreateModel |
|||||
SurfaceMatchingCreateModelFromFile |
|||||
SurfaceMatchingFindModel |
|||||
SurfaceMatchingFindModelFromFile |
Sample Utils
Sample |
C++ |
C# |
Python |
HDevelop |
MATLAB |
---|---|---|---|---|---|
calibration_board_utils |
|||||
display |
|||||
paths |
|||||
robodk_tools |
|||||
save_load_matrix |
|||||
white_balance_calibration |
Applications
Sample |
C++ |
C# |
Python |
HDevelop |
MATLAB |
---|---|---|---|---|---|
Advanced/VerifyHandEyeCalibration |
|||||
robodk_verify_hand_eye_calibration |