Python
Sample list
There are two main categories of samples: Camera and Applications. The samples in the Camera category focus only on how to use the camera. The samples in the Applications category use the output generated by the camera, such as the 3D point cloud, a 2D image or other data from the camera. These samples shows how the data from the camera can be used.
camera
basic
capture - Capture colored point cloud, save 2D image, save 3D ZDF, and export PLY, using the Zivid camera.
capture_from_file_camera - Capture point clouds, with color, with the Zivid file camera.
capture_hdr_complete_settings - Capture point clouds, with color, from the Zivid camera with fully configured settings.
capture_with_settings_from_yml - 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.
create_file_camera_from_zdf_with_diagnostics - Capture a frame with diagnostics enabled and create a file camera from it.
advanced
capture_2d_and_3d - Capture 2D and 3D with the Zivid camera.
capture_and_print_normals - Capture Zivid point clouds, compute normals and print a subset.
info_util_other
adapt_settings_for_flickering_ambient_light - Adapt camera acquisition settings based on known ambient light conditions.
camera_info - Print Python, zivid-python and Zivid SDK versions, then list each connected camera with info and state.
camera_user_data - Store user data on the Zivid camera.
capture_with_diagnostics - Capture a 2D+3D frame and a 2D frame from the Zivid camera with diagnostics enabled.
check_health - Poll the camera health check from a separate thread while capturing, printing statuses and values each second.
context_manager_with_zivid - Sample showing how to use a context manager with Zivid Application and safely return processed data.
firmware_updater - Update firmware on the Zivid camera.
frame_info - Read frame info from the Zivid camera.
get_camera_intrinsics - Read intrinsic parameters from the Zivid camera (OpenCV model) or estimate them from the point cloud.
measure_scene_conditions - 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
automatic_network_configuration_for_cameras - Automatically configure the IP addresses of connected cameras to match the network of the user’s PC.
network_configuration - Uses Zivid API to change the IP address of the Zivid camera.
maintenance
correct_camera_in_field - Correct the dimension trueness of a Zivid camera.
reset_camera_in_field - Reset infield correction on a camera.
verify_camera_in_field - Check the dimension trueness of a Zivid camera.
verify_camera_in_field_from_zdf - Check the dimension trueness of a Zivid camera from a ZDF file.
visualize_benchmark_results - Visualize the CSV results produced by the ZividBenchmark sample.
applications
basic
visualization
capture_and_visualize_normals - Capture Zivid point clouds, compute normals and convert to color map and display.
capture_from_file_camera_vis_3d - Capture point clouds, with color, with the Zivid file camera.
capture_vis_3d - Capture point clouds, with color, from the Zivid camera, and visualize it.
project_image_start_and_stop - Start the Image Projection and Stop 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.
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.
capture_undistort_2d - Use camera intrinsics to undistort a 2D image.
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.
mask_point_cloud - Read point cloud data from a ZDF file, apply a binary mask, and visualize it.
visualization
capture_vis_3d_in_loop - Capture point clouds, with color, from the Zivid camera, and visualize them in a loop.
capture_vis_3d_in_loop_with_keypress_exit - Capture point clouds, with color, from the Zivid camera, and visualize them in a loop. Press ‘q’ to exit.
cuda
capture_and_convert_to_dlpack_tensor_on_cuda - Demonstrate zero-copy GPU interop by handing a Zivid DeviceArray to PyTorch on the GPU, showing two paths.
capture_and_process_image_with_cupy_on_cuda - Demonstrate GPU interop with CuPy: wrap a Zivid GPU image buffer as a CuPy array without copying it through CPU memory.
capture_and_render_point_cloud_with_opengl_on_cuda - Render a Zivid point cloud interactively by copying it device-to-device into OpenGL buffers with CUDA interop.
capture_and_segment_image_with_pytorch_on_cuda - Feed a Zivid 2D image into a third-party segmentation model on the GPU without a CPU round-trip.
transform
get_checkerboard_pose_from_zdf - Estimate the checkerboard pose from a ZDF file of a Zivid calibration board and save it to YAML.
transform_point_cloud_from_millimeters_to_meters - Transform point cloud data from millimeters to meters.
transform_point_cloud_via_aruco_marker - Transform a point cloud from camera to ArUco marker coordinate frame using the marker’s estimated pose.
transform_point_cloud_via_checkerboard - Transform a point cloud from camera to checkerboard coordinate frame using the pose from the API.
roi
roi_box_via_aruco_marker - Filter the point cloud based on a ROI box given relative to the ArUco marker on a Zivid Calibration Board.
roi_box_via_checkerboard - Filter the point cloud based on a ROI box given relative to the Zivid Calibration Board.
stitching
stitch_continuously_rotating_object - Stitch point clouds from a continuously rotating object using Local Point Cloud Registration, then downsample.
stitch_using_robot_mounted_camera - Stitch multiple point clouds captured with a robot mounted camera.
stitch_via_local_point_cloud_registration - Stitch two point clouds using a transformation estimated by Local Point Cloud Registration and apply Voxel Downsample.
barcode
barcode_detector - Detect and decode linear and matrix barcodes from a 2D capture.
hand_eye_calibration
hand_eye_calibration - Perform Hand-Eye calibration.
hand_eye_gui - Hand-Eye Calibration GUI.
pose_conversion_gui - Convert between different rotation formats with a GUI.
pose_conversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector).
utilize_hand_eye_calibration - Transform a data point or entire point cloud from camera to robot base frame using the Hand-Eye calibration matrix.
verify_hand_eye_with_visualization - Verify hand-eye calibration by transforming all dataset point clouds and visualizing them overlapped.
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.
robodk_hand_eye_calibration
robodk_hand_eye_calibration - Generate a dataset and perform hand-eye calibration using the Robodk interface.
robodk_verify_hand_eye_calibration - Perform a touch test with a robot to verify Hand-Eye Calibration using the RoboDK interface.
multi_camera
multi_camera_calibration - Generate transformation matrices to a single coordinate frame from captures by multiple connected cameras.
multi_camera_calibration_from_zdf - Generate transformation matrices to a single coordinate frame from multi-camera ZDF captures.
stitch_by_transformation - Transform point clouds from connected cameras into one coordinate frame using Multi-Camera calibration.
stitch_by_transformation_from_zdf - Transform point clouds from ZDF files into one coordinate frame using Multi-Camera calibration.
projector
project_and_find_marker - Show a marker using the projector, capture a set of 2D images to find the marker coordinates (2D and 3D).
read_project_and_capture_image - Read a 2D image from file and project it using the camera projector.
reproject_points - Illuminate checkerboard (Zivid Calibration Board) centers by getting the checkerboard feature points.
robot_guidance
robodk_robot_guidance - Guide the robot to follow a path on the Zivid Calibration Board.
modules
zividsamples
calibration_board_utils - Utility functions for the Zivid calibration board.
camera_verification - Capture and measure the infield verification state of a Zivid camera.
color_to_grayscale - Convert Zivid RGBA color images to grayscale.
display - Display relevant data for Zivid Samples.
paths - Get relevant paths for Zivid Samples.
robodk_tools - Connect to a robot through RoboDK, list its targets and set its speeds.
save_load_matrix - Save and load Zivid 4x4 transformation matrices from and to YAML files.
save_load_transformation_matrix - Save and load Zivid transformation matrices to and from YAML files.
save_residuals - Save per-pose hand-eye calibration residuals to a YAML file.
settings_utils - Pick and adjust Zivid capture settings for the samples.
transformation_matrix - Convenience functions and a class for 4x4 transformation matrices.
white_balance_calibration - Balance color for 2D capture using white surface as reference.
Instructions
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.
Check out the Zivid Python samples repository:
git clone http://github.com/zivid/zivid-python-samples.git
Install the runtime requirements using IDE or command line:
cd zivid-python-samples pip install -r requirements.txtNote
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
Open and run one of the samples.
Note
Running GUI samples on Windows should be done via
pythonw.