MotionTrack

The MotionTrack widget uses a Firewire or USB camera attached to your computer as an input device. It then analyzes the video and finds where the most change (i.e. motion) is happening and outputs X,Y coordinates based the location of that motion within the frame captured by the camera. Note that only one X,Y point is output, and this widget can only track one thing at a time.


In one example of using MotionTrack, you would set up two ClipControl widgets, one with its inputSource set to the instance name of the MotionTrack widget with an “X” at the end (e.g. videoX), and the other ClipControl inputSource set to MotionTrack’s instance name with a “Y” at the end (e.g. videoY). Then set the first one to control the X property of a movieClip, and the other one to control the Y property of the same clip. This clip will now follow the motion of what happens in the camera frame.

On Screen Features

  • EASE: This setting when on (the default) will smooth out the change of the X,Y point output by the widget so that the point seems to follow the motion rather than exactly track it. The eased motion will look more “natural” and organic that the exact point which with ease off will jerk around. On the other hand, ease will slow down the tracking accuracy, and you may find some situations where it is better to leave this setting off.
  • WIDTH: This setting scales the bounds of the motion being tracked. The default is 320 for a 4×3 ratio screen, which is 320×240. All points output by the widget will be within this range. If you change the width setting, the bounds of the rectangle will change accordingly. For example, you want the motion tracking to be translated to a 640×480 rectangle, then set the width to 640.
  • VIDEO PROCESSING SETTINGS
    • BLUR: Usable range = 0 to 40. It may be helpful to blur the video so that the tracking ignores the details of the motion. A higher number is more blurred.
    • BRIGHTNESS: Usable range = -100 to 100. The lighting of the area within the camera frame greatly affects the accuracy of the motion tracking. Adjust this brightness setting to compensate for the brightness captured by the camera.
    • CONTRAST: Usable range = -100 to 200. It may help to increase or decrease the contrast to get the tracking to pay attention to the kind of motion you want.
    • MINAREA: Usable range = 0 to 50. If you need to track small things in the frame (e.g. an LED), set this number low. If you only want to track large objects moving (a person walking), then set this number higher.

Parameters

  • INVISIBLE: if set to “yes”, the widget will disappear when the Flash movie is run
  • XOFFSET, YOFFSET: Normally the upper left corner of the video frame captured by the camera is output as 0,0. If you want to change this origin to match your graphics or other needs, the values in xOffset and yOffset will be added to the values of X and Y output by the widget.

Notes

  • If you have more than one camera attached to your computer, you can right-click on the left video feed and select “Settings…” to choose which camera you will use.
  • In some cases, you can use an infrared camera as the input to this widget. This way, only motion of heat will be tracked. This is especially useful in situations where the camera is pointed at a scene where there is a projection that is constantly changing. By using an infrared camera, you can track people (who give off heat) in front of the projection, without the changing projection confusing MotionTrack. A more robust version of this is to have the people or objects being tracked have material that is highly reflective of IR and use bright IR lamps to illuminate the area in front of the camera.
  • Thanks to the SoulWire blog for the code that this is based on!

 


Last modified March 24th, 2011