/zed-opencv

ZED SDK interface sample for OpenCV

Primary LanguagePythonMIT LicenseMIT

Stereolabs ZED - OpenCV

This sample is the perfect place to get started coding with the ZED and OpenCV. It shows how to:

  • Capture image, depth and point cloud from the ZED.
  • Convert image and depth map to compatible 32-bits float OpenCV matrix.
  • Display video and depth with OpenCV.
  • Adjust several depth parameters: depth sensing mode, quality, units, resolution.
  • Save side by side image, depth image and point cloud in various formats

Getting started

Prerequisites

OpenCV can be installed from source on Linux, please refer to this guide to proceed with the installation.

C++

Read the guide to learn how to build and launch this sample in C++.

Python

Read the guide to learn how to build and launch this sample in Python.

Installing OpenCV

Installing OpenCV on Windows

OpenCV provides already compiled binaries, it can be downloaded at https://opencv.org/releases/

Installing OpenCV on Linux

Some sample can require OpenCV, here is a tutorial on how to install it.

OpenCV can be downloaded at this location : https://opencv.org/releases/

For a more detailed OpenCV tutorial installation, refer to the opencv documention.

Installation steps

  • Install the required dependencies
sudo apt-get install build-essential cmake libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
wget https://github.com/opencv/opencv/archive/4.1.0.zip -O /tmp/opencv_src.zip
cd ~/
unzip /tmp/opencv_src.zip ; rm /tmp/opencv_src.zip
  • Navigate to the extracted sources, create a temporary build directory and enter it. For example,
cd ~/opencv-*
mkdir build
cd build
  • Run cmake
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_JAVA=OFF -DWITH_OPENGL=ON ..
  • Execute make. The compilation can take a while
make -j$(nproc)
  • Install the libraries
sudo make install

Support

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