Hi i want to use external camera to capture image rather than in build camera
This is the current part that i'm using. How do i edit it so i can capture video from external camera?? I'm using Asus xtion pro live.
#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;
}
}
Asked by chiongsterx on 2014-09-15 01:26:45 UTC
Answers
Without any more information, I'll hazard the guess that cap(0)
uses the first device (your built-in camera). Have you tried opening the second device? So: cap(1)
?
Edit: please do not ask two questions in one post. Use a new post for your second question.
Asked by gvdhoorn on 2014-09-16 05:00:16 UTC
Comments
Hi i tried changing the cap(0) to cap(1) but it still accesses the default device. Any idea on what should i do?
Asked by chiongsterx on 2014-09-25 03:07:16 UTC
According to the docs for VideoCapture() the integer
parameter tells VideoCapture
which device to open. Have you ran catkin_make
after changing your code?
Asked by gvdhoorn on 2014-09-25 03:23:39 UTC
yes i did ran catkin_make after editing and saving the file. However it still opens the default webcam
Asked by chiongsterx on 2014-09-25 03:37:19 UTC
Comments