Skip to content

Depth to normals preprocessing tool with Python and CUDA support for CVPR2019 paper 1899: DeepLiDAR: Deep Surface Normal Guided Depth Prediction for Outdoor Scene from Sparse LiDAR Data and Single Color Image

License

Notifications You must be signed in to change notification settings

valgur/surface-normal

 
 

Repository files navigation

surface-normal

This is a rewrite of JiaxiongQ/surface-normal – a data preprocessing tool for JiaxiongQ/DeepLiDAR.

The calplanenormal() from the original code is provided as a setup.py-installable Python library with a single function: surface_normal.normals_from_depth.

Also uses CUDA for processing, if available, which cuts down the processing time for the full KITTI depth dataset from hours to just minutes.

Setup

Build and install the library. Requires CMake 3.11+, OpenCV 3+ and Eigen3. Both Python 2 and 3 are supported.

python setup.py install

For CUDA support, the following environment variables might need to be set with appropriate values:

export CUDACXX=/usr/local/cuda-10.2/bin/nvcc
# if the default compiler is not yet supported by CUDA
export CUDAHOSTCXX=/usr/bin/g++-8

Usage

Takes a depth image (such as the ones provided with the KITTI depth completion dataset) as input and outputs estimated normals as an RGB image. The scale of the depth values does not matter.

from surface_normal import normals_from_depth

# Camera intrinsics
f  = 721.5377
cx = 609.5593
cy = 172.8540
normals_from_depth("depth.png", "normals.png",
    intrinsics=(f, cx, cy),
    window_size=15,
    max_rel_depth_diff=0.1
)

Additionally, numpy.ndarray input-output is available with normals_from_depth_numpy().

Depth input example

depth

Normals output

normals

Citation

If you use the code or method in your work, please cite the following:

@inproceedings{qiu2018deeplidar,
  title={DeepLiDAR: Deep Surface Normal Guided Depth Prediction for Outdoor Scene from Sparse LiDAR Data and Single Color Image},
  author={Qiu, Jiaxiong and Cui, Zhaopeng and Zhang, Yinda and Zhang, Xingdi and Liu, Shuaicheng and Zeng, Bing and Pollefeys, Marc},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
  year={2019}
}

Authors

License

MIT

About

Depth to normals preprocessing tool with Python and CUDA support for CVPR2019 paper 1899: DeepLiDAR: Deep Surface Normal Guided Depth Prediction for Outdoor Scene from Sparse LiDAR Data and Single Color Image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 77.9%
  • Cuda 10.0%
  • Python 6.6%
  • CMake 5.5%