Movement/Motion Detection

The Movement detection module provides a way to detect image
changes as a result of movement. Movement can be an easy way to segment an object
of interest from the background.

Any pixel that is different enough in color or intensity is
preserved; pixels that have not changed are set to black (default). To change
the sensitivity of this comparison increase or decrease the ‘Difference Amount’
within the movement dialog interface.

To create a movement mask (i.e. set changed pixels to
white) click to ‘Set Movement to White’.

If you want to show the pixels that are still uncheck the ‘Set
Still to Black’.

To prevent still images from being further processed you
can chose to stop processing of the image processing pipeline if the movement
detected is below a certain percent of the image size or if no movement is
detected above a certain threshold. Setting either will stop image processing
and continue with the next frame grabbed from the video source. This is
particularly useful when streaming the video source to an AVI file where you
only want to record images with movement and not still images.

For global movements or large objects use the ‘Stop below
Movement Percent’ as this ensure that small image aberrations do not make it
through. Often due to overhead lights or specula effects pixels can abruptly
change for an instance to a different color/intensity. However, if small
movements need to be detected use the ‘Stop below Pixel Difference’ which will
stop processing as long as all pixel differences are below the specified
amount. With this condition even a single pixel above the specified value will
allow the image to continue thought the processing pipeline.

Unchecking both ‘Set Movement to White’ and ‘Set Still to
Black’ is a great way to stabilize a still image and remove the flickering
effects due to overhead lighting or poor quality cameras.

Note that using a mean filter before the movement detected
is often recommended as another way to reduce any abrupt pixel changes. Spurious
pixel values will be more common on lower quality cameras so the values you use
may need to be updated when changing cameras.

Interface

Instructions

1. Background Image - Select the reference frame to use when comparing frames for movement. The more frames
used the more stable the reference image will be but changes are
detected slower.

2. Continuous Update - Specify if the reference frame should be continuously updated or stop
after the specified number of frames have occurred.

3. Threshold - Specify the pixel difference amount that needs to be exceeded in order
for movement to be detected.

Color Difference - sum of CrCb (chroma) values. Note that color differences are VERY small
so you will need to set the 'Difference Threshold' to a very small amount (1 - 3)

Texture Difference - a small window is used to calculate a measure of texture within
the window. This amount is also calculated in the background image. The difference of
the two is then used as the threshold value. This allows you to tell when a part of
an image's texture (i.e. smooth or not smooth) changes. Note that this is less lighting
sensitive as the texture measure is relative to the local window.

Flow Difference - the translation of a pixel is summed over the entire image. The
translation of a pixel is defined as the location in the next image that is closest
in value to the previous pixel. This is also know as optical flow

.

5. Set Movement to Actual - sets any detected movement to the current pixel values.

6. Set Movement to White - sets any detected movement to white. This
can be used to create a movement mask.

7. Set Movement to Gray - sets any detected movement to an intensity that represents
the amount of detected movement.

8. Set Still to Black - sets any non-movement pixels to black.

9. Anti - Auto Adjustment - if your camera does not provide the option to freeze white balance
or auto exposure select this checkbox. The current image's lighting will then be adjusted
(reversed) to the previous image's lighting parameters to ensure that comparisons are done
within the same lighting conditions. Ideally you can switch these off on the camera to
avoid sudden light adjustments that cause a global difference in images.

10. Reduce global movement - if your camera moves in any way the entire image
may suddenly not compare well with the previous image and cause a large amount of
detected movement. This checkbox activates a method to attempt to reduce this
issue such that only local movements within the image is detected. Note, this method
is CPU intensive and should only be used if needed.

11. Area of consideration Window - for all techniques checking a single pixel at a time will
typically cause a lot of noise to be produced depending on the camera that you are using.
Normally a single pixel's color/intensity will change significantly from one image to the
next unless you are using a higher end machine vision camera. Because of this, it is
best to sample a group of pixels (i.e. small window) and run the comparison against
that group of pixels rather than an individual one. The Window Size parameter
allows you to specify the size of this window. Smaller windows will produce more
noise, larger windows will filter out smaller changes.

12. Area of consideration Blob - similar to the Window Size this selection will
group pixels of similar color together before running the analysis. This will ensure that
objects comprised of similar pixels will be analyzed together.

13. Difference Threshold High Amount - specifies the threshold amount for many of the techniques. The lower
the value the smaller the difference between the images need to be in order to signal movement.
The higher the value the larger the difference needs to be in order to signal movement.

14. Difference Threshold Low Amount - once a pixel is determined as being movement, this threshold allows other
pixels that are neighbors to the pixel just detected to also be trigger as movement despite them having a lower
activation value. This hysteresis allows moving objects to grow larger to include more appropriate borders
where pixel comparisons are not as significantly different than the "High Threshold Amount".

15. Stop Below Movement Percent specifies how much movement needs to be
detected for the module to signal that something has changed in the image. If nothing
is detected then the entire image is set to black.

16. Stop Below Pixel Difference specifies that if all pixel difference
values are below the specified amount then the image will be considered
still even if the percentage of pixels changed exceeds the above percent.

Notes

Ideally to detect movement your camera needs to maintain the lighting conditions
from one image frame to the next. You may be able to turn off auto-exposure or auto-shutter
speeds by examining your camera options. Select the options button in the main RoboRealm dialog,
then one of the Video Capture or Video Format buttons to see if your camera provides a manual override
of setting these parameters. You can test the lighting issue by setting the movement detector
to use the last 50 previous frames to calculate the RGB difference. Once these settings have been
made the current image will eventually go to black assuming no movement is within the camera's view.
If you then hold up a white sheet of paper in front of the camera you will suddenly see the entire
background change since the white sheet of paper will have caused your camera to shift intensity
values. This changing of pixel values moves the pixel intensity outside the "difference amount" and
therefore the entire image will appear to have moved. Switching the camera to manual mode
will prevent this intensity shift from happening. If you are not able to switch to manual mode select the
'Anti - Auto Adjustment' checkbox which will attempt to undo these lighting changes by your camera.

When using the movement detector you may notice issues with black streaks or spots in the
resulting movement mask. These spots are caused by dark background pixels. Ideally to create
an appropriate mask (similar to green screen or blue screening) your background should be as
planar as possible and not include the color that the foreground will. For example, using a white
sheet as a background and then standing in front of the background with a white shirt on will not
allow you to segment your white shirt ... the shirt and white background are considered as the
same color and therefore no movement will be detected. This also frequently happens for
black areas since the absence of light in shadows will cause confusion if your foreground object
has any shadows in it.

Variables

MOVEMENT_PIXELS - number of pixels that have changed from frame to frame
MOVEMENT_PERCENT - percent of pixels that have changed from frame to frame

about us

The RoboRealm application was created back in 2006 to take advantage of (1) lower cost generic
computing (i.e. PCs), (2) a widening range of lower cost imaging devices, (3) an increasing need
and usage of vision as primary sensor device and (4) the desire to quickly research custom solutions
using an interactive user interface with minimal programming.