Tracy's Creative Image Tutorials

Change detection with images (Detecting difference with image subtraction) Free Learning center

More Tutorials right this way...

Change Detection Images

(Detecting change through subtracted images)

History:

Change detection really got its footing in the 70's and 80's as computer images came online. Hard-copy photographs could not be compared in the same way. It's a technique that gained great interest in manufacturing, military reconnaissance, and civilians trying to find out the levels of damage caused after disasters. Change detection is accomplished by processing digital photographs in order to identify differences in places or other things over time. This may be as significant as trying to find ancient temple walls buried underground or as fun as creating an artsy fusion of two images. Back in the film days of cameras everyone enjoyed double-exposure and this tutorial can help you create something like that as well.

Click to jump to GIMP Tutorial steps:

Change detection

A two-year-old leaves tracks in this inverted image of grass.

 

Change Detection Concept:

The idea behind change detection is that you gain information after subtracting two images from each other. These images are best when photographed from as similar a situation as possible. That means ideally they will be photographed from the same camera angle, same sun angle, and other variables that are more related to photographing than what the image is taking a picture of. For instance, in the image above having an exact image of the grass slightly earlier in the day allowed accurate subtraction. All of the information (image pixels) that were similar have cancelled each other out. All of the changes are present and stand out against the now suppressed background. Notice the foot tracks in the grass as the blades of grass that were walked on are now emphasized.

Change detection

Tracks in the grass are present with change detection.

You can jump to the processing steps but here is the overview of how change detection takes place. You will first subtract two images. This is done with a free graphic editing program called GIMP that is provided below. This program subtracts the color components from all the pixels that are in the same locations. Wherever the pixel numbers are the same numeric value the results of the subtraction cancel out to zero. Therefore the color in those areas is black or subdued. Remember that on a digital image zero is black and the black pixel on your computer monitor is off. On the other hand, where the pixel values are not the same we will see the subtraction is not zero. As the differences between the two images and their values get larger than the farther the result is from zero and the brighter the object appears. That's where the changes in the images exist! The paint program subtracts every single pixel between the two images. The final result of the subtraction is an image that shows only the differences between the original two images.

 

Change Detection Analysis and Challenges:

What you quickly learn is that there's an incredible amount of variables in photographing this type of imagery. All the random variables make change-detection difficult. After all, if the photographer isn't taking the pictures at the same moment of the day that is a change too. The shadows will be different and all of those shadow differences could overtake and confuse what you are trying to find out about change in the subject. The topic of change detection is filled with collecting and processing issues that will alter your answer to the question as to what has changed. In the image below you can see the outline of trees. This is due to the separate images being different by one or a few pixels. However, it is also possible that a wind could move all of the trees slightly by the second picture. This would show change as well.

Registration

Tree outlines are present because of slight mis-registration.

In the above case it's fair to use logic and say that the telephone pole to the far right of the image did not sway with a light wind, yet it's base shows the same outline as the trees. The trunk of the larger trees shows slight movement but did they actually move with only a slight wind? It's more likely that the camera was bumped by just a small amount and the entire image is mis-registered by only a pixel or two. There is no mistaking that a person entered the scene given the bright white silhouette. As you can see, photographing and image processing affect the answer you get when checking for change detection. Without the right knowledge of the photographing circumstances and processing methods, you may arrive at a false conclusion. The best advice is to keep an open mind and thoughtfully consider the results.

 

We'll use GIMP to process our images. Here is a bit about GIMP. The GNU Image Manipulation Program, or GIMP, is a free raster graphics editor used to process digital image. GIMP can create graphics, resize, crop , altering colors, combine images, remove image features, and even convert between image formats. GIMP is a powerful program and very comparable tool to the expensive paint program called Adobe Photoshop. I think you'll like it. Note that it is a relatively large file at 16.3MB but small compared to the graphic editing ability it gives you.

***********************************************
Click here to Download GIMP v2.4.5 by Spencer Kimball
***********************************************

 

GIMP Change Detection Tutorial:

So how do I actually do change detection?

1) Let's start by collecting two images. Put your camera on a tripod when taking the photographs. For a perfect circumstance photograph an image of your yard or front room. If you can use a wired remote do so. Try not to shake the tripod too much when you push the camera's shutter button.

Tracy's summer image of home depot

This summer image is the first one in my change-detection

2) Next, add something into the scene that wasn't there before. Add a new object or person and then retake the photograph. The less the camera moves the better. In the examples here I've taken an image in the summer and one in the spring time. I photographed them facing the same direction, at the same object, and both within a few hours after noon.

Tracy's springs image of home depot

This spring image is the second one used in my change-detection

3) Install the free graphics software provided below called GIMP on your Windows machine.

4) Load the images into your computer. Then load both images into GIMP. Copy image one and paste it over image two of the same window.

5) In the GIMP menu open up Dialogs >> Layers. The layers box should appear. Notice you have two layers and one of them is named 'pasted'. The MODE shows as 'normal'. Change the mode to 'Difference'. This will subtract one layer from another.

Tracys image subtraction of home depot using Gimp

Dark colors in this image represent little change.

Notice that the parts of the scene above that were the same in both images are now dark. The new items are more highlighted. You can invert the image colors if you want it to be brighter in its appearance. If you invert the image colors then the lighter objects show less changed and the darker objects are the new ones. The image below gives away that many deciduous trees didn't change because they grow year around. The trees with leaves show a huge change. The grass on the hill side shows differences as it grew in for the summer.

6) Use GIMP to change the contrast and brightness of your change detection image in a way you feel best presents the information. I raised the contrast on the image below.

Tracy's home depot subtraction after inverted
White colors in this inverted image represent minimal change as seen with the buildings and pine trees

 

Historically people have learned all types of information by doing change detection. Ancient buildings have even been found underground because someone took a photograph. Later they took a similar photograph after it had rained or grass had started to grow. It was the odd patterns in the ground that gave away the buried walls of buildings. Try experimenting with some more change detection and see how you do.

 

Swapped channels
Color channels swapped image

Swapping the red and blue channels and upping the saturations shows the changes better. Now dark red to black shows heavy change to the scene while light red and pink are more subtle changes such as the grass in the very center of the image.

 

Want to try some advanced change detection? Try finding two images you have taken in the past but were not exactly the same angles.

1) Use GIMP to stretch and line-up objects in each image. How do you do this? In the GIMP menu open up Dialogs >> Layers. The layers box should appear. Change the Opacity slider so you can see through the image.

2) Then use the cross shaped move and stretching tools to line up the images.

3) You will lastly move the opacity of the first image back to 100% and then perform the subtraction as you did before using the 'difference' pull-down option in the layer box.

4) In the film camera days double-exposures were all the rage. Seeing multiple images merged can be a dramatic visual. Try changing the GIMP layer mode to another setting instead of 'difference' to create double-exposure type images.

 

Feedback Forum

Written the April08 and Updated Apr09 by Tracy Rose