You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
int main(int, char**)
{
VideoCapture cap(0); // 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;
}
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
Error: libv4l2: error setting pixformat: Device or resource busy VIDEOIO ERROR: libv4l unable to ioctl S_FMT libv4l2: error setting pixformat: Device or resource busy libv4l1: error setting pixformat: Device or resource busy VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT
Maybe solved. Somehow the webcam wasn't freed by quiting one instance of program, so conflict was made by running it again. Also the strange behavior was caused by this line of example code if(waitKey(30) >= 0) break;
making it stop almost by instant, I changed it to continue so stream is endless now.
Actually you should use the latest docs instead of 2.4 docs if you want correct tutorials and sample code. The link you provided is actually not working, so I do not know if the issue still arises in 3.2.
Issue
Error is raised when I run this example code from VideoCapture class documentation, http://docs.opencv.org/2.4/modules/highgui/doc/reading_and_writing_images_and_video.html#videocapture
Error:
libv4l2: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl S_FMT
libv4l2: error setting pixformat: Device or resource busy
libv4l1: error setting pixformat: Device or resource busy
VIDEOIO ERROR: libv4l unable to ioctl VIDIOCSPICT
My steps so far
Possible solutions
I think about not using VideoCapture class following https://github.com/TheImagingSource/tiscamera/issues/11
Must be webcam somehow pre-set to call VideoCapture open or constructor ?
Not working on both USB connected Logitech qc 3000 and build in webcam.
System Ubuntu 16.
I need to use video stream from webcam. ( later from more webcams)
The text was updated successfully, but these errors were encountered: