We can install the OpenNI library along with ROS packages. ROS is already interfaced with OpenNI, but the ROS desktop full installation may not install OpenNI packages; if so, we need to install it from the package manager.
The following command will install the ROS-OpenNI library (which is mainly supported by the Kinect Xbox 360 sensor) in Kinetic and Melodic:
$ sudo apt-get install ros-<version>-openni-launch
The following command will install the ROS-OpenNI 2 library (which is mainly supported by Asus Xtion Pro and Primesense Carmine):
$ sudo apt-get install ros-<version>-openni2-launch
The source code and latest build of OpenNI for Windows, Linux, and MacOS X is available at http://structure.io/openni.