[zed] using zed camera from scratch (I): installation, configuration and test under Windows

Time:2022-5-3

introduction

By using zed step by step from installation on a laptop reinstalled with Windows system, the author hopes to complete a relatively perfect zed use column by taking a series of notes. While sorting out the ideas, the author can also give readers some reference.

Computer configuration description

At present, the notebook used by the author is equipped with win10 20h2 system, as well as its own NVIDIA geforce 940 MX GPU and i5-7200 CPU. Other environments are basically not installed. The basic environment required to install and configure zed from scratch.

1. Installation and configuration of zed under win10

For this part, the author refers to the blog:Zed camera learning note 1 – installation and configuration (win10 + Python)
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
The model of zed binocular camera is zed 2 stereo camera (zed2 stereo camera, stereolabs, San Francisco, USA), which also includes USB 3.0 data cable and a mini tripod.

1.1 installation of CUDA + cudnn

This part can refer to the author’s blog[windows10] install the graphics card driver + CUDA + cudnn

  1. Install the appropriate graphics card driver according to the graphics card model of the notebook
  2. Install the appropriate CUDA + cudnn according to the graphics card driver
    If cudn + CUDA is successfully configured, it will be displayed in the terminal figure:
NVIDIA SMI # view graphics card driver information
Nvcc - V # view CUDA information

[zed] using zed camera from scratch (I): installation, configuration and test under Windows

1.2 installing zed-sdk

Download the SDK corresponding to the computer operating system and CUDA version. The official download link is as follows:Zed-sdk download official website
The version information downloaded by the author is as follows:
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Double click to install. The screenshot of the installation process is as follows:
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Default installation address
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Installation complete!

Add environment variable

C:\Program Files (x86)\ZED SDK\dependencies\freeglut_2.8\x64
C:\Program Files (x86)\ZED SDK\dependencies\glew-1.12.0\x64
C:\Program Files (x86)\ZED SDK\dependencies\opencv_3.1.0\x64
C:\Program Files (x86)\ZED SDK\bin

[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Enter the tools subfolder in the zed SDK folder and run zed explorer Exe and zed depth viewer Exe to check whether the zed camera can work normally
[zed] using zed camera from scratch (I): installation, configuration and test under Windows

The opening interface is shown as follows:
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
[zed] using zed camera from scratch (I): installation, configuration and test under Windows

1.3 installation of zed Python API (pyzed)

First, install opencv python. Refer to the blog:[Anaconda] install opencv
The terminal enters the zed SDK installation folder and runs get_ python_ api. Py file (this file can automatically detect the operating system, CUDA and python versions and download the corresponding precompiled Python API package (pyzed))
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
The instructions are as follows:

cd C:\Program Files (x86)\ZED SDK
python get_python_api.py

The following error occurred
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Download the file manually and install it again. If it succeeds, the display is as shown in the figure below

#Download full path
pip install D:\TOOL\pyzed-3.5-cp39-cp39-win_amd64.whl -i https://pypi.douban.com/simple

[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Updated on February 22, 2022
------------------------------------------------------------------------------------------------------------------------
Download the following three files (supplementary)PyOpenGL、PyOpenGL_accelerate)Put it under the SDK folder
Note: the version of the author’s screenshot is not necessarily the version that the reader can run. The specific version should be prompted when running the following instructions

python get_python_api.py

[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Execute code at the terminal for installation

pip install pyzed-3.6-cp37-cp37m-win_amd64.whl -i https://pypi.douban.com/simple
pip install PyOpenGL-3.1.5-cp37-cp37m-win_amd64.whl -i https://pypi.douban.com/simple
pip install PyOpenGL_accelerate-3.1.5-cp37-cp37m-win_amd64.whl -i https://pypi.douban.com/simple

Re execution

python get_python_api.py

The terminal displays as follows:
[zed] using zed camera from scratch (I): installation, configuration and test under Windows
Full implementation of zed_ SDK environment setup!
------------------------------------------------------------------------------------------------------------------------

2 test installation

New file test Py, as follows:

import pyzed.sl as sl


def main():
    # Create a Camera object
    zed = sl.Camera()

    # Create a InitParameters object and set configuration parameters
    init_params = sl.InitParameters()
    init_params.sdk_verbose = False

    # Open the camera
    err = zed.open(init_params)
    if err != sl.ERROR_CODE.SUCCESS:
        exit(1)

    # Get camera information (ZED serial number)
    zed_serial = zed.get_camera_information().serial_number
    print("Hello! This is my serial number: {0}".format(zed_serial))

    # Close the camera
    zed.close()


if __name__ == "__main__":
    main()

Run the file on the terminal, and the terminal displays the following, indicating that zed configuration is completed!
[zed] using zed camera from scratch (I): installation, configuration and test under Windows

To sum up, complete the first step of zed use