AnsweredAssumed Answered

Can I use opencv for imx6?

Question asked by song zhiyuan on Feb 12, 2020
Latest reply on Feb 12, 2020 by song zhiyuan

Can I use opencv for imx6?

When I use the gst-launch command。
   gst-launch 1.0 imxv4l2src device=/dev/video0! Imxv4l2sink device = / dev/video16

  /dev/video0 mean ov5640           /dev/video16 mean display device

It can display the image of the camera on the display device。

 

when i use opencv,error

VIDEOIO ERROR: libv4l unable to ioctl S_FMT
VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT

source :
#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;

I didn't make any changes to the kernel,I just wrote a test program to test opencv。

Why the error?

Or how do I pass the data from gst-launch to opencv?

VideoCapture capture(gst-launch .......“”);

May I do that?

If so, what should be the order?

thank you!

Outcomes