[sugar] [OLPC-GSoC] GSoC Status Report: Vision Processing

Joel Stanley joel.stan at gmail.com
Sun Jun 29 22:31:18 EDT 2008


Hello Nirav,

On Thu, Jun 26, 2008 at 5:37 PM, Nirav Patel <nrpatel at gmail.com> wrote:
> functions to add.  Also, I only have the camera in the XO, vivi, and a
> poorly supported USB webcam, so if anyone could test it on other
> webcams, that would be great.

I've had a play with your work on my laptop - a ThinkPad with a webcam
supported by the out-of-kernel uvcvideo driver.  The demos you wrote
are cool, and it's fun being able to play with the webcam using just a
few lines of python.

It works well for the most part - I can use it to give me an image 9
out of 10 tries, but occasionally the process locks up, requiring me
to kill it (ctrl-c was ineffective).

I've been trying to reproduce the lockup today, but can't get it to
trigger.  I have been able to get the following to happen every 3 or
4th time:

$ python test.py
Traceback (most recent call last):
  File "test.py", line 10, in <module>
    cam.start()
EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 12, Cannot allocate memory

Occasionally when it succeeds, I will get a yellow tinted image.  Both
these errors have only happened in this session of testing; the other
night I ran it tens of times with only the lockup error.  I don't
think I've changed the version of pygame, I'm running git checkout
a109246de6.

The python I used to test it is below. I'm new to pygame, and my
python knowledge is limited, so please point out any mistakes I'm
making.

Sorry for the vague bug reports.  I'd be glad to help test any patches.

Joel

--

#!/usr/bin/env python

import pygame
from time import sleep
from pygame import camera

pygame.init()

cam = camera.Camera("/dev/video0", (640, 480), "RGB")
cam.start()

frame = cam.get_image()

disp = pygame.display.set_mode((640, 480))
disp.blit(frame, (0,0))
pygame.display.flip()

sleep(2)


More information about the Sugar mailing list