opencv报错

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

opencv报错

907 Views
zhiyuan_song
Contributor II

开发板: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
这是什么原因?缺少哪些东西?谢谢!
Tags (1)
0 Kudos
1 Reply

866 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello Song

If you could not open video. the video must be in /dev/videox not in video0, and check if the camera is compatible with i.MX6.

Regards

0 Kudos