This quarter I am working with a ProLaser ShowCube laser projector that is capable of drawing curves on a wall in Red, Green or Yellow through a combination of Red and Green Lasers.
My project, currently dubbed Laser Shadow, intends to use a webcam to track passersby and project their ‘shadow’ on the wall behind them so it follows them. The first major part of the project involves the video image processing to extract a shadow-like curve that can be plotted using the laser.
I am using OpenCV to perform the computer vision needed to process the video feed. The application is built using OpenFrameworks which is an up-and-coming C++ framework that aims to make it simple to create multimedia applications in C++. So far it has been very useful as it includes video capture support and openCV support out of the box.
I have extended the default OpenCV example to start in the direction needed to interface with the laser. Currently it converts the webcam feed to grayscale and subtracts a pre-captured background image to (hopefully) isolate just the subject-of-interest. This does not always work perfectly if the subject (in grayscale) matches an element in the background. Darker clothing works best.
The resulting image is thresholded to create a straight black-or-white image to be processed.
I am using Blob Detection to trace the outline of the person which works pretty well if they do not blend into the background.
The blob curve is usually very detailed and must be simplified to send to the laser since the laser can only draw a finite amount of points. For this I implemented the Douglass-Peucker curve simplification algorithm. In the work-in-progress screenshots the resulting curve is plotted as a solid blue polygon which closely matches the original blob, in cyan. Below the plot is a printout of the difference in the number of points — it makes quite a difference even though the result is, generally, very similar in appearance to the more complicated version.
Here are some in-progress shots:
The results are promising but the curve quality depends a lot on the color of clothing, background characteristics and the room lighting. For a project installation I would ensure the wall is white and free of ornamentation, and also ensure there is good lighting directed onto the subjects to create the highest contrast possible.
I am also investigated additional curve simplification options to smooth over imperfections.
Below is some cheesy concept art: