How the Change Detection Works
The change detection used here is relatively simple:
- Each picture is divided into lots of small dots, called "pixels",
arranged in a grid pattern. Each pixel contains a number that says how bright
or dark that particular pixel was.Here is a sample picture with a section
enlarged so that you can see the individual pixel squares:
- We subtract one picture from the other by subtracting the "brightness
value" (also known as radiometric intensity) of corresponding pixels
from the two images and take the absolute value. This produces an image that
has bright values where the images were different and dark values where they
were nearly the same. Here is a sample "raw" difference image:
Note that this image contains lots of dark, but non-black pixels, indicating
small changes in brightness.
- We decide how large a difference is important for us to see by setting a
"threshold". Pixels that are not bright enough to meet our threshold
are set to black. The remaining pixels are colored purple to help them stand
out better. Here is a sample image after a threshold of 25% was used:
If we set the threshold value lower, then smaller changes qualify. Here is
the same change image after a threshold of 5% was used:
- Finally, just as we started off by subtracting the two images, we add together
the original (primary) image and the change detection image. Since the black
areas in the change image have brightness values of 0, they don't change anything
on the original image. Only the areas in purple are highlighted in the resulting
image. Finally, we add an image that contains a picture of a grid. The resulting
picture for a 25% threshold is:

There are many different kinds of software capable of performing these manipulations
of images. We used the IMAGEMAGICK package from http://www.imagemagick.org.
to create our images. The programs that come with IMAGEMAGICK have a huge number
of options. The specific set of commands we used was:
- composite -compose DIFFERENCE primaryimage.jpg secondaryimage.jpg
out1.jpg
which takes the two images and produces a difference image (out1.jpg)
- convert -threshold 25% -colorize 0/100/0 out1.jpg out2.jpg
which applies a 25% threshold and colors things purple to create the new image
out2.jpg
- composite -compose PLUS primaryimage.jpg out2.jpg out3.jpg
which adds the new image to the original image
- composite -compose PLUS out3.jpg crab_grid.gif finaloutputimage.jpg
which adds the file containing the picture of the grid to produce the finaloutputimage.jpg
file.