diff --git a/modules/videoio/src/cap_openni2.cpp b/modules/videoio/src/cap_openni2.cpp index a39b897e04..12faa297f2 100644 --- a/modules/videoio/src/cap_openni2.cpp +++ b/modules/videoio/src/cap_openni2.cpp @@ -231,6 +231,14 @@ CvCapture_OpenNI2::CvCapture_OpenNI2( int index ) return; } + // find appropriate device URI + openni::Array ldevs; + if (index > 0) + { + openni::OpenNI::enumerateDevices(&ldevs); + deviceURI = ldevs[index].getUri(); + } + status = device.open(deviceURI); if( status != openni::STATUS_OK ) {