trux_motion project is a program for detecting motion between two JPEG images.
Version: 1.0trux_motion project is a program for detecting motion between two JPEG images.
Operating System: Linux
trux_motion is a simple program for detecting motion between a pair of JPEG images. It uses the GD library to load the JPEGs.
It uses a simple, fairly fast algorithm for detecting motion.
To use the program, invoke "motion" with 3 arguments: the names of two jpeg images, and a threshhold for motion, like this :
motion A.jpg B.jpg 1000
The threshhold is the number of active pixels, above which motion will be detected. If motion is detected, the result of the program will be zero, if no motion
is detected, the result will be nonzero. This allows you to create scripts with stuff like this :
motion A.jpg B.jpg 1000 && echo "MOTION DETECTED"
The threshhold to use depends on how much motion you want to detect. The algorithm is pretty good about squashing random pixel noise, so even a threshhold of
1 is useful if you want to detect the slightest movement.
Of course, the threshhold to use will also depend on the size of the images from your camera. I have a camera that generates 640*480 jpegs, so a threshhold of 1000 pixels means that 0.3% or more of the image must have changed before motion is detected.