This exapmle shows stereo depth estimation based on OpenCV. 

Build and Run depth sample

You can find sources in this repository Depth

Example requires opencv so we need to install it

sudo apt-get install python3-opencv

for now you can run sample which display depth image

python depth_sample.py

Adtiust sample to cameras

Depending on the cameras and lenses used, you need to adjust the StereoSGBM configuration. Also You need to remember to calibrate the camera.

 

You can find C++ and Python code for Raspberry Pi4 in the
SaraKIT Github repository:
https://github.com/SaraEye