Skip to main content

Posts

Showing posts from July, 2009

Opencv source on Ubuntu 9.10

The build instructions for opencv really didn't make it clear how to go about building opencv. Well the ./configure command kept failing...
So for my own reference, use the cmake method not autotools.

cd ~/projects/opencv # the directory containing INSTALL, CMakeLists.txt etc.  mkdir release  cd release  cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON ../ make sudo make install

Instant Messaging, Threading and Sockets

So we were given an assignment for software today. It's going to be used to teach us promala and spin and good multi-threaded software practices. The overall goal is to make a simple GUI based multi-user instant messager system in C++.
I haven't used allot of concurrency before so I thought I would investigate by trying some stuff out in python. Also I haven't used sockets directly before - so wanted to have a look at them.

Firstly taking a read of the Socket Programming HOWTO guide - there is plenty of information there. And also handy is the Socket documentation for python.

For now I just want a echoing server that can service multiple clients at once.

So the server will be the difficult part - might as well dive in there!

Firstly creating a socket and echoing any data it recieves is pretty easy with this loop:

while True:
           data = self.conn.recv(1024)
           if not data:
               break
            self.conn.send(data)Now wraping this up in a thread than ca…

Matplotlib in Django

The official django tutorial is very good, it stops short of displaying
data with matplotlib - which could be very handy for dsp or automated
testing. This is an extension to the tutorial. So first you must do the
official tutorial!
Complete the tutorial (as of writing this up to part 4).

Adding an image to a view

To start with we will take a static image from the hard drive and
display it on the polls index page.
Usually if it really is a static image this would be managed by the
webserver eg apache. For introduction purposes we will get django to
serve the static image. To do this we first need to change the
template.



Change the template
At the moment poll_list.html probably looks something like this:


<h1>Django test app - Polls</h1> {% if object_list %} <ul> {% for object in object_list %} <li><a href="/polls/{{object.id}}">{{ object.question }}</a></li> {% endfor %} </ul> {% else %} <p>No polls are available.</p> …

Camera Histogram Demo

There is a really cool demo for opencv in C called camshiftdemo. I decided to write a version in python... The only one I could find online used opencv with ctypes, so this was a simple enough modification to get it running in more pure "swigged" python. It's in my pycam repository if anyone is interested: http://code.google.com/p/pycam/source/browse/trunk/pycam/cam-histo.py


Here are some screenshots.



This is the python cam shift demo tracking the orange on the XO's logo. Now tracking the green section, you can see the histogram for the entire image shown. It is a really simple demo, and quite fun! At the Hitlab open night this was what I used to keep the kids occupied! Unlike the previous computer vision post - this doesn't use pygame at all. It would be a really good example for the XO pippy computer vision package idea however.