To detect and analyse movement in a video sequence, we perform to following four steps:
First we find the difference between the current frame in the video
sequence and the previous. If the difference between the pixel values are
greater than
,
the movement has been
significant and the pixel is set to black. If the change is less than this
threshold, the pixel is set to white. This image (figure 2)
now indicates if something has moved and and where the movement is
located.
In the thresholded image, there may be noise. To remove the noise, we scan
the image with a
window and remove all black pixels which are
isolated in a white area. If the center pixel of the
frame is
black and less than three of the pixels in the frame are black, we remove
the black center pixel because it is probably noise. Otherwise the pixel
remains black. This way we detect only "large" moving objects.
This motion image is used to add up how many black pixels there are on
each line (figure 3). We use this image to find the upper
moving object in the images. If there are three lines with movement
greater than fifteen pixels below each other, we assume this is an object,
not just single pixels with movement. By using the information about how
much motion there is on each line, a point in the middle of the upper
moving object is calculated. This is done by calculating the center of the
object within a square of a fixed size (
pixels). The average
width of the object is calculated and the center pixel is where this
cross the twentieth line from the top of
the moving object. This procedure is repeated for frame sizes
and
.