Dear David,
Thank you for your quick response. I have tried a few things. First of
all, I have tried gst-launch-0.10 v4l2src ! ffmpegcolorspace !
pngenc ! filesink location=foo.png. Foo.png comes out sharp enough but
it takes around 2 seconds to complete. I have also tried CVTypes but
it does not run without LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so and,
when it does run, it only displays colored "snow". Here is that code:
import pygame
import Image
from pygame.locals import *
import sys
import opencv
#this is important for capturing/displaying images
from opencv import highgui
camera = highgui.cvCreateCameraCapture(-1)
print "cam:" + str(camera)
def get_image():
print "here"
im = highgui.cvQueryFrame(camera)
#convert Ipl image to PIL image
return opencv.adaptors.Ipl2PIL(im)
fps = 30.0
pygame.init()
window = pygame.display.set_mode((320,240))
pygame.display.set_caption("WebCam Demo")
screen = pygame.display.get_surface()
while True:
events = pygame.event.get()
im = get_image()
print im.mode
pg_img = pygame.image.frombuffer(im.tostring(), im.size, im.mode)
screen.blit(pg_img, (0,0))
pygame.display.flip()
pygame.time.delay(int(1000 * 1.0/fps))
Finally, I have gotten pygst to stream video with the example at
http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html but of
course I do not know how to get a hold of that data. Just so you know,
I am trying a primitive type of object tracking. I would use some of
the libraries already available but the two more popular
implementations on Linux (tbeta/ccv and reacTIVision) dont seem to
work with my web cam. I have more info on those non-python attempts at
http://ubuntuforums.org/showthread.php?p=7596908. Unfortunately no one
seemed to respond to that post.
Thanks again,
Sam