• Stars
    star
    206
  • Rank 189,446 (Top 4 %)
  • Language Cython
  • License
    MIT License
  • Created about 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python API for the ZED SDK

Stereolabs ZED - Python API

This package lets you use the ZED stereo camera in Python 3. The Python API is a wrapper around the ZED SDK which is written in C++ optimized code. We make the ZED SDK accessible from external Python code using Cython.

Getting started

Prerequisites

To start using the ZED SDK in Python, you will need to install the following dependencies on your system:

For the ZED SDK 3.8 compatible version, use the zedsdk_3.X branch or the 3.8 release tag

Please check your python version with the following command. The result should be 3.7 or higher.

python --version

Cython and Numpy can be installed via pip.

python -m pip install cython numpy

The sample dependencies can also be installed via pip

python -m pip install opencv-python pyopengl

Note: On Linux, it is advised to use the python3 command instead of python which by default point to python 2.7. To do so, the following packages python3-dev and python3-pip need to be installed.

Installing the Python API

A Python script is available in the ZED SDK installation folder and can automatically detect your platform, CUDA and Python version and download the corresponding pre-compiled Python API package.

Running the install script

Windows

The Python install script is located in: C:\Program Files (x86)\ZED SDK\

⚠️ Make sure you have admin access to run it in the Program Files folder, otherwise, you will have a Permission denied error. You can still copy the file into another location to run it without permissions.

Linux

The Python install script is located in: /usr/local/zed/

Run the script:

$ cd "/usr/local/zed/"
$ python get_python_api.py
    # The script displays the detected platform versions
    Detected platform: 
        linux_x86_64
        Python 3.11
        ZED SDK 4.0
    # Downloads and install the whl package
    -> Checking if https://download.stereolabs.com/zedsdk/4.0/whl/linux_x86_64/pyzed-4.0-cp311-cp311-linux_x86_64.whl exists and is available
    -> Found ! Downloading python package into /home/user/pyzed-4.0-cp311-cp311-linux_x86_64.whl
    -> Installing necessary dependencies
    ...
    Successfully installed pyzed-4.0

To install it later or on a different environment run :

$ python -m pip install --ignore-installed /home/user/pyzed-4.0-cp311-cp311-linux_x86_64.wh

That's it ! The Python API is now installed.

Use the plugin

Code

Import the packages in your Python terminal or file like this:

import pyzed.sl as sl

Vectors operations like norm, sum, square, dot, cross, distance but also simple operations can be done with Numpy package.

Run the tutorials

The tutorials provide simple projects to show how to use each module of the ZED SDK.

Run the examples

Please refer to the examples README for more informations.

Troubleshooting

"Numpy binary incompatiblity"

Traceback (most recent call last):
    ...
    File "__init__.pxd", line 918, in init pyzed.sl
ValueError: numpy.ufunc size changed, may indicate binary incompatiblity. Expected 216 from C header, got 192 from PyObject

This error usually means numpy isn't installed. To install it, simply run these commands :

# On Jetson (aarch64) cython needs to be installed first since numpy needs to be compiled.
python3 -m pip install cython
python3 -m pip install numpy

Compiling the Python API from source (only for developers of the python wrapper)

To compile the ZED SDK Python wrapper go to src folder to get the cython sources and instructions.

Note : This step is not useful for users of the wrapper, it is only meant to be used to extend the wrapper for advanced uses.

Support

If you need assistance go to our Community site at https://community.stereolabs.com/

More Repositories

1

zed-sdk

⚑️The spatial perception framework for rapidly building smart robots and spaces
C++
784
star
2

zed-ros-wrapper

ROS wrapper for the ZED SDK
C++
440
star
3

zed-unity

ZED SDK Unity plugin
C#
245
star
4

zed-yolo

3D Object detection using Yolo and the ZED in Python and C++
Python
155
star
5

zed-ros2-wrapper

ROS 2 wrapper for the ZED SDK
C++
148
star
6

zed-opencv

ZED SDK interface sample for OpenCV
C++
137
star
7

zed-open-capture

Low level Linux camera driver for the ZED USB3 stereo cameras. API docs available here:
C++
96
star
8

zed-ros-examples

Examples for the ZED SDK ROS wrapper
C++
85
star
9

zed-unreal-examples

Stereolabs ZED - UE4 Examples
C++
77
star
10

zed-tensorflow

3D Object detection using the ZED and Tensorflow
Python
77
star
11

zed-UE5

ZED plugin and examples for Unreal Engine 5 (Standard Engine)
C++
60
star
12

zed-gstreamer

Package of GStreamer elements to interface with ZED Cameras
C++
59
star
13

zed-pcl

ZED SDK interface sample for PCL, the Point Cloud Library
C++
58
star
14

zed-multi-camera

ZED SDK sample with multiple ZEDs
C++
52
star
15

zed-pytorch

3D Object detection using the ZED and Pytorch
Jupyter Notebook
48
star
16

zed-docker

Docker images for the ZED SDK
Dockerfile
48
star
17

zed-unreal-plugin

Stereolabs ZED - UE4 Plugin
C++
41
star
18

zed-openpose

Real-time 3D multi-person with OpenPose and the ZED
C++
40
star
19

zed-opencv-native

Native stereo capture with OpenCV
C++
37
star
20

zed-livelink

ZED LiveLink Plugin for Unreal
C++
32
star
21

zed-ros2-examples

A collection of examples and tutorials to illustrate how to better use the ZED cameras in the ROS2 framework
C++
30
star
22

zed-matlab

ZED SDK interface sample for Matlab
C++
28
star
23

zed-oculus

ZED Viewer for Oculus Rift
C++
27
star
24

zed-aruco

ZED SDK samples using ArUco tag detection
C++
21
star
25

zed-tracking-viewer

[DEPRECATED] ZED SDK sample to show the tracking capability
C++
17
star
26

zed-csharp-api

C# API for the ZED SDK
C#
10
star
27

zed-3d-social-distancing

Using 3D Cameras to Monitor Social Distancing
C++
10
star
28

zed-ros-interfaces

ROS interfaces for the ZED ROS Wrapper
CMake
9
star
29

zed-ros2-interfaces

ROS2 interfaces for the ZED ROS2 Wrapper
CMake
5
star
30

zed-hub-examples

ZEDHub app tutorials
Python
5
star
31

zed-isaac-sim

NVIDIA Isaac Sim integration for ZED SDK
Python
5
star
32

zed-unity-livelink

ZED Livelink plugin for Unity
C++
5
star
33

zed-opengl

ZED SDK interface sample for OpenGL
C++
2
star
34

zed-openni

C
2
star
35

zedx-one-capture

Camera control API for ZED X One GMSL2 cameras from Stereolabs
C++
2
star