Message Boards Message Boards

5 Replies
8 Total Likes
View groups...
Share this post:

Spotting Differences In Digital Photos

Posted 11 years ago
Pete here - just letting you know that I have an interest in developing MM software that looks for differences in a pair of digital photo's.  If you have a similar interest, feel free to get in touch.  Imagine you have 2 digital images side-by-side.  Same size and format.  Your goal is to find which things are different between the two photo's.  It's possible to subtract images, of course.  But beyond that we might ask which objects or templates or patterns have changed.  So I'm just taking a look at that problem righ now.  No rush.
POSTED BY: pete p
5 Replies
A few ideas:

1) One approach to registering your images might be to use a function like ImageAlign:

This function will find common features and perform the transformations necessary to register your images.  You don't even need to have the same number of pixels in each image.

2) A common way of getting rid of noise is to use some combination of blurring (a.k.a convolution) and thresholding.

With blurring, you spread random effects over neighboring pixels, effectively averaging out noise.  You can then throw out any small changes with thresholding.  The blog post that Sean links actually does this with Blur and Binarize (although you might want to use the Threshold function instead of Binarize).

3) Overcoming lighting changes will probably be the most difficult part.  One approach might be to look for edges in your image instead of looking for changes in the color of individual pixels.  You might use functions like EdgeDetect or GradientFilter to do this.

The basic idea is that the color of pixels might change due to lighting, but the edges created by cars and other objects should remain regardless of the lighting.  So you could run something like EdgeDetect on each of your images, and look for changes in the edges over time.
POSTED BY: Karl Isensee
Posted 11 years ago
Some "answers" for you. I should have provided a few more details on what I am trying to do.

Luc: you're definitely right.  I'll get a couple of images.  In the mean time - a brief description below will explain the technical problem. 
Sean and Vitaliy - yes I believe some of the things I am looking for will require pattern recognition.  so i will follow up with the links.

PHOTO's:  Imagine that you go outside and take a photo of some cars parked along the street.  The next day you take a similar photo with the same camera (from the same exact location and angle).  Let's suppose also that none of the cars have moved their positions on the street.  However, on the second day you have placed a small object on the hood of one of the cars - like a cell phone or a wallet.  I would like my software to be able to recognize this "different object" by examining the two photographs and comparing them.  However, there are a number of technical problems to solve:

1.  The two images, although identical in pixel counts, may not match up perfectly in the placement of the contents.  The center of the viewing area in one photo might be slightly different than in the other photo - so how do I match up the two photo's based on the actual objects shown in the images?

2.  I can subtract the images - and this is certainly one technique.  But imagine that the photo's have a small amount of noise that affects the pixels.  Subtraction should also pick up this random noise - which means that my subtracted image is covered by a lot of random dots from miscellaneous pixels.  This needs to be taken out somehow.

3.  The BIG problem is that the lighting for the two images may not be identical.  In one case the cars may have been completely in the shade because it was a cloudy day.  In the next photo - the cars may have sunlight falling on some part of them.  So somehow I need to set aside the lighting differences in the image calculations, otherwise subtracting the images will bring out many huge differences due to the lighting changes.

I will make a pair of photo's so this example can be more specific.

kindest regards,
POSTED BY: pete p
This blog post has a good example of a situation where you might want to find the difference between two images.
Simply subtracting the images won't be enough in most cases, but you can try the technique shown here:
POSTED BY: Sean Clarke
Sean gave a good pointer. There are quite a few other recourses. For example, differences can be measured as lack of similarity. And detecting pattern similarity on a high level was discussed here:

Detecting Kinship from a Pair of Images

Another one on visual similarity is very recent:

Random and Optimal Mathematica Walks on IMDb’s Top Films   
POSTED BY: Vitaliy Kaurov
Pete, If you can share a few images as example of what you want to compare, you might get help from the community to accelerate your project.
POSTED BY: Luc Barthelet
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract