Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6764 Discussions

Opencv detects and displays video from webcam, but not firewire

Lakshmi_N_
Beginner
646 Views

I have connected a cam through firewire and tried to access it using opencv. The camera is detected in coriander and able to get a video stream. Below is the code I used

        #include "/home/iiith/opencv-2.4.9/include/opencv/cv.h"
        #include "/home/iiith/opencv-2.4.9/include/opencv/highgui.h"
        #include "cxcore.h"
        #include <iostream>

        using namespace cv;
        using namespace std;

        int main(int,char**)
        {
            VideoCapture cap(0);
            if(!cap.isOpened())
                cout<<"Camera not detected"<<endl;
            while(1)
            {
                Mat frame;
                namedWindow("display",1);
                cap >> frame;
                imshow("display",frame);
                waitKey(0);    
            }
        }

When I run this code, the video is streamed from the webcam instead of my firewire cam. I tried the same code in my friend's system and there the firewire cam was detected. I tested the settings using different commands such as **testlibraw** , **lsmod** and they are all the same. Even the  Opencv version, 2.4.9, Ubuntu 12.04 are all the same. This is really bizarre and am at this for 2 days. Can anyone please tell me what the difference could be? How can I get the external cam detected in opencv? Thanks in advance. 

Note : Does this have something to have with setting the default cam? Thanks.

Update 1 : VideoCapture cap(1) gives the following error
HIGHGUI ERROR: V4L: index 1 is not correct!

Does this mean the camera is not recognized?

0 Kudos
1 Reply
Chao_Y_Intel
Moderator
646 Views

Hello,
Possibly  there is someone in this forum know the OpenCV as well, but a better place you can post your question is OpenCV support forum:
http://answers.opencv.org/questions/

Thanks,
Chao
 

0 Kudos
Reply