Skip to content

zivid/zivid-python-samples

Repository files navigation

python-samples

This repository contains Python code samples for Zivid.

Build Status Zivid Image


Contents: Samples | Instructions | Support | Licence


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 demonstrate practical use of the output data from the camera, such as 3D point clouds or 2D images.

  • camera

    • basic (quick tutorial / complete tutorial)
      • capture - Capture point clouds, with color, from the Zivid camera.
      • capture_2d - Capture 2D images from the Zivid camera.
      • capture_assistant - Use Capture Assistant to capture point clouds, with color, from the Zivid camera.
      • capture_from_file - Capture point clouds, with color, from the Zivid file camera.
      • capture_with_settings_from_yml - Capture point clouds, with color, from the Zivid camera, with settings from YML file.
      • capture_hdr - Capture HDR 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.
    • 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.
    • info_util_other
      • print_version_info - Print version info about connected Zivid cameras and the installed Zivid SDK.
  • applications

    • basic
      • visualization
        • read_zdf_vis_3d - Read point cloud data from a ZDF file and visualize it.
          • Dependencies:
      • file_formats
        • convert_zdf - Convert point cloud data from a ZDF file to your preferred format (.ply, .csv, .txt, .png, .jpg, .bmp, .tiff).
          • Dependencies:
            • numpy version 1.19.2 or newer
            • OpenCV version 4.0.1 or newer.
        • read_iterate_zdf - Read point cloud data from a ZDF file, iterate through it, and extract individual points.
    • advanced
      • hand_eye_calibration
        • calibrate_eye_to_hand - Perform Eye-to-Hand calibration.
          • Dependencies:
            • numpy version 1.19.2 or newer
        • utilize_eye_in_hand_calibration - Transform a single data point or entire point cloud from the camera frame to the robot base frame using the Eye-in-Hand calibration matrix.
          • Dependencies:
            • numpy version 1.19.2 or newer
            • OpenCV version 4.0.1 or newer.
        • pose_conversions - Convert to/from Transformation Matrix (Rotation Matrix + Translation Vector).
          • Dependencies:
            • numpy version 1.19.2 or newer
            • OpenCV version 4.0.1 or newer.
            • Scipy version 1.4.0 or newer.
        • universal_robots_hand_eye_calibration
      • downsample - Downsample point cloud from a ZDF file.
        • Dependencies:
          • numpy version 1.19.2 or newer
          • Open3D version 0.12.0 or newer
      • create_depth_map - Read point cloud data from a ZDF file, convert it to OpenCV format, then extract and visualize depth map.
        • Dependencies:
          • numpy version 1.19.2 or newer
          • OpenCV version 4.0.1 or newer
      • mask_point_cloud - Read point cloud data from a ZDF file, apply a binary mask, and visualize it.
        • Dependencies:
      • gamma_correction - Capture 2D image with gamma correction.
        • Dependencies:
          • numpy version 1.19.2 or newer
          • OpenCV version 4.0.1 or newer
      • color_balance - Balance color of 2D image.
        • Dependencies:

Instructions

  1. Install Zivid Software. Note: The samples require Zivid SDK v2 (minor version 2.2 or newer).

  2. Install Zivid Python. Note: The recommended Python version for these samples is 3.7.

  3. Download Zivid Sample Data.

  4. [Optional] Launch the Python IDE of your choice. Read our instructions on setting up Python.

  5. Install the runtime requirements using IDE or command line:

    pip install -r requirements.txt
    
  6. Add the directory source to PYTHONPATH. Navigate to the root of the repository and run:

    • PowerShell: $env:PYTHONPATH=$env:PYTHONPATH + ";$PWD\source"
    • cmd: set PYTHONPATH="$PYTHONPATH;$PWD\source"
    • bash: export PYTHONPATH="$PYTHONPATH:$PWD/source"
  7. Open and run one of the samples.

Support

If you need assistance with using Zivid cameras, visit our Knowledge Base at https://help.zivid.com/ or contact us at customersuccess@zivid.com.

Licence

Zivid Samples are distributed under the BSD license.