NVlabs / instant-ngp

Instant neural graphics primitives: lightning fast NeRF and more
https://nvlabs.github.io/instant-ngp
Other
15.57k stars 1.89k forks source link

Fix nerfcapture2nerf.py to allow to run it without depth info #1533

Open Konstantysz opened 2 months ago

Konstantysz commented 2 months ago

As written in pybind issue, when passing None to C++ function, numpy actually passes NaN. This leads to access violation as (const float*)depth_buf.ptr in void set_image(int frame_idx, pybind11::array_t<float> img, pybind11::array_t<float> depth_img, float depth_scale) is not nullptr, while being empty. Other solution would be to make void set_image(int frame_idx, pybind11::array_t<float> img, pybind11::array_t<float> depth_img, float depth_scale) argument depth_img type std::optional<pybind11::array_t<float>>. This would lead to no code duplication, however requires C++17.