Ask Your Question

Revision history [back]

How do i use opencv with openni to use Asus xtion pro live camera?

im currently using opencv to detect object base on colour, however i want to open an external camera rather then internal webcam. However, i tired editting the the coding but yet it kept auto using the internal webcam.

 #include <iostream>
 #include "opencv2/highgui/highgui.hpp"
 #include "opencv2/imgproc/imgproc.hpp"

 using namespace cv;
 using namespace std;

   int main( int argc, char** argv )
 {
  VideoCapture cap(0); //capture the video from web cam

 if ( !cap.isOpened() )  // if not success, exit program
 {
     cout << "Cannot open the web cam" << endl;
     return -1;
}

I tired editting VideoCapture cap(0) to (1) or any other digit but it still uses the internal webcam. I even tried VideoCapture cap(CV_OPENNI_ASUS) but still can't do it.

Please advice thanks.