comparing colour similairty of two images

hi,
I have two RGB images of same size (250x250 or 100x100 depending on the program); but i need to get a value for the two images colour similairty. I have seen people saying that Delta E or Euclidean Distance for its similarity but i dont know how to get a double value for this. I basically just want to know how much of the same colours are used in image A and Image B.
Sorry if that sounds confusing. Thanks in advance

Answers (1)

I was just talking about that today. Two engineers from our manufacturing group called me in today to consult on the very same general problem (quantifying color difference), and a month ago from someone in R&D on a totally different color comparison problem. It really depends on what you want to detect. For example do you just want a single metric about how different are images that are substantially the same? Do you want to compare discolorations for two images that are not substantially the same, spatially? Do you want to detect if your component "spot colors" in your manufacturing process are no good? Do you want to detect if your image is not being printed due to dithering problems or misalignment of print heads, or a print head being clogged?
Anyway, you can use delta E, or you can compare quantized gamuts, or you can use custom algorithms like the one these people developed. It just depends on what information would be useful to you. Maybe you can post a "good" image and a "bad" one that you want to compare to the good one.

10 Comments

Hi, Thanks for the help. I just want to know the difference between the general colour of the two images are in terms of a valu (int or double). Its for graphic design comparison. an example would two images using mainly are 30% different and a mainly blue image and mainly white imager are 70% different(or similar inversely).
Are they synthetic computer graphic images of pure colors? Are they images of some printout or package that was scanned in with a flatbed scanner? Are the "test" and "reference" image aligned/registered? The brain-dead simple way is to just subtract the images. If the images are the same, the subtraction will be zero. Of course that dumb algorithm has many, many problems with real world images, as you can imagine, meaning you can think of many situations where the two images can be "the same" but the subtraction is non-zero (for example misaligned images or different exposures, etc.).
Its basically for new logo designs. so basically simple graphics and I need to find similar logos based on colour but I only have like 2 days to write the code and have very little experiance with matrix and vectors. Someone suggested getting the average RGB of the two images; but how would I convert that result something I can put in to an if statement (ie. if >04. then && if >.8 then etc.)
No, that's really simplistic thinking. I can suggest two non-MATLAB ways to do it.
One is to use Google Images. Go to Google, click images, at the far right end of the search field click the camera, upload your logo from your computer, and see what it comes up with. I'm not sure what they do but it's probably a full CBIR search.
Another one just goes based on colors, so it's only like a partial/limited CBIR search. But it's a whole lot of fun. It's this: http://www.npr.org/blogs/thetwo-way/2010/12/10/131960390/color-picker-sorts-flickr-photos-for-fun
And a similar one is this: http://labs.tineye.com/multicolr/#colors=445e9a;weights=100; Again, a lot of fun, though it's just based on color, not other features like shape, etc. like Google probably does.
thanks i will have a look. as Ive tried and not been able to, how would I do the average rgb comaprison?
meanRed = mean2(rgbImage(:,:,1));
meanGreen = mean2(rgbImage(:,:,2));
meanBlue = mean2(rgbImage(:,:,3));
thanks. sorry to keep asking but how would i comare the two and get a double value for images of size 100x100 or 250x250
% Get means of first image
meanRed1 = mean2(rgbImage1(:,:,1));
meanGreen1 = mean2(rgbImage1(:,:,2));
meanBlue1 = mean2(rgbImage1(:,:,3));
% Get means of second image
meanRed2 = mean2(rgbImage2(:,:,1));
meanGreen2 = mean2(rgbImage2(:,:,2));
meanBlue2 = mean2(rgbImage2(:,:,3));
thanks. I fif that for two 100x100 images. how can i now nuse this to see if there is colour similarity betweent he two images(how much of the colours in the two images match). If i just substract the values, would that give me some indication. e.g. if meanRed1 - meanRed2 = 10 they are similair and if meanRed1 - meanRed2 = 200 they are not???
Im sorry if this is coing across as simple. I just havent worked with image processing before
meanRed1 = 249.3624 meanGreen1 = 198.9532 meanBlue1 = 198.9566
meanRed2 = 215.1892 meanGreen2 = 205.3406 meanBlue2 = 213.5244
You need to cast to double so you can get negative values. Then take the absolute value
deltaR = abs(double(meanRed1) - double(meanRed2));
deltaG = abs(double(meanGreen1) - double(meanGreen2));
deltaB = abs(double(meanBlue1) - double(meanBlue2));
I don't know your definition of similar. I don't know how close they need to be to be "similar". Maybe 10 is fine, maybe 20, maybe 30. That's your choice.

Sign in to comment.

Products

Asked:

on 20 Apr 2015

Commented:

on 21 Apr 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!