Opencv & VideoCapture Help !

Moderators: Oren.R, Eran.M

ingeln991
Posts: 15
Joined: Thu Apr 27, 2017 6:05 pm

Opencv & VideoCapture Help !

Postby ingeln991 » Thu May 04, 2017 1:24 pm

Hello everyone !!!
I'm building an application with opnecv that needs to acquiring videos from camera ( i've got a var-som-dual i.mx6 with the evaluation board camera ).
When i run the executable file of my application from the board terminal, it doesn't response !!!
The terminal says to me :

-------------------------

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

Killed

-------------------------

every project that doesn't use the cam works fine !
How can i solve it ????

varigigi
Posts: 52
Joined: Tue Nov 01, 2016 10:25 am

Re: Opencv & VideoCapture Help !

Postby varigigi » Tue May 09, 2017 1:56 pm

Hi Andrea,
although latest community available version is 3.2, Yocto builds use OpenCV 3.1 version.
Could you please confirm that your sample code is aligned to OpenCV 3.1 examples?
According your errors, the videoio module is complain for a couple of problems:
- VIDEOIO ERROR: libv4l unable to ioctl S_FMT
libv4l is failing an image format change, maybe you have camera communication problems
- VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT
libv4l is failing an actually deprecated ioctl call, something related to Linux 2.6...

Please consider that if you are using the MIPI camera, even from OpenCV, you are supposed to access it via Gstreamer framework.
Assuming you are using our latest Morty/Debian images, gstreamer pipeline to be integrated in OpenCV should be something like
gst-launch-1.0 imxv4l2videosrc imx-capture-mode=5 ! imxeglvivsink


BR
Pier

ingeln991
Posts: 15
Joined: Thu Apr 27, 2017 6:05 pm

Re: Opencv & VideoCapture Help !

Postby ingeln991 » Tue May 09, 2017 3:10 pm

Hi Varigigi..always thanks for the answer !

Yes, i'm using opencv3.1 and i'm using the MIPI camera of the evaluation board

how can i integrate my image with gst-launch-1.0 imxv4l2videosrc imx-capture-mode=5 ! imxeglvivsink ?

if there is a step-by-step procedure, will be great !

I'm very sorry, but is the first time that i use linux (Ubuntu14.04) :(
Last edited by ingeln991 on Tue May 09, 2017 3:16 pm, edited 1 time in total.

varigigi
Posts: 52
Joined: Tue Nov 01, 2016 10:25 am

Re: Opencv & VideoCapture Help !

Postby varigigi » Tue May 09, 2017 3:16 pm

Hi Andrea,
please have a look here:

http://stackoverflow.com/questions/4380 ... -gstreamer

BR
Pier

ingeln991
Posts: 15
Joined: Thu Apr 27, 2017 6:05 pm

Re: Opencv & VideoCapture Help !

Postby ingeln991 » Tue May 09, 2017 4:23 pm

thank you for all varigigi. Tomorrow when i'll go at work, i'll try this Solution and i'll leave you a reply :)

ingeln991
Posts: 15
Joined: Thu Apr 27, 2017 6:05 pm

Re: Opencv & VideoCapture Help !

Postby ingeln991 » Wed May 10, 2017 7:01 am

Hi !!! I've tried the solution that you have proposed yesterday and the errors doesn't appear : )
....but, when i run the application, anything happens :(

this is my code..

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/videoio/videoio.hpp>
#include <iostream>
#include <opencv2/imgcodecs.hpp>
#include "cap_libv4l.cpp"
#include <string>

using namespace std;
using namespace cv;



int main()
{

VideoCapture cap("imxv4l2videosrc device=/dev/video0 ! videoconvert ! appsink"); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;

Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("edges", edges);
if(waitKey(30) >= 0) break;
}




return 0;
}

the only message that i can see is (from termina)
[INFO] Producto Info : i.MX6Q/D/S
display(/dev/fb0) resolution is (800x600).
killed

varigigi
Posts: 52
Joined: Tue Nov 01, 2016 10:25 am

Re: Opencv & VideoCapture Help !

Postby varigigi » Sun May 14, 2017 9:41 am

Hi Andrea,
have you tried exporting the DISPLAY?

export DISPLAY=:0
./myapp

BR
Pier

ingeln991
Posts: 15
Joined: Thu Apr 27, 2017 6:05 pm

Re: Opencv & VideoCapture Help !

Postby ingeln991 » Sun May 14, 2017 11:48 am

Hi Pier :)

I've solved the problem 2 days ago.

I've putted "imxv4l2src" instead imxv4l2videosrc" and it works :) Now i can get the frame from camera.
But....i have only one frame per 5 second :lol:

I've opened an appropriate discussion....can you help me ?

Thank you very very very much :)


Return to “Yocto”

Who is online

Users browsing this forum: No registered users and 1 guest