Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine the differences between two nearly identical photographs

This is a fairly broad question; what tools/libraries exist to take two photographs that are not identical, but extremely similar, and identify the specific differences between them?

An example would be to take a picture of my couch on Friday after my girlfriend is done cleaning and before a long weekend of having friends over, drinking, and playing rock band. Two days later I take a second photo of the couch; lighting is identical, the couch hasn't moved a milimeter, and I use a tripod in a fixed location.

What tools could I use to generate a diff of the images, or a third heatmap image of the differences? Are there any tools for .NET?

like image 827
STW Avatar asked May 05 '09 06:05

STW


3 Answers

This depends largely on the image format and compression. But, at the end of the day, you are probably taking two rasters and comparing them pixel by pixel.

Take a look at the Perceptual Image Difference Utility.

like image 122
dirkgently Avatar answered Oct 05 '22 23:10

dirkgently


The most obvious way to see every tiny, normally nigh-imperceptible difference, would be to XOR the pixel data. If the lighting is even slightly different, though, it might be too much. Differencing (subtracting) the pixel data might be more what you're looking for, depending on how subtle the differences are.

like image 44
bsneeze Avatar answered Oct 05 '22 22:10

bsneeze


One place to start is with a rich image processing library such as IM. You can dabble with its operators interactively with the IMlab tool, call it directly from C or C++, or use its really decent Lua binding to drive it from Lua. It supports a wide array of operations on bitmaps, as well as an extensible library of file formats.

Even if you haven't deliberately moved anything, you might want to use an algorithm such as SIFT to get good sub-pixel quality alignment between the frames. Unless you want to treat the camera as fixed and detect motion of the couch as well.

like image 35
RBerteig Avatar answered Oct 05 '22 22:10

RBerteig