I have the following problem:

I need to detect changes between two more or less similar image.

Before After

In that case, I want to detect the missing parts.

Lets assume that the displacement is no more that 2px, and there is no significant change in light (but there is some) or camera pose.

What I want as an output, is a binary image about if there is a signifiacant change at that position.

My naive idea was, to apply blur (aroud the size of expected displacement), and compare pixelwisely, but in practice its not working really well. (mainly it has a huge amount of noise around edges)

enter image description here

Any better idea for this problem?

  • $\begingroup$ Do their subjective analysis using the below metrics: 1. Mean squared error 2. PSNR 3. SSIM 4. Precision $\endgroup$ Jul 13, 2018 at 10:39

2 Answers 2


The first part of the problem that you're describing is called registration. Assuming that the displacement is indeed small, and your problem has no time limits, you can use normalized cross-correlation on the images to find the displacement. It will also take care of amount of light normalization. (That means that you are assuming that the transformation between the two images is only displacement.)

After you found the displacement, you can normalize both of the images by their mean intensity, and do some simple pixel-by-pixel comparison.

Ideas for improvement and variations:

  • Use keypoints descriptors and matching to find transformation between two images, to save runtime.
  • Use different models of transformation for different scenarios - rotation for in-plane camera rotation that is orthogonal, scale for zooming scenarios, perspective for out-of-plane rotations.
  • Use smarter comparison between the two registered images, for example, only in the places where there are edges.
  • Create a noise model by checking your camera characteristics in order to know what is a significant change. For example, more than two standard deviations of noise.

If I were to approach the problem here's what I might try...

  1. convert the images to greyscale
  2. as Andrey suggested, look at the normalized cross-correlation on a subregion of the images to find the displacement.
  3. shift and crop images to adjust for displacement.
  4. blur, then down-sample
  5. compute difference between resulting images
  6. threshold the difference to create a binary image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.