Using OpenNI and Opencv to Show Depthmap in Python


i recently got my Orbbec Astra Pro and i wanted to display the depth map in python using openni and opencv but i am unable to.Please help me


Thank You! :slight_smile:


How to install openni2?
I am using Persee with Ubuntu image.


What do you actually mean? you don’t need to install openni2, just download it and place somewhere in fs. Python bindings for openni2 installing by pip, as usual - “pip install primesense”

Yeah! I used PyOpenNI2 but it didn’t work. After installing primesense your sample code works perfectly.

@qlkvg Did you manage to get it working as a depth stream on the Orbbec Persee itself without it looking for external USBs? I’ve already tried changing the USBInterface to 0 in PS1080.ini etc Thanks

No, don’t have one. You’d better ask orbbec developer directly via mail about this.


I have the same doubt on how to install OpenNI2 (on Persee) to use with CodeBlocks.

were you able to figure it out?


can you explain a little more elaborately what is to be done to use OpenNI on linux (i am using it with Codeblocks in c++, instead of python)
What is this ‘fs’ that you mention of?

fs == filesystem
Just download OpenNI according to your machine architecture, place it somewhere (e.g. /opt) and use it. You need also to set env variables OPENNI_REDIST with path to libraries and OPENNI_INCLUDE with path to headers. You can find more information here -

hey, I know its been a minute since this post has been made, but anybody know how to save the depth/ir data ? i want to be able to find depth at certain regions. so a X,Y,Z coordinate system i guess. thanks .