Ask Your Question
0

Hi i want to use external camera to capture image rather than in build camera [closed]

asked 2014-09-15 01:26:45 -0500

chiongsterx gravatar image

updated 2014-09-25 03:07:57 -0500

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;
}
   }
edit retag flag offensive reopen merge delete

Closed for the following reason OpenCV Question: THe OpenCV community prefers to answer questions at: http://answers.opencv.org/questions/ by tfoote
close date 2014-12-16 02:34:15.586699

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-16 05:00:16 -0500

gvdhoorn gravatar image

updated 2014-09-16 06:14:36 -0500

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.

edit flag offensive delete link more

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?

chiongsterx gravatar image chiongsterx  ( 2014-09-25 03:07:16 -0500 )edit

According to the docs for VideoCapture() the integer parameter tells VideoCapture which device to open. Have you ran catkin_make after changing your code?

gvdhoorn gravatar image gvdhoorn  ( 2014-09-25 03:23:39 -0500 )edit

yes i did ran catkin_make after editing and saving the file. However it still opens the default webcam

chiongsterx gravatar image chiongsterx  ( 2014-09-25 03:37:19 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-09-15 01:26:45 -0500

Seen: 872 times

Last updated: Sep 25 '14