I am working with minoru3D, a dual-webcam that is really two z-star
vimicro webcams and a usb hub in a single package.

I can get images from either one of the cameras using python-opencv
(Ubuntu 9.10, 32 bits), but when I try to capture from both cameras in
sequence I get this error:

"VIDIOC_STREAMON error 28, No space left on device"

Here are the error (funnily, there is no traceback) and code I am using:

####### Error from command line (not even a traceback):
"""
kandin...@derive:~/data/work/hack/pyralax$ python dualcam.py
VIDIOC_STREAMON error 28, No space left on device
"""

####### CODE:

import pygame
import Image
from pygame.locals import *
import sys

import opencv
#this is important for capturing/displaying images
from opencv import highgui

cameras = []

def create_camera(n):
  camera = highgui.cvCreateCameraCapture(n)
  highgui.cvSetCaptureProperty(camera, highgui.CV_CAP_PROP_FRAME_WIDTH, 640)
  highgui.cvSetCaptureProperty(camera, highgui.CV_CAP_PROP_FRAME_HEIGHT, 480)
  return camera

def get_image(camera):
    im = highgui.cvQueryFrame(camera)
    # Add the line below if you need it (Ubuntu 8.04+)
    im = opencv.cvGetMat(im)
    #convert Ipl image to PIL image
    return opencv.adaptors.Ipl2PIL(im)

def blit_image(im, camera):
    pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
    screen.blit(pg_img, (640*i,0))


fps =  15.0
pygame.init()
window = pygame.display.set_mode((1280,480))
pygame.display.set_caption("WebCam Demo")
screen = pygame.display.get_surface()

for i in (0, 1):
    cameras.append(create_camera(i))

while True:
    events = pygame.event.get()
    for event in events:
        if event.type == QUIT or event.type == KEYDOWN:
            sys.exit(0)

    for i, camera in enumerate(cameras):
        im = get_image(camera)
        blit_image(im, i)

    pygame.display.flip()
    pygame.time.delay(int(1000 * 1.0/fps))
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to