Color matching and comparison

35 views (last 30 days)
N.B.
N.B. on 1 May 2013
Commented: Image Analyst on 3 Oct 2019
Hey gang,
I am hoping that I can be placed onto the right thought process track. My end-goal is as follows:
  • Load an image into MatLab.
  • Find an average color value of the loaded image and save that value.
  • Compare that color value to a group of other color values, and find which color value matches the one from the image.
So basically, I am wondering if it is possible to find an average color value from an uploaded image? The images that I hope to upload are primarily of the same color (brown), but there will be different shades of brown in that image. I want to compare that image to a group of other images and find which one matches the loaded image best.
Thanks for your help!
  2 Comments
Benjamin Drewry
Benjamin Drewry on 3 Oct 2019
try looking for the most prominent colors in the image and use a euclidean distance measurement to see which reference color is closest to the color of the cell under test
Image Analyst
Image Analyst on 3 Oct 2019
Post a new question with two or three of your images attached.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 1 May 2013
You can definitely do this. Check out my Delta E application in my File Exchange. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 The only difference is that after you draw a color in one image you want to apply it to other images instead of the same image.
You might also enjoy this web site: http://labs.tineye.com/multicolr/ Or this one: http://colorthesaurus.epfl.ch/
  3 Comments
Image Analyst
Image Analyst on 1 May 2013
Glad you liked it. And those web sites were pretty cool too, huh?
But you don't exactly save the delta E in the original image. You would save the mean LAB value of the desired are of your input image - the area could be the whole image if you want. You would save that lab probably in a mat file if you wanted to save it. Then you'd read in an image and calculate the delta E for each pixel in that image. You don't need to save the delta E anywhere but in a variable in your comparison program. You could save it into a mat file also if you wanted, but you wouldn't save it in the original image file. So then you have a delta E image for this test image - basically row 2 column 3 of my demo above. Then you can threshold it to take deltaE less than some certain amount, like say 20, to find pixels close in color to your reference lab value that you want to match. That would give you a binary image (a mask) like in the lower left above. Then you can multiply the mask (or its inverse) to get the two images in the lower right.
Jurgen
Jurgen on 1 May 2013
You can do the same for RGB (or any other colorspace) instead of LAB.
Some choose CIEXYZ over LAB because XYZ primaries have a better correlation with light mixing. I.e. the xy chromacity better depicts how much of certain types of light should be mixed to get a color, whereas a*b* converts this to human 'perceptual amounts'.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!