AnsweredAssumed Answered

opencv报错

Question asked by song zhiyuan on Mar 20, 2020
Latest reply on Mar 24, 2020 by Bio_TICFSL

开发板:imx6q

内核:4.1.15

opencv:3.1

摄像头:usb摄像头

已经将交叉编译的opencv移植到开发板/lib下。

 

源文件:

#include <opencv2/ opencv.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui. hpp>
#include <opencv2/videoio. hpp>
#include <iostream>
using nanespace CV;
using namespace std;
int main()
{
cout<<"Built with opencv"<<CV_ VERSION<<endl;
VideoCapture capture(0);
if( !capture. isopened())
cout<<"open camera failed."<<endl;
return - 1;
}
Mat frame;
while( 1)
capture>>frame ;
if(frame . empty())
break;
imshow( "video" , frame);
if(waitKey(20)>0)
break;
}
return 0;

运行可行性文件。

GStreamer Plugin: Embedded video playback halted; module v4l2src0 reported: Could not open device '/dev/video0' for reading and writing.
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /usr/src/debug/opencv/3.1+gitAUTOINC+92387b1ef8-r0/git/modules/videoio/src/cap_gstreamer.cpp, line 818
terminate called after throwing an instance of 'cv::Exception'
  what():  /usr/src/debug/opencv/3.1+gitAUTOINC+92387b1ef8-r0/git/modules/videoio/src/cap_gstreamer.cpp:818: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer
Aborted
这是什么原因?缺少哪些东西?谢谢!

Outcomes