0

I have a need to compare a color from an image to an array of other colors and determine which of the other colors it is most perceptually similar to.

I do not know a lot about color theory. I understand that L*a*b* is the colorspace that is most commonly used to compare colors, perhaps using the deltaE metric, but I also believe that this colorspace is not supported in iOS.

I know how to get the colors in HSV or RGB but I don't know if they can be converted into a L*a*b* colorspace programmatically or if there is a way to brute force compare the colors in one of the other colorspaces that is supported by iOS.

Any help would be truly appreciated.

  • possible duplicate of [Is there an easy way to compare how close two colors are to each other](http://stackoverflow.com/questions/492211/is-there-an-easy-way-to-compare-how-close-two-colors-are-to-each-other) – Greg Hewgill Jul 27 '14 at 21:40
  • I don't think it's a duplicate. I already know that LAB/deltaE is a good way to compare colors, but it's not supported in iOS. So I either need to know how to convert RGB to LAB in iOS or know another way to compare colors in another colorspace that is supported. – Sarah L Jul 27 '14 at 21:43
  • See the SO question [RGB to XYZ and LAB colours conversion](http://stackoverflow.com/questions/15408522/rgb-to-xyz-and-lab-colours-conversion). Also [UIColor CMYK and Lab Values?](http://stackoverflow.com/q/14912938/451475) – zaph Jul 27 '14 at 22:00
  • Thanks. Those were helpful. – Sarah L Jul 31 '14 at 22:28

0 Answers0