November 23rd, 2008

Exercise 9 – Video

color-tracking.pngThis weeks post is all about video. We create a very cool video player with some 3D effects, a video recorder and ultimately a little programm that allows you to track objects based on their color.

Task 2: Video Player

We had to create a small video player which moves/rotates the video in the three dimensions. Depending on the mouse position, I implemented a rotation around the Y-axis when the cursor is on the left half of the applet. When the mouse is on the right part, the video is moved.

HINT: When trying to replay videos, make sure that you set the P3D parameter in the size-function, so for example size(300,300,P3D). Video playback did not work for me without it.

Movie playback somehow seems not to work in the browser. You can download the ZIP-archive here.

Task 3: Video recorder

For this simple video recorder, I took the animation from a previous exercise (confetti) and added a way to record the animation as a movie. The following functions are supported:

  • a: Start and stop recording
  • s: Play the movie
  • d: Pause the movie
  • w: Stop the movie

Video Recorder

You can download the ZIP-archive here.

Task 4+5: Brightness / color tracking

The program let’s you define a color by clicking somewhere inside the image. Then, every pixel gets compared with your chosen color. If they are somewhat similar (you can define the tolerance), the pixel will be considered as part of your object. The center will be calculated and the motion tracking is overlayed instantly.

For the sake of elegance, paths get “faded” out. The following key function can be used:

  • t: Increase tolerance
  • z: Decrease tolerance
  • e: Toggle ellipse
  • r: Toggle trace display

Color Tracking

You can download the ZIP-archive here.

Leave a Reply