Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 4615

Trouble with webcam opening on ubuntu 16.04 C++

$
0
0
I have tried to confirm that OpenCV is working on a new install I have just completed and found that I could open a jpeg and went on to check the web cam. I have installed cheese and found the web cam is working and drivers are all setup, as far as I could tell. I then went to find some example code to open the camera just to confirm it's all working and I am greeted with this message when I execute the program: OpenCV Error: Unspecified error (GStreamer: unable to start pipeline ) in cvCaptureFromCAM_GStreamer, file /opt/opencv/modules/videoio/src/cap_gstreamer.cpp, line 887 VIDEOIO(cvCreateCapture_GStreamer(CV_CAP_GSTREAMER_V4L2, reinterpret_cast(index))): raised OpenCV exception: /opt/opencv/modules/videoio/src/cap_gstreamer.cpp:887: error: (-2) GStreamer: unable to start pipeline in function cvCaptureFromCAM_GStreamer This is the example code I am trying to execute: #include "opencv2/opencv.hpp" using namespace cv; int main(int argc, char** argv) { VideoCapture cap; // open the default camera, use something different from 0 otherwise; // Check VideoCapture documentation. if(!cap.open(0)) return 0; for(;;) { Mat frame; cap >> frame; if( frame.empty() ) break; // end of video stream imshow("this is you, smile! :)", frame); if( waitKey(10) == 27 ) break; // stop capturing by pressing ESC } // the camera will be closed automatically upon exit // cap.close(); return 0; }

Viewing all articles
Browse latest Browse all 4615


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>