diff --git a/samples/cpp/openni_capture.cpp b/samples/cpp/openni_capture.cpp index 76b092298a..64aa90bc69 100644 --- a/samples/cpp/openni_capture.cpp +++ b/samples/cpp/openni_capture.cpp @@ -192,7 +192,11 @@ int main( int argc, char* argv[] ) if( isVideoReading ) capture.open( filename ); else - capture.open( CAP_OPENNI ); + { + capture.open( CAP_OPENNI2 ); + if( !capture.isOpened() ) + capture.open( CAP_OPENNI ); + } cout << "done." << endl;