Computer vision

OpenCV and Computer Vision in Art Workshop

2009/07/24

28 April 2009, Soogsil University, Seoul, Korea

This was a four hour workshop in which I presented a historical overview of how computer vision has been used in the arts. I introduced both technical and aesthetic aspects of several important works and we followed with a short introduction to the OpenCV library. You can find?also a simple tutorial I made for this workshop.

Soongsil2009

This workshop was part of a bigger event,?Home Party, organised jointly by the DSP Couse of IAMAS and the BK21 Media Division of Soongsil University.

Computer Vision and Interactive Art with Jitter Workshop

25-27 March 2009, Nuova Accademia di Belle Arti Milano, Milan, Italy

This was an intensive three-day class held for the students of the?Digital Environment Design Master Programme. Using Jitter and cv.jit, we explored some of the basic computer vision techniques and their artistic applications. More information about the course can?be found here.

NABA2009-cafe

A Simple OpenCV Tutorial

2009/05/08

Here is the source code for a simple program in C that uses the OpenCV library. The OpenCV package already contains several examples and fairly decent documentation, but the code you’ll find here is extra commented. It doesn’t do anything terribly interesting by itself: it captures images from the camera, finds edges and contours and displays them. When the user clicks on the window, it tries to find a contour that surrounds the location the user clicked in. If there is one, it prints out the area of this contour.

This example is meant to show how to use the basic GUI support offered by OpenCV, such as creating windows, trackbars (sliders) and responding to mouse and keyboard events. It shows a basic image processing chain (resize, convert to greyscale, find edges, dilate), but most importantly it also shows how one can work with sequences.
Sequences are a type of linked list used extensively in OpenCV, but the documentation is somewhat less than perfectly clear about how they’re organized. There are utility functions to iterate through these sequences, but accessing the pointers directly, as I do in this example can be just as clear.
In the example, I use the function?cvFindContours, which returns sequences of points that are connected together along an image edge. The flag?CV_RETR_TREE tells the function to organize the contours in a hierarchical tree. What does this mean? The contours are stored in a structure called?CvSeq. You can tell how many points are in the contour stored in a?CvSeq by looking at its?total member. If you have a?CvSeq called?contour, you can iterate through its points like this:

int i;

for(i=0;i<contour.total;i++){

CvPoint *point =? (CvPoint *)CV_GET_SEQ_ELEM(CvPoint,&contour,i);

}

You can access other contours using the h_next and v_next members of?CvSeq. If you specified?CV_RETR_TREE, the pointer v_next points to the first contour that is inside the current contour. On the other hand,?h_next points to the first contour that is outside the current contour. For example:

Edges

If we give the binary image above to?cvFindContours, it will find the contours shown on the left below, labeled A to L. You can access A through the?CvSeq structure?cvFindContours expects as its third argument. All the other contours can be accessed through the?h_next?and?v_next pointers, as shown on the right.

Contours

Here is the source file for the tutorial:?OpenCVcontours.c
If you are running this example on OS X, the #include commands expect OpenCV to be packaged as a framework. Alter these lines accordingly if this is not the case.

cv.jit – New update available

2008/07/07

A new update to?cv.jit, a collection of Max/Jitter externals for computer vision is now available for download. There is only one new object, cv.jit.snake, which is an implementation of active contour algorithms.

Starting with this release,?cv.jit?is now open source. You can now download the source code and project files from the download pages.