Android library for depth estimation based on StereoSGBM from OpenCV.
The library consists of a single class called DepthEstimator
which computes depth maps from an
image pair (the so-called "stereo pair") based on the calibration parameters of the cameras which
took the images.
The current implementation is capable to compute up to 10 depth maps per second on modern Android smartphones.
To build this project you need an OpenCV build suitable for the required Android ABI in your system. Two options are available:
- (Recommended) Run
BuildOpenCV.cmake
script which will download and build OpenCV automatically with the recommended optimizations. Read more about how to run the script in the native part's README. You have to run it once for every Android ABI you plan to use. - Download and install the prebuilt OpenCV Android SDK. It may lack some possible optimizations.
After OpenCV is installed build the project with Gradle -- the library is available in
:sgbmdepth
module. It builds for all ABIs.
Currently, the library is automatically generated from its native implementation, so no
documentation is available in the resulting code. To read the DepthEstimator
documentation see
its native header.
An example application is available in :app
module. It computes a depth map from a pair of images
using the chosen calibration parameters and displays the resulting image also showing the time it
took to compute. You can get a sample stereo pair and calibration parameters for it
here to try it out and test the performance.