https://github.com/zivid/zivid-python-samples
Python code samples for Zivid
https://github.com/zivid/zivid-python-samples
python samples zivid
Last synced: 2 months ago
JSON representation
Python code samples for Zivid
- Host: GitHub
- URL: https://github.com/zivid/zivid-python-samples
- Owner: zivid
- License: bsd-3-clause
- Created: 2019-03-29T09:16:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-12-23T10:53:28.000Z (3 months ago)
- Last Synced: 2025-12-24T07:45:42.324Z (3 months ago)
- Topics: python, samples, zivid
- Language: Python
- Homepage: https://zivid.com
- Size: 99.9 MB
- Stars: 48
- Watchers: 8
- Forks: 20
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python samples
This repository contains python code samples for Zivid SDK v2.17.2. For
tested compatibility with earlier SDK versions, please check out
[accompanying
releases](https://github.com/zivid/zivid-python-samples/tree/master/../../releases).

---
*Contents:*
[**Tutorials**](#Tutorials-list) |
[**Samples**](#Samples-list) |
[**Installation**](#Installation) |
[**Support**](#Support) |
[**License**](#License)
---
## Tutorials list
- [quick\_capture\_tutorial](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/quick_capture_tutorial.md)
- [capture\_tutorial](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_tutorial.md)
- [point\_cloud\_tutorial](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/point_cloud_tutorial.md)
## Samples 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](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture.py) - Capture colored point cloud, save 2D image, save 3D ZDF,
and export PLY, using the Zivid camera.
- [capture\_from\_file\_camera](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_from_file_camera.py) - Capture point clouds, with color, with the Zivid file
camera.
- [capture\_hdr\_complete\_settings](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_hdr_complete_settings.py) - Capture point clouds, with color, from the Zivid camera
with fully configured settings.
- [capture\_with\_settings\_from\_yml](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/basic/capture_with_settings_from_yml.py) - Capture images and point clouds, with and without color,
from the Zivid camera with settings from YML file.
- **advanced**
- [capture\_2d\_and\_3d](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/advanced/capture_2d_and_3d.py) - Capture 2D and 3D with the Zivid camera.
- [capture\_and\_print\_normals](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/advanced/capture_and_print_normals.py) - Capture Zivid point clouds, compute normals and print a
subset.
- **info\_util\_other**
- [adapt\_settings\_for\_flickering\_ambient\_light](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/adapt_settings_for_flickering_ambient_light.py) - Adapt camera acquisition settings based on known ambient
light conditions.
- [automatic\_network\_configuration\_for\_cameras](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/automatic_network_configuration_for_cameras.py) - Automatically configure the IP addresses of connected
cameras to match the network of the user's PC.
- [camera\_info](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/camera_info.py) - Print version information for Python, zivid-python and
Zivid SDK, then list cameras and print camera info and state
for each connected camera.
- [camera\_user\_data](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/camera_user_data.py) - Store user data on the Zivid camera.
- [capture\_with\_diagnostics](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/capture_with_diagnostics.py) - Capture point clouds, with color, from the Zivid camera,
with default settings and diagnostics enabled.
- [context\_manager\_with\_zivid](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/context_manager_with_zivid.py) - Sample showing how to use a context manager with Zivid
Application and safely return processed data.
- [firmware\_updater](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/firmware_updater.py) - Update firmware on the Zivid camera.
- [frame\_info](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/frame_info.py) - Read frame info from the Zivid camera.
- [get\_camera\_intrinsics](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/get_camera_intrinsics.py) - Read intrinsic parameters from the Zivid camera (OpenCV
model) or estimate them from the point cloud.
- [measure\_scene\_conditions](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/measure_scene_conditions.py) - Measure ambient light conditions in the scene and output
the measured flickering frequency of the ambient light if
flickering is detected.
- [network\_configuration](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/network_configuration.py) - Uses Zivid API to change the IP address of the Zivid
camera.
- [warmup](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/info_util_other/warmup.py) - Short example of a basic way to warm up the camera with
specified time and capture cycle.
- **maintenance**
- [correct\_camera\_in\_field](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/maintenance/correct_camera_in_field.py) - Correct the dimension trueness of a Zivid camera.
- [reset\_camera\_in\_field](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/maintenance/reset_camera_in_field.py) - Reset infield correction on a camera.
- [verify\_camera\_in\_field](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/maintenance/verify_camera_in_field.py) - Check the dimension trueness of a Zivid camera.
- [verify\_camera\_in\_field\_from\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/camera/maintenance/verify_camera_in_field_from_zdf.py) - Check the dimension trueness of a Zivid camera from a ZDF
file.
- **applications**
- **basic**
- **visualization**
- [capture\_and\_visualize\_normals](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/visualization/capture_and_visualize_normals.py) - Capture Zivid point clouds, compute normals and
convert to color map and display.
- [capture\_from\_file\_camera\_vis\_3d](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/visualization/capture_from_file_camera_vis_3d.py) - Capture point clouds, with color, with the Zivid file
camera.
- [capture\_vis\_3d](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/visualization/capture_vis_3d.py) - Capture point clouds, with color, from the Zivid
camera, and visualize it.
- [project\_image\_start\_and\_stop](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/visualization/project_image_start_and_stop.py) - Start the Image Projection and Stop it.
- [read\_zdf\_vis\_3d](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/visualization/read_zdf_vis_3d.py) - Read point cloud data from a ZDF file and visualize
it.
- **file\_formats**
- [convert\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/file_formats/convert_zdf.py) - Convert point cloud data from a ZDF file to your
preferred format
- [read\_iterate\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/basic/file_formats/read_iterate_zdf.py) - Read point cloud data from a ZDF file, iterate through
it, and extract individual points.
- **advanced**
- [auto\_2d\_settings](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/auto_2d_settings.py) - Automatically find 2D settings for a 2D capture by using a
Zivid calibration board.
- [barcode\_detector](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/barcode_detector.py) - Detect and decode linear and matrix barcodes from a 2D
capture.
- [color\_balance](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/color_balance.py) - Balance color of a 2D image by using a Zivid calibration
board.
- [create\_depth\_map](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/create_depth_map.py) - Read point cloud data from a ZDF file, convert it to
OpenCV format, then extract and visualize depth map.
- [downsample](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/downsample.py) - Downsample point cloud from a ZDF file.
- [gamma\_correction](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/gamma_correction.py) - Capture 2D image with gamma correction.
- [get\_checkerboard\_pose\_from\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/get_checkerboard_pose_from_zdf.py) - Read point cloud data of a Zivid calibration board from a
ZDF file, estimate the
- [hand\_eye\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/hand_eye_calibration.py) - Perform Hand-Eye calibration.
- [mask\_point\_cloud](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/mask_point_cloud.py) - Read point cloud data from a ZDF file, apply a binary
mask, and visualize it.
- [project\_and\_find\_marker](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/project_and_find_marker.py) - 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](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/read_project_and_capture_image.py) - Read a 2D image from file and project it using the camera
projector.
- [reproject\_points](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/reproject_points.py) - Illuminate checkerboard (Zivid Calibration Board) centers
by getting the checkerboard feature points
- [roi\_box\_via\_aruco\_marker](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/roi_box_via_aruco_marker.py) - Filter the point cloud based on a ROI box given relative
to the ArUco marker on a Zivid Calibration Board.
- [roi\_box\_via\_checkerboard](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/roi_box_via_checkerboard.py) - Filter the point cloud based on a ROI box given relative
to the Zivid Calibration Board.
- [stitch\_continuously\_rotating\_object](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/stitch_continuously_rotating_object.py) - Stitch point clouds from a continuously rotating object
without pre-alignment using Local Point Cloud Registration
and apply Voxel Downsample.
- [stitch\_using\_robot\_mounted\_camera](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/stitch_using_robot_mounted_camera.py) - Stitch multiple point clouds captured with a robot mounted
camera.
- [stitch\_via\_local\_point\_cloud\_registration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/stitch_via_local_point_cloud_registration.py) - Stitch two point clouds using a transformation estimated
by Local Point Cloud Registration and apply Voxel
Downsample.
- [transform\_point\_cloud\_from\_millimeters\_to\_meters](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform_point_cloud_from_millimeters_to_meters.py) - Transform point cloud data from millimeters to meters.
- [transform\_point\_cloud\_via\_aruco\_marker](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform_point_cloud_via_aruco_marker.py) - Transform a point cloud from camera to ArUco marker
coordinate frame by estimating the marker's pose from the
point cloud.
- [transform\_point\_cloud\_via\_checkerboard](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/transform_point_cloud_via_checkerboard.py) - Transform a point cloud from camera to checkerboard (Zivid
Calibration Board) coordinate frame by getting checkerboard
pose from the API.
- **hand\_eye\_calibration**
- [hand\_eye\_gui](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/hand_eye_gui.py) - Hand-Eye Calibration GUI
- [pose\_conversion\_gui](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/pose_conversion_gui.py) - Convert between different rotation formats with a GUI:
- [pose\_conversions](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/pose_conversions.py) - Convert to/from Transformation Matrix (Rotation Matrix
+ Translation Vector).
- [robodk\_hand\_eye\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/robodk_hand_eye_calibration/robodk_hand_eye_calibration.py) - Generate a dataset and perform hand-eye calibration
using the Robodk interface.
- [utilize\_hand\_eye\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/utilize_hand_eye_calibration.py) - Transform single data point or entire point cloud from
camera to robot base reference frame using Hand-Eye
calibration
- [verify\_hand\_eye\_with\_visualization](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/verify_hand_eye_with_visualization.py) - Verify hand-eye calibration by transforming all
dataset point clouds and
- **ur\_hand\_eye\_calibration**
- [universal\_robots\_perform\_hand\_eye\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/ur_hand_eye_calibration/universal_robots_perform_hand_eye_calibration.py) - Script to generate a dataset and perform hand-eye
calibration using a Universal Robot UR5e robot.
- **robodk\_hand\_eye\_calibration**
- [robodk\_verify\_hand\_eye\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/hand_eye_calibration/robodk_hand_eye_calibration/robodk_verify_hand_eye_calibration.py) - Perform a touch test with a robot to verify
Hand-Eye Calibration using the RoboDK interface.
- **multi\_camera**
- [multi\_camera\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/multi_camera/multi_camera_calibration.py) - Use captures of a calibration object to generate
transformation matrices to a single coordinate frame,
from connected cameras.
- [multi\_camera\_calibration\_from\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/multi_camera/multi_camera_calibration_from_zdf.py) - Use captures of a calibration object to generate
transformation matrices to a single coordinate frame,
from ZDF files.
- [stitch\_by\_transformation](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/multi_camera/stitch_by_transformation.py) - Use transformation matrices from Multi-Camera
calibration to transform point clouds into a single
coordinate frame, from connected cameras.
- [stitch\_by\_transformation\_from\_zdf](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/multi_camera/stitch_by_transformation_from_zdf.py) - Use transformation matrices from Multi-Camera
calibration to transform point clouds into single
coordinate frame, from a ZDF files.
- **robot\_guidance**
- [robodk\_robot\_guidance](https://github.com/zivid/zivid-python-samples/tree/master/source/applications/advanced/robot_guidance/robodk_robot_guidance.py) - Guide the robot to follow a path on the Zivid
Calibration Board.
- **modules**
- **zividsamples**
- [calibration\_board\_utils](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/calibration_board_utils.py) - Utility functions for the Zivid calibration board.
- [camera\_verification](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/camera_verification.py) - def capture\_and\_measure\_from\_frame(frame: zivid.Frame)
-\> VerificationAndState:
- [color\_to\_grayscale](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/color_to_grayscale.py) - if rgba\_image.ndim \!= 3 or rgba\_image.shape\[2\] \!= 4: - [display](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/display.py) - Display relevant data for Zivid Samples.
- [paths](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/paths.py) - Get relevant paths for Zivid Samples.
- [robodk\_tools](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/robodk_tools.py) - Robot Control Module
- [save\_load\_matrix](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/save_load_matrix.py) - Save and load Zivid 4x4 transformation matrices from and
to YAML files.
- [save\_load\_transformation\_matrix](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/save_load_transformation_matrix.py) -
assert\_affine\_matrix\_and\_save(transformation\_matrix.as\_matrix(),
yaml\_path)
- [settings\_utils](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/settings_utils.py) - categories = zivid.presets.categories2d(camera.info.model)
- [transformation\_matrix](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/transformation_matrix.py) - Convenience functions and a class for 4x4 transformation
matrices.
- [white\_balance\_calibration](https://github.com/zivid/zivid-python-samples/tree/master/modules/zividsamples/white_balance_calibration.py) - Balance color for 2D capture using white surface as
reference.
## Installation
-----
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](https://support.zivid.com/latest//getting-started/software-installation.html).
2. [Download Zivid Sample
Data](https://support.zivid.com/latest//api-reference/samples/sample-data.html).
3. Check out the Zivid Python samples repository:
``` sourceCode bash
git clone http://github.com/zivid/zivid-python-samples.git
```
4. Install the runtime requirements using IDE or command line:
>
>
> ``` sourceCode bash
> 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:
>
> ``` sourceCode bash
> pip install ./modules
> ```
>
> -----
5. Open and run one of the samples.
-----
Note:
Running GUI samples on Windows should be done via `pythonw`.
-----
## Support
For more information about the Zivid cameras, please visit our
[Knowledge Base](https://support.zivid.com/latest). If you run into any
issues please check out
[Troubleshooting](https://support.zivid.com/latest/support/troubleshooting.html).
## License
Zivid Samples are distributed under the [BSD
license](https://github.com/zivid/zivid-python-samples/tree/master/LICENSE).