[Pythonmac-SIG] real-time video capturing and processing

Zachary Pincus zachary.pincus at yale.edu
Mon Jan 12 22:57:45 CET 2009


> thanks a lot for your help. so far i made first steps using PySight  
> which works fine with my iSight camera.

Cool, I'm glad this worked. I'll have to try PySight out.

> i'm able to aquire images and to process them, using code-snippets  
> from here and there, but i lack an idea of PyObjC and i am still a  
> bit overwhelmed by it. i would prefer to do as little as possible  
> with it, just acquiring data.

You and me both.

> scipy/numpy (together with ipython) are what i use for data analysis  
> in general and i'm going to work with them for pattern detection,  
> though up to now i lack a systematic approach to pass them 'a chunk  
> of memory' .

If you can get from C code a python object exporting the "buffer  
protocol" (maybe a string representing image bytes, or whatever), it's  
pretty easy to construct a numpy array, from a variety of functions  
(like numpy.frombuffer/fromstring, or just using the numpy.ndarray  
constructor). Alternately, and this I find to be the easiest way of  
dealing with C-level stuff, I construct the array first using  
numpy.ones/zeros/empty, and then grab a pointer to the memory from  
that array, and pass that into the C function to fill in, or process,  
or whatever. This is pretty easy with ctypes:
http://www.scipy.org/Cookbook/Ctypes

> for visualisation i find pyglet very interesting. i'd be happy if  
> you could send me your code that allows to run a pyglet window in  
> the background.

I'll send that off-list. Anyone should feel free to contact me for  
more information about this!

Zach


More information about the Pythonmac-SIG mailing list