I need to diff two images to see what color(s) are different. Any medium level algorithms?

algorithm, color-picker, computer-vision, image-processing

Solution

Since it sounds like you only want to tell what colours they differ by (without regard to shape etc.) and that you expect the shapes will be highly similar (though not identical), I would:

- Compute colour histograms for each image (you may need 3 histograms each for R, G, B)

- Subtract them (`z = abs(x - y)` for each colour)

- Identify peaks in the resulting histogram(s)

When a significant area is coloured differently in each image, this will give you two high peaks in the final histogram(s). (Drop the `abs()` if you need to tell which is which.)

[EDIT] As jilles de wit suggests, it's better to look at frequencies of (R, G, B) triples instead of individual colours (i.e. for each image create one big histogram of size 256*256*256 instead of 3 size-256 histograms). But in this case the histogram vector is huge and likely to be mainly filled with zeros, so it is a good idea to quantise the intensities down from 256 to say 16 levels, giving a more manageable 16*16*16 vector.

Problem

If I have two images which are both the left side view of a the same shoe in different styles, how can I determine by which color(s) they differ? Perhaps it's a shoe in two styles, one style has pink laces and a white side, the other has white laces and a yellow side. I want: Image One Colors: C1=Pink, C2=White Image Two Colors: C1=White, C2=Yellow No super high level algorithms, but I don't need actual implemented code either. Perhaps just loops, data structures, conditions.. The actual shoe part of the image will be on a white background. These will be photographs similar to what you'd see on endless.com or zappos.com so they're very similar, but require some tolerance.

Original source