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)
    • 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
      • print_version_info - Print version info about connected Zivid cameras and the installed Zivid SDK.
      • warmup - Short example of a basic way to warm up the camera with specified time and capture cycle.
  • applications

    • basic
      • visualization
      • 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
      • 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 or contact us at customersuccess@zivid.com.

Licence

Zivid Samples are distributed under the BSD license.