Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cannot identify device '/dev/video0'

Hello,

I'm trying read the video from a camera connected to my computer using OpenCV.

I tried this first test, and I got the following error message :

"GStreamer Plugin: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video0'. OpenCV Error: Unspecified error (GStreamer: unable to start pipeline ) in cvCaptureFromCAM_GStreamer, file 'file_location'/opencv-3.1.0/modules/videoio/src/cap_gstreamer.cpp, line 818 terminate called after throwing an instance of 'cv::Exception' what(): 'file_location'/opencv-3.1.0/modules/videoio/src/cap_gstreamer.cpp:818: error: (-2) GStreamer: unable to start pipeline in function cvCaptureFromCAM_GStreamer

Aborted"

Here is the code :

   #include "opencv2/opencv.hpp"
#include <stdio.h>

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
    {
        std::cout << " Cannot open video" << std::endl;
        return -1;
    }

    Mat edges;
    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructorcd ,,
    return 0;
}

If someone has an idea that would be very helpful !

Thank you very much in advance.

Florence

Cannot identify device '/dev/video0''/dev/video0' - video reading OpenCV 3.1

Hello,

I'm trying read the video from a camera connected to my computer using OpenCV.

I tried this first test, and I got the following error message :

"GStreamer Plugin: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video0'. OpenCV Error: Unspecified error (GStreamer: unable to start pipeline ) in cvCaptureFromCAM_GStreamer, file 'file_location'/opencv-3.1.0/modules/videoio/src/cap_gstreamer.cpp, line 818 terminate called after throwing an instance of 'cv::Exception' what(): 'file_location'/opencv-3.1.0/modules/videoio/src/cap_gstreamer.cpp:818: error: (-2) GStreamer: unable to start pipeline in function cvCaptureFromCAM_GStreamer

Aborted"

Here is the code :

   #include "opencv2/opencv.hpp"
#include <stdio.h>

using namespace cv;

int main(int, char**)
{
    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened())  // check if we succeeded
    {
        std::cout << " Cannot open video" << std::endl;
        return -1;
    }

    Mat edges;
    namedWindow("edges",1);
    for(;;)
    {
        Mat frame;
        cap >> frame; // get a new frame from camera
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if(waitKey(30) >= 0) break;
    }
    // the camera will be deinitialized automatically in VideoCapture destructorcd ,,
    return 0;
}

If someone has an idea that would be very helpful !

Thank you very much in advance.

Florence