03 July, 2009

ImageMagick Frame Differences

ImageMagick has some image processing utilities built right in. I recently found a means to display the differences between 2 PNM images.

By using these image processing utilities you can compare the following images to detect the changes between frames by using the following command:

$ convert frame00000002.bmp frame00000001.bmp -compose difference -composite -threshold 0 -negate diff.bmp




The resultant image is as follows:



Another side note that's worth mentioning, you don't have to redirect the results to a file. You can instead redirect the output to stdout and pipe it into the display utility for immediate rendering to screen; as follows:

$ convert frame00000002.bmp frame00000001.bmp -compose difference -composite -threshold 0 -negate - | display



Gotta love the command pipe!!

No comments: