3

I have a small render engine written for fun. I would like to have some unit testing that would render automatically an image and then compare it to a stored image to check for differences. This should give some sort of metric to be able to gauge if the image is too far off or if we can attribute that to just different timings in animations. If it can also produce the location in the image of the differences that would be great, but not necessary. We can also assume that the 2 images are the exact same size.

What are the classic papers/techniques for that sort of thing ?

(the language is Go, probably nothing exists for it yet and I'd like to implement it myself to understand what's going on. The renderer is github.com/luxengine)

Thank you

  • Did you try to trivially take the difference pixel per pixel? – Alessandro Jacopson Jun 08 '16 at 14:20
  • Yeah, it doesn't really work well because a small timing change can shift some part of the image left or right and then all these pixels are considered super different –  Jun 08 '16 at 14:25

1 Answers1

0

One idea could be to see your problem as a case in Image Registration.

The following figure (taken from http://it.mathworks.com/help/images/point-mapping.html) gives a flow-chart for a method to solve the image registration problem.

enter image description here

Using the above figure terms, the basic idea is:

  1. find some interest points in the Fixed image;
  2. find in the Moving image the same corresponding points;
  3. estimate the transformation between the two images using the point correspondences. One of the simplest transformation is a translation represented by a 2D vector; the magnitude of this vector is a measure of differences between the two images, in your case it can be related to the shift you wrote about in your comment. A richer transformation is an homography described by a 3x3 matrix, its distance from the identity matrix is again a measure of differences between the two images.
  4. you can apply the transformation back, for example in the case of the translation you apply the translation to the Moving image and then the warped image can be compared (here I am simplifying a little) pixel by pixel to the Reference image.

Some more ideas are here: Image comparison - fast algorithm

Community
  • 1
  • 1
Alessandro Jacopson
  • 18,047
  • 15
  • 98
  • 153