Multimedia Daily Schedule

Real time video tracking: Adding computer "vision" in Director

Instructor: Tiffany Holmes

REVIEW: Using global variables

Global variables can be shared among handlers and movies. A global variable exists and retains its value as long as Director is running or until you issue the clearGlobals command. In Shockwave, global variables persist among movies displayed by the Lingo goToNetMovie command, but not among those displayed by the goToNetPage command.

Every handler that declares a variable as global can use the variable's current value. If the handler changes the variable's value, the new value is available to every other handler that treats the variable as global. It's good practice to start the names of all global variables with a lowercase g. This helps identify which variables are global when you examine Lingo code. Because you usually want global variables to be available throughout a movie, it is good practice to declare global variables in an on prepareMovie handler. This ensures that the global variables are available from the very start of the movie.

Syntax: clearGlobals

Description Command; sets all global variables to VOID.

Syntax: showGlobals

Description Command; displays all global variables in the Message window.

Global Variables skills check:

  1. Create a twenty frame movie that will run all the way through 10 times and then quit. (HINT: Create a startmovie script that names global variable called gcount. In frame one, create a behavior script that add's one to the global variable, and write a conditional statement that tells the playback head what to do if the movie has looped 10 times....)
  2. Add a custom handler/function in the startmovie script that looks like this:

     

    on calcArea iwidth, iheight

  3. return iwidth*iheight

end

3. Now in frame one, call your custom handler to calculate a custom area: myFence=calcArea(10, 10), and add a field called Area to your cast and place the calculation in that field with a script like "put myFence into field "Area." The number 100 should appear as a constant. Add two more global variables for the width and height to increase the range of the integer in the field.

Directions: Before you begin this exercise please complete the following:

  1. Download Trial Version of TrackThemColors
  2. Move TrackThemColors-Fat XTRA into Macromedia Director XTRAS folder
  3. Connect Canon GL-1 video camera to the MacG4 via a 4-6 pin firewire cable. Power on to Camera Mode and do NOT insert a tape. Use the AC adapter for the camera. (Otherwise camera will power off while you are trying to track movement and change).
  4. Open I-movie to test to see if you have a video signal from the firewire ports (slide slider on main window over to the DV camera icon. If you have a picture close I-movie. If you see a blue screen that says Camera Disconnected or some other troublesome alert unplug the firewire cable from the Mac and reinsert. Close i-movie and reopen.
  5. Open Director 8.5, choose File>Open>TrackThemColorsDemo5.dir. Immediately save as JUNK.dir so you save the demo as a version 8.5 movie.
  6. Choose Modify>Movie>Xtras and click ADD. Scroll down and find TrackThemColors, select it, add it to you list and save movie.
  7. Open the TrackThemColors demo and start PLAYING with it. Look at the scripts and try to get a sense of how it's working.

Group Exercises: Complete in groups of 2-3

NOTE: Probably it's best to start these exercises tracking ONE color or by creating a reference frame and tracking change.

  1. Create a movie where a body or body part creates a simple drawing or trace of a gesture.
  2. Create a movie where a body or body part creates a sound or series of sounds.
  3. Create a movie where a sprite avoids a body or body part.
  4. Create an audience survey where a participant answers survey questions, yes or no, true or false by doing something with their body or by holding up a card of a particular color.
  5. Create a game in which a user's gesture controls the paddle or parameters of the game.

ART and TECH LINKS: Video tracking and audience participation

Cinematrix

Camille Utterbeck

Wolfgang Muench

More multimedia art than you can imagine-HERE