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


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


  • 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?


  • 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.

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

  • 1
    @blunders - 'what is the same' is the key question. In a real camera the images won't be byte-byte identical so you need to set some criteria for 'same'. Is it that both shots have the same object in view, or are you looking for sub-pixel changes in an object? – Martin Beckett Mar 9 '12 at 18:19
  • +2 @Martin Beckett: In an effort to clean up the my question/comments, I've moved the information I provided in comments to your answer/questions -- to being an update to my question. – blunders Mar 9 '12 at 21:22
  • Just noticed your edit, thanks for all the feedback and great suggestions! – blunders Mar 10 '12 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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