Motion Detection

Purpose: visual motion detector.

 

API

Call startLookUntilSighted() using MOTION_OBJ_ID as the object's ID. The result is returned in the ObjLoc_t struct that you pass to this function. The distance field in this struct has no meaning for motion detection.

 

Code Example

 

Executing Through MavisCtl

 

Ini-File Parameters

motionDetector#pctIllumChange
motionDetector#nPixelsChanged
motionDetector#nSkippedFrames

 

How It Works

Motion detection works by comparing one video frame to another taken previously. If they differ by more than a minimal amount, motion was detected. This technique is called Image Subtraction. Here's the complete algorithm:

  1. Capture a frame (frame1) and convert it to grayscale.

  2. Skip nS frames (nS is a param, set by nSkippedFrames).

  3. Capture a second frame (frame2) and convert it to grayscale.

  4. delta = abs(frame1 - frame2).

  5. nP is number of pixels in delta >= t (t is a param, set by pctIllumChange).

  6. If nP >= N, motionExists = true, else motionExists = false. (N is a param, set by nPixelsChanged.)

  7. Location of motion is CG of pixels in delta >= t.

 

Source Code

  • mavis/objRec/Motion.h
  • mavis/objRec/Motion.cpp

 

Home | Mavis | Mavis Capabilities