We compare the current video image with a predefined background image to detect presence. To detect motion, we compare the current video image with a previous frame. To achieve this task, we have to make use of the pix_delay
object to delay a video frame:
The number box in the right-hand inlet of the pix_delay
object specifies the number of frames to delay. The patch Motion001.pd
delays the video image for a number of frames and displays it on the GEM window. To make comparison, we use the current video frame and the delayed frame with the same pix_diff
object:
Usually, we use the value 1
in the number box for the pix_delay
object to retrieve the previous frame. The guideline is to track faster motion, use a smaller number (for example, 1
) to track slower motion, use a bigger number. The image in the GEM window is the frame difference between the two frames:
With this image, we can again apply the pix_blob
object to obtain the tracking information:
When you move in front of...