Work in Progress: Difference and Outline

After writing up Test Event #1 I spent quite some time trying to pre-sample a background (ie by taking a picture through the webcam) and then using that in conjunction with a live webcam feed to separate subject from background in realtime. I wrote an image filter that compares the values of pixels between a foreground and background image (plus or minus a tolerance factor) and discards matching pixels, the idea being that a subject not present in a background image will have less matching pixels and so will be isolated from a background. It works to an extent, but the result is too ‘stipply’ and not really usable without major transformation, such as blurring or downsampling. The following image shows the (rather poor) result.


In the course of evaluating the result of the above experiment I hit upon an alternative technique which has proven to be more fruitful. The principle is to take the current frame of a video feed and compare it with the previous frame to determine what has changed. Rather than comparing colour values, luminance (eg brightness) is compare on a per-pixel basis. The result (shown below), although at times unpredictable and rather noisy, lends itself well to a number of real time uses.

The next step was to link this technique with another developed as a Quartz Composer plugin by Benoît Lahoz – ‘Carasuelo OpenCV Contour’ – which creates shape outlines based on luminance values. In this way a shape can be created to surround the area of luminance change as shown below.

I really like this technique for its simplicity to the viewer – it’s immediately clear that moving in front of the webcam results in an outline being added to the image. In the following experiments I’ve hidden the luminance difference image and placed the outline on top of the un-effected video capture. The first example combines the outline shape with mathematical noise to create a sort of webbing effect.

The second example creates a large-scale glow which is quite fun to play with.

Next steps are to look at persistence so that the outline and effect does not disappear as soon as the viewer stops moving, but rather continue for some time and perhaps recede more naturally. I’ve already tried an image processing technique which achieves this to a certain extent but also want to try a computational technique so that the points of the outline are stored in memory and then perhaps degraded mathematically over time.

Previous Post
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s