Ask Your Question

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

asked 2014-10-09 07:12:46 -0600

chiongsterx gravatar image

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.

edit retag flag offensive close merge delete


Is your camera connected?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-10-09 07:26:49 -0600 )edit

if your regular webcam is 0, then the asus one might be VideoCapture cap(CV_OPENNI_ASUS + 1)

berak gravatar imageberak ( 2014-10-09 08:19:22 -0600 )edit

Yes the camera is connected.

chiongsterx gravatar imagechiongsterx ( 2014-10-09 21:39:18 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-14 11:04:35 -0600

eduard626 gravatar image
edit flag offensive delete link more

Question Tools


Asked: 2014-10-09 07:12:46 -0600

Seen: 2,527 times

Last updated: Nov 14 '14