简体   繁体   English

Opencv无法在Linux上检测到Firewire网络摄像头

[英]Opencv doesn't detect firewire webcam on linux

I have connected a cam through firewire and tried to access it using opencv. 我已经通过火线连接了一个凸轮,并尝试使用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. 当我运行此代码时,视频是从网络摄像头而不是Firewire凸轮流式传输的。 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. 我使用不同的命令(如testlibrawlsmod)测试了设置,它们都是相同的。 Even the Opencv version, 2.4.9, Ubuntu 12.04 are all the same. 即使是Opencv版本2.4.9,Ubuntu 12.04都一样。 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? 如何在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! 更新1:VideoCapture cap(1)给出以下错误HIGHGUI错误:V4L:索引1不正确!

Does this mean the camera is not recognized? 这是否意味着无法识别相机?

First, you should be sure that camera is recognized from your so 首先,您应该确保从您的相机中识别出相机

  • unplug camera and wait few seconds; 拔下相机插头,等待几秒钟;
  • open terminal and digit: 打开终端和数字:
    • watch dmesg 看dmesg
    • lspci | lspci | grep -E -i "(1394|firewire)" #this could give you something grep -E -i“(1394 | firewire)”#这可以给你一些东西
  • plug your device and read new entry on terminal 插入设备并在终端上读取新条目
  • if your device is recognized you can launch a command like this: 如果设备被识别,则可以启动如下命令:
    • mplayer tv:// -tv driver=v4l2:width=352:height=288 mplayer tv://-电视驱动程序= v4l2:width = 352:height = 288

The Possible problem could be that the camera connected through firewire is not recognized by the system. 可能的问题可能是系统无法识别通过火线连接的摄像机。

First try to see the camera output using AMcap or some other webcam software and check if you are able to see this. 首先尝试使用AMcap或其他网络摄像头软件查看摄像头输出,然后检查是否能够看到此输出。

If you not able to see the video in amcap then it means that drivers of that particular camera is missing. 如果看不到amcap中的视频,则意味着该特定摄像机的驱动程序丢失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM