Computer Vision – OpenCV Options for Image Difference Analysis and Reporting

computer vision

Scenario: Stationary view with sequential timestamped samples in 2D-color where the comparison is only done between one pair of neighboring samples.

Background:

  • Have never used OpenCV before,
  • Limited understanding of computer vision,
  • Moderate experience scripting programs.

Questions:

  • Given the information provided, what additional information would be of use?
  • What existing related analysis and reporting solutions within OpenCV should I look into more?

UPDATES:

  • What is the source of these images? I've abstracted the intent of a problem to the degree in an attempt to avoid skewing how the answers conceptualize the related solutions. Disclosure-of-Problem-Domain: It's possible that I'm wrong about the value of abstracting the problem domain, and since it's already been guessed, I'll confirm the domain is any high-value automated GUI testing that is of relatively low-complexity. Currently, seems like simple regression testing based on pixel-for-pixel change which is then sorted by the percentage of pixels change on a pair-by-pair basis would be quick and produce value, but the template matching suggested by Martin Beckett might allow for cross-platform testing, though again not knowing much about OpenCV, or the domain of computer vision, it's hard to say complex or valuable such an approach might be currently.
  • What is the same? Depends on the solutions OpenCV offers in the context of image difference analysis and reporting. Any artifacts related to the capture would/should be accounted for in the comparison analysis. Ideally, difference reporting should by default (or predictive coding) only profile material significant state changes in a way that allows the manual response to them to be prioritized.
  • What are the circumstances of the image capture? All pairs are sampled within a highly controlled environment with the same stationary view/angle, lighting, exposures, focus, etc.

Best Answer

You have pairs of images that you want to compare?

What is the source of these images?
ie. Screen shots of a gui testing app or low quality noisy CCTV

What are the circumstances of the image?
Is it the same calibrated fixed camera at the same angle. Are these hand held shots at different exposures, focus and angle

What constitutes 'the same' ?
ie. Every pixel value identical. The art work isn't missing. It's the same person. They are both pictures of a tree

It basically comes down to two approaches, histogram and structure.
Histogram approaches just count the number of pixels of each colour in the two images. If you are only trying to find the pair that are a face then having a similar percentage of skin coloured pixels is probably good enough. For skin you often do this in a different colour space.

Structure means looking for particular shapes and objects in the scene. There is an opencv Tutorial on template matching. But this normally requires high quality very similar images (same angle, scale, exposure). Or there are more complex procedures to identify features and look for patterns in the ratio of various distances - this is how most biometrics work.

edit: If you are comparing very similar images, eg screen shots from a gui test tool, and you only need to know if two are identical then you need to calculate a hash of the image and compare that.
Simplest is just a histogram of pixel values - but this wouldn't detect if an identical window had moved on screen for example. The next easiest is a list of features found by SURF