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
- First, download the latest version of the ZED SDK on stereolabs.com.
- For more information, read the ZED Documentation and API documentation or our Community page
OpenCV can be installed from source on Linux, please refer to this guide to proceed with the installation.
Read the guide to learn how to build and launch this sample in C++.
Read the guide to learn how to build and launch this sample in Python.
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.
- Install the required dependencies
sudo apt-get install build-essential cmake libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
- Download source archive from http://opencv.org/releases.html and extract it
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
- Install the libraries
sudo make install
If you need assistance go to our Community site at https://community.stereolabs.com/