Accessor: image/MotionDetector


A motion detector accessor. This accessor compares each input image against the previous input image. There are three outputs. The one named 'output' is a modified image that graphically illustrates the center of gravity of motion, if motion is detected. If enough of the pixels differ by enough, then the 'cog' output will produce the center of gravity of the pixels that differ by enough. Finally, the 'area' output produces the percentage of area covered by motion in the input image, where 0 means no motion and 100 means full image motion.

The options parameter can include the following fields:

  • PixelThreshold: Intensity threshold whereby a pixel is deemed to different (an int in the range of 0 to 255, with default 25).
  • AreaThreshold: The percentage threshold of image that has different pixels for motion to be detected (a double 0-100, with default 0.2).
  • ModifyImage: If true (the default), the modify the provided image with a visual indication of the location and amount of motion.

    The implementation for the Ptolemy II host is taken from the webcam-capture package by Bartosz Firyn (SarXos), available from The webcam-capture package is licensed under the MIT License.

  • $$Id$$
  • Edward A. Lee
Name Type Description
input A stream of images.
options Object The options controlling the filter.
Name Type Description
cog array:.<{'horizontal':: 'number':, 'vertical':: 'number':}> The horizontal and vertical position of the center of gravity of motion, in pixels.
output Object The filtered image.
area number The percentage of area covered by motion.