Light painting is a technique, in which a long exposure photograph is taken to capture a moving light source. Photographer Stephen Orlando used this technique to capture motion through time and create light trails in his "Motion Exposure" series. Many of his images are of musicians, sliding their bows along the strings of their instruments such as the violin or the cello. The goal of this project was to mimic these effects and track the movement of objects in a video.
To track the objects in our videos, we used color detection. For every object we wanted to track, we wrapped it in a bright green colored tape. The following algorithm describes how to track a single object. For each frame in the video:
We used a range of 500 colors on the RGB scale to draw the lines between adjacent points. Each line started with the same color. For each subsequent frame following the first, the color of the line between the new collected point and the last point from the previous frame was determined by incrementing the previous color by 1. If there were more than 500 points, the colors would loop back to the beginning.
To capture the "passing of time" similar to the effect in Orlando's images, especially if the subect stayed in one area, we needed to shift the points. Given a frame:
Tracking multiple objects in a video is very similar to tracking a single object. However, there are multiple contours, using the mask, since there are multiple objects in the frame that contain the green tape/color. This means we don't have a single list of points collected from the frames. Instead, we have multiple lists, a group of points for each object that we want to track. This requires us to find the group that each of the new points from the current frame belongs to. The following steps describe how to group the points. Given a frame, for each group of points:
We took a video of our friend playing the violin. We placed the green tape on the two ends of her bow. Combining the steps from the other sections, we get the image on the left below.
To better capture the effect created by Orlando, we needed more points in between the ends of the bow. We initially thought we would put more green tape along the length of the bow. However, this made assigning groups to the new points more difficult since the green objects were so close together. We found it easier to just find the midpoints, uniformly distributed, between the two ends.
As a last step, we darkened each frame by weighing it by an alpha value of 0.2 so that the "lights" appeared to glow brighter.
If we moved too fast in the video, the frames would be blurry and this made it more difficult for the green color to be detected, i.e. only one end of the violin bow would "move" because only one point instead of two was detected. This would mess up the colors of the lines in the video because the lines of each point group would no longer be synchronized.
Because we used color detection, our program was very sensitive to the colors in our videos. We had to make sure that we didn't have any other green objects in our frames.