开发板: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;
运行可行性文件。
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