Repository: opencv
Issue: Kinect Sensor not working with OpenCV3 and OpenNI2
Labels: priority: low,category: videoio(camera)

##### System information (version)
- OpenCV => 3.3
- Operating System / Platform => Ubuntu 16 ARM64 (aarch64) 
- Compiler => g++ (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

##### Detailed description

My Jetson TX1 ARM64 ubuntu 16 system is running libfreenect2 (Protonect) and OpenNi2 (NiViewer2) successfully. I read Opencv 3 has some additional requirements (https://docs.opencv.org/3.0-beta/doc/user_guide/ug_highgui.html) for working with kinect sensor data like PrimeSensor Module (OPENNI_PRIME_SENSOR_MODULE_BIN_DIR). Opencv was built with -DWITH_OPENNI2=ON and compiles fine, but I run into the following error when I ran cpp-example-openni_capture:

/home/nvidia/opencv/modules/videoio/src/cap_openni2.cpp:299: error: (-2) CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't set color stream output mode: Stream setProperty(3) failed in function toggleStream


##### Steps to reproduce
Nvidia Jetson TX1 (hardware)
Xbox One Kinect Sensor (hardware)
Install libfreenect2
Install OpenNi2
Install OpenCV 3.3 with examples
Install Sensor Kinect (https://github.com/antoniodourado/SensorKinectTX1)
Run cpp-example-openni_capture opencv example 

---------------------------------------------------------------------------------------------------------------------
```.sh
(testpy3) nvidia@tegra-ubuntu:~/opencv/build/bin$ ./cpp-example-openni_capture
Device opening ...
3583 INFO New log started on 2017-12-27 21:52:39
3615 INFO --- Filter Info --- Minimum Severity: VERBOSE
3672 VERBOSE No override device in configuration file
3710 VERBOSE Configuration has been read from '/etc/openni2/OpenNI.ini'
3731 VERBOSE OpenNI 2.2.0 (Build 33)-Linux-generic (Jan 24 2016 23:21:00)
3747 VERBOSE Extending the driver path by '/usr/lib/OpenNI2/Drivers', as configured in file '/etc/openni2/OpenNI.ini'
3766 VERBOSE Using '/usr/lib/OpenNI2/Drivers' as driver path
3773 VERBOSE Looking for drivers in drivers repository '/usr/lib/OpenNI2/Drivers'
15738 INFO New log started on 2017-12-27 21:52:39
15764 INFO --- Filter Info --- Minimum Severity: VERBOSE
15778 VERBOSE Initializing USB...
29881 INFO USB is initialized.
37006 INFO New log started on 2017-12-27 21:52:39
37031 INFO --- Filter Info --- Minimum Severity: VERBOSE
37053 VERBOSE Initializing USB...
51784 INFO USB is initialized.
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 14 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:6 with serial 015802564847
[Info] [Freenect2Impl] found 1 devices
187432 INFO Found device freenect2://0
187445 INFO Driver: register new uri: freenect2://0
187456 INFO Device connected: Microsoft Kinect (freenect2://0)
187476 INFO Device state changed: Microsoft Kinect (freenect2://0) to 0
187489 INFO Driver: register new uri: freenect2://0?depth-size=640x480
187498 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=640x480)
187509 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=640x480) to 0
187519 INFO Driver: register new uri: freenect2://0?depth-size=512x424
187527 INFO Device connected: Microsoft Kinect (freenect2://0?depth-size=512x424)
187538 INFO Device state changed: Microsoft Kinect (freenect2://0?depth-size=512x424) to 0
188899 VERBOSE Trying to open device by URI '(NULL)'
188931 INFO deiveOpen: freenect2://0
188941 INFO Opening device freenect2://0
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 2016384 ir: 608*33792
[Info] [Freenect2DeviceImpl] opened
437992 INFO Device: createStream(depth)
438115 INFO Freenect2Driver::Device: start()
[Info] [Freenect2DeviceImpl] starting...
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
1051623 INFO Device: createStream(color)
OpenCV Error: Unspecified error (CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't set color stream output mode: Stream setProperty(3) failed

) in toggleStream, file /home/nvidia/opencv/modules/videoio/src/cap_openni2.cpp, line 299
1052240 INFO Device: destroyStream(color)
1052285 INFO Freenect2Driver::Device: stop()
[Info] [RgbPacketStreamParser] packetsize or sequence doesn't match!
[Info] [Freenect2DeviceImpl] stopping...
[Info] [Freenect2DeviceImpl] canceling rgb transfers...
[Info] [Freenect2DeviceImpl] canceling depth transfers...
[Info] [Freenect2DeviceImpl] stopped
2088603 INFO Device: destroyStream(depth)
2088646 INFO Closing device freenect2://0
2088653 INFO Freenect2Driver::Device: stop()
2088657 INFO Freenect2Driver::Device: close()
2088662 INFO Freenect2Driver::Device: stop()
[Info] [Freenect2DeviceImpl] closing...
[Info] [Freenect2DeviceImpl] releasing usb interfaces...
[Info] [Freenect2DeviceImpl] deallocating usb transfer pools...
[Info] [Freenect2DeviceImpl] closing usb device...
[Info] [Freenect2DeviceImpl] closed
VIDEOIO(cvCreateCameraCapture_OpenNI2(index)): raised OpenCV exception:

/home/nvidia/opencv/modules/videoio/src/cap_openni2.cpp:299: error: (-2) CvCapture_OpenNI2::CvCapture_OpenNI2 : Couldn't set color stream output mode: Stream setProperty(3) failed

in function toggleStream

CvCapture_OpenNI::CvCapture_OpenNI : Failed to enumerate production trees: Can't create any node of the requested type!
done.
Can not open a capture object.
```