Movement
The Movement function provides a way to detect image
changes. Movement can be an easy way to segment an object
of interest with 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. 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. Specify if the reference frame should be continuously updated or stop
after the specified number of frames have occurred.
3. Specify the pixel difference amount that needs to be exceeded in order
for movement to be detected.
4. Select which type of comparison you want.
RGB Difference - straight linear difference between RGB pixels
RGB Squared Difference - squared difference that helps to better reduce noise
RGB Percent Difference - percent difference between RGB pixels. Since darker pixels
contain more noise use the threshold value below to ignore pixel values lower than the
specified threshold. The percent mode helps to eliminate white or black background pixel
issues.
Intensity Difference - compares intensity only (grayscale comparison)
Color Difference - compares CrCb (chroma) values. Note that color differences are VERY small
so you will need to set the difference amount to a very small amount (1 - 3)
5. 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.
6. Set Movement to White will set any movement detected to white. This
can be used to create a movement mask.
7. Set Still to Black will set any non-movement pixels to black.
8. When specifying the RGB Percent Difference black pixels will contain a lot of noise and
therefore should be removed. This threshold specifies at what low level pixel values
should be ignored when calculating the percent difference.
9. 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.
10. 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 room since the white sheet of paper will have caused your camera to shift the intensity
values. This shifting moves the pixel values 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
blacks 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
See Also
Average
|