zakjma
zakjma

Reputation: 2110

libv4l2 error : No space left on device

I have two different cameras. I used below simple code and I get an error. There is a similar question on this site but there isn't an accepted answer. The error message is :

libv4l2: error turning on stream: No space left on device
VIDIOC_STREAMON: No space left on device
OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file 
/home/OpenCV/opencv-2.4.10/modules/highgui/src/window.cpp, line 269

Code :

VideoCapture cap(2); 
VideoCapture cap2(1); 

if(!cap.isOpened())  // check if we succeeded
{
    cout << "Webcam cannot open!\n" ;
    return -1;
}
if(!cap2.isOpened())  // check if we succeeded
{
    cout << "Webcam2 cannot open!\n" ;
    return -1;
}
namedWindow( "Window1", CV_WINDOW_AUTOSIZE );
namedWindow( "Window2", CV_WINDOW_AUTOSIZE );
for(;;)
{
    iKey = waitKey(5);
    if (iKey == ESC) {  break;  }
    cap >> frame;
    cap2 >> frame2;

    imshow("Window1", frame);
    imshow("Window2", frame2);
}

EDIT 1 These camera use same hub according my search on web.I did a test for this and the output is below. I don't understand that should I do to solve this problem.

sudo cat /sys/kernel/debug/usb/devices | grep "B: "

B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc= 37/900 us ( 4%), #Int=  2, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0 
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0

Upvotes: 0

Views: 2534

Answers (2)

Nico R.
Nico R.

Reputation: 86

I got the same problem with two depth sense cameras (USB) on two usb ports next to each other. They used the same usb bus inside and was too much, so I switched one to my usb 3.0 port (which is another bus) and now it works.

Upvotes: 1

zakjma
zakjma

Reputation: 2110

If you get low resolution frame, the problem will solve.Below code was enough for me.

VideoCapture cap1 = VideoCapture(1);
VideoCapture cap2 = VideoCapture(2);

cap1.set(CV_CAP_PROP_FRAME_WIDTH, 300);
cap1.set(CV_CAP_PROP_FRAME_HEIGHT, 300);
cap2.set(CV_CAP_PROP_FRAME_WIDTH, 300);
cap2.set(CV_CAP_PROP_FRAME_HEIGHT, 300);

Upvotes: 0

Related Questions