Code Monkey home page Code Monkey logo

depthmapper's Introduction

depthmapper

This is a (relatively) small utility to be used as a testbed for experimenting with stereo depth mapping in OpenCV.

I built this to find how well depth mapping works on the Nvidia Jetson Nano. Support is present for StereoBM and StereoSGBM, as well as experimental support for AANet+.

Hardware-wise, this utility has been used with the WaveShare IMX219-83 stereo camera.

Python 3.6 or higher is needed.

See this YouTube video for a brief(-ish) overview:

Stereo depth mapping with OpenCV and Jetson Nano | DIY drone pt. 2

Running the utility

First, update submodules: git submodule update --init --recursive

You'll want to install requirements:

conda env create -f environment.yml
conda activate depthmapper

(note: PyTorch is optional)

Assuming you have a stereo camera board attached and available on /dev/video0 and /dev/video1, you should be able to just run:

python3 main.py

By default, cameras are accessed using nvarguscamerasrc which is specific to the Nvidia Jetson family. You should change this in lib/helpers.py if this is incorrect for your hardware setup.

You can choose which algorithm is used via the -m command line switch:

python main.py -m <algorithm>

options:

-m stereobm
-m stereosgbm
-m aanet

StereoBM is the default if this option is omitted.

Note on AANet

AANet is an optionally supported algorithm, and as such you don't need PyTorch installed if you don't plan to use it.

If you do want it, you'll want to download a pre-trained model for it. These can be downloaded from here, then placed into ./models. Make sure to update settings.conf to the name of the model you wish to use.

Output

For now, output is the generated disparity map and is shown in a new window. By default, the left hand frame the map corresponds to is shown too.

Configuration

All configuration is to be done via a config file, named settings.conf. I've made sure to write comments in the default configuration file to give an understanding of what each parameter does.

This file needs to live next to main.py, and will be automatically loaded.

Considerations

On the Nvidia Jetson, OpenCV is installed by default with Python bindings. However, you may wish to use a virtual environment for Python. I used an arm64 version of Miniforge3.

License

BSD 2-clause.

This software is freely available, but isn't very useful outside a bench testing scenario.

depthmapper's People

Contributors

matchstic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.