Question

I need a way to measure color correlation of pixels. For example, it's obviously that color correlation between those two pixels chains is higher

enter image description here

comparing to two chains below

enter image description here.

Ok, I can: correlate R,G,B values separately but what to do next ? I need to obtain only one figure, not three.

I also can transform RGB to HUE representation, but it looks that for all "grey"-colors (from black to white) H-component = 0, so, correlating different luminance grey-pixels will give same value...

So, I need your suggestions and help :) thanks

Was it helpful?

Solution

In order to compare the R, G and B composents between two pixels, cosine similarity http://en.wikipedia.org/wiki/Cosine_similarity is certainly the best solution.

After that, if you want to compare the arrays only by comparing couples of pixels that are in the same index, you can just sum the values. You can also sum a rapidly decreasing function of the values as they decrease (for example the square) if you want to discard cases where nearly all the pixels are the same but with one or two big differences. You can take the square root if you want the opposite (privilegiate the number of nearly identical pixels rather than the fewest differences).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top