Skip to main content

Posts

SciPy-Simulator

For the last few weeks I have been working on a Simulink / Labview / Ptolemy II like program for modelling... all sorts of stuff!! I am interested in modeling with different systems of computation, and of course some engineering problems, mechanical and electrical control etc. Ptolemey II is an open source java based system which a whole lot of people from Berkley have been working on for a number of years - I am not trying to match what they have - or get anywhere near the breadth that the commercial products Simulink and Labview have. But I do think something useful is very achievable - and of course leveraging what I can from Ptolemy II and basing mine on Python - heavily using SciPy , NumPy and MatPlotLib . So far I have been working on the semantics - in essence creating a new language for defining models by using blocks (or Actors) that carry out a very specific function. An example actor might be a Ramp Source or a Sin Function . Each of these actors run in their own thre...

Open Allure DS

Open Allure DS An open source project that I have started with John Graves a PHD student in Auckland for a smart computer interface for tutoring. Haven't really had an opportunity to start hacking away yet - but I am really hoping to find some time to chuck something together. It will possibly use my pycam module and speech recognition - ideally it will be cross platform and open source. To start with we are planning to create a learning game involving recognizing numbers and colors for the initial prototype. Interaction is based on a novel vision and speech based system instead of the mouse and keyboard. The learning game(s), initially aimed at preschool age children, teaching anything from recognizing numbers and colours to basic math. Interaction is based on a novel vision and speech based system instead of the mouse and keyboard. A very early vision of what it might look like... Each column is a different color or contains a different letter (or different...

Eptidy

Last summer my flatmates and I made a TV episode tidying program - called eptidy. Its found at http://eptidy.googlecode.com Here is a screenshot:

Animations with matplotlib

For some reason this wasn't overly clear in the documentation, but a simple way to make an animation using the default backend in matplotlib is something like this: from numpy import random , array , arange import matplotlib.pyplot as plt plt . ion () print "starting" x = arange ( 100 ) y = 2 * random . rand ( 100 ) line , = plt . plot ( x , y , 'd-' ) for i in arange ( 1 , 200 ): y = y + random . rand ( 100 ) - 0.500000 line . set_data ( x , y ) ax = line . get_axes () ax . relim () ax . autoscale_view () plt . draw () # redraw the canvas plt . show ()

Kiwi Pycon 2009 - Basic Computer Vision in Python

Well I have given my first ever conference talk! Wasn't any where near as scary as I'd feared and all my live python demos using the webcam worked fine. My slides have been uploaded on slideshare here . Heaps of random snippets from the weekend made it onto twitter . The conference had two main tracks, with delegates enjoying presentations on project management, science and maths, games and animation, and web development. There were also more interactive sessions with conference attendees participating in short presentations or open discussions on a specific theme. All in all I had a great weekend at the conference, learnt heaps and made some new contacts in the Python community. The maths exam the following day wasn't to bad either. Now the next challenge - concurrent systems modelling for scipy.

Bring your hat!

So thought I would make a really simple example of how pygame can be used with a webcam. This example uses opencv to detect a face, then pygame to draw a "hat". #!/usr/bin/python from pycam import VideoCapturePlayer from pycam import pygameFaceDetect import pygame from pygame.locals import * def process(surf): faces = pygameFaceDetect.getFaces(surf) if faces: s = pygameFaceDetect.faceDetect.image_scale for face in faces: pointsInHat = [ (face.x*s, face.y*s), (face.x*s + face.width*s, face.y*s), (face.x*s + face.width*s/2, face.y*s - face.height*s/2 ) ] pygame.draw.polygon(surf, Color("red"), pointsInHat) pygame.draw.polygon(surf, Color("black"), pointsInHat, 10) return surf if __name__ == "__main__": vcp = VideoCapturePlayer(processFunction=process) vcp.main() pygame.quit() And the obligatory screen shot: ...