Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## josx.vision
Class MotionDetectionEffect

    java.lang.Object
      josx.vision.VisionEffect
          josx.vision.MotionDetectionEffect

All Implemented Interfaces:
  javax.media.Codec, javax.media.Controls, javax.media.Effect, javax.media.PlugIn

    public class MotionDetectionEffect

extends VisionEffect

Motion detection effect. The engine has two steps. First the input image and the reference image (which is the image from the previous frame) is compared. Whenever a pixel has changed consideribly (determined by the threshold variable) a internal black-white-red image is marked (at the same exact location where the change occured). Therefore in the first step, the internal black-white-red image is has lit up clusters in the space where a change has occured.

The next step is to eliminate these clusters that are too small, but still appeared in our black-white-red image. Only the big clusters are left (and are colored red). During this process we keep a track of couunt of the big clusters. If the count is greater than blob_threshold then the input frame is determined to have consideribly motion as to the previous frame.
Many of the ideas have been taken from

1. A Gnome Security Camera by Lawrance P. Glaister.
2. Digital Image Processing by Kenneth R. Castleman; ISBN 0-13-211467-4
3. Computer Graphics Principles and Practice by Foley, van Dam, Feiner, Hughes; ISBN 0-201-84840-6
4. Java Media Format Sample Programs (mainly the one dealing with building an Effect plugin)

Author:
  : Konrad Rzeszutek Modified by Lawrie Griffiths to fit in with lejos vision system.

Field Summary
`int` | `blob_threshold` Our threshold for determinig if the input image has enough motion.
`boolean` | `debug` Turn debugging on.
`int` | `OPTIMIZATION` Optimization.
`int` | `threshold` The threshold for determing if the pixel at a certain location has changed consideribly.
`int` | `THRESHOLD_INC` By what value you should increment.
`int` | `THRESHOLD_INIT` The initial threshold setting.
`int` | `THRESHOLD_MAX` Maximum threshold setting.

Fields inherited from class josx.vision.VisionEffect
`inputFormat, inputFormats, outputFormat, outputFormats`

Fields inherited from interface javax.media.PlugIn
`BUFFER_PROCESSED_FAILED, BUFFER_PROCESSED_OK, INPUT_BUFFER_NOT_CONSUMED, OUTPUT_BUFFER_NOT_FILLED, PLUGIN_TERMINATED`

Constructor Summary
`MotionDetectionEffect()` Initialize the Motion effect plugin.

Method Summary
`java.lang.Object[]` | `getControls()` Getter for array on one control for adjusing motion threshold and setting debug.
`java.lang.String` | `getName()` get the name of the effect
`int` | `process(javax.media.Buffer inBuffer, javax.media.Buffer outBuffer)` Process the image, detecting motion in the regions

Methods inherited from class josx.vision.VisionEffect
`close, getControl, getSupportedInputFormats, getSupportedOutputFormats, matches, open, reset, setInputFormat, setOutputFormat, validateByteArraySize`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OPTIMIZATION

    public int OPTIMIZATION

  Optimization. Anything above 0 turns it on. By default its disabled.

### THRESHOLD_MAX

    public int THRESHOLD_MAX

  Maximum threshold setting. Setting the threshold above this means to get the motion detection to pass the frame you pretty much have to full the whole frame with lots of motions (ie: drop the camera)

### THRESHOLD_INC

    public int THRESHOLD_INC

  By what value you should increment.

### THRESHOLD_INIT

    public int THRESHOLD_INIT

  The initial threshold setting.

### threshold

    public int threshold

  The threshold for determing if the pixel at a certain location has changed consideribly.

### blob_threshold

    public int blob_threshold

  Our threshold for determinig if the input image has enough motion.

### debug

    public boolean debug

  Turn debugging on. Slows down the effect but shows how motion detection effect works.

Constructor Detail

### MotionDetectionEffect

    public MotionDetectionEffect()

  Initialize the Motion effect plugin.

Method Detail

### process

    public int process(javax.media.Buffer inBuffer,
                       javax.media.Buffer outBuffer)

  Process the image, detecting motion in the regions

  Parameters:
    `inBuffer` - the input Buffer
    `outBuffer` - the output Buffer
  Returns:
    BUFFER_PROCESSED_OK or BUFFER_PROCESSED_FAILED

### getName

    public java.lang.String getName()

  get the name of the effect

  Returns:
    "Motion Detection Effect"

### getControls

    public java.lang.Object[] getControls()

  Getter for array on one control for adjusing motion threshold and setting debug.

  Specified by:
    `getControls` in interface `javax.media.Controls`
  Overrides:
    `getControls` in class `VisionEffect`
  Returns:
    an array of one MotionDetectionControl

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD