File Exchange

image thumbnail

Color name identification: fuzzycolor

version (597 KB) by John D'Errico
Efficient identification of color names for any RGB


Updated 20 Sep 2006

View License

Yes, its easy to identify [1, 0, 0] as a red color. But sometimes we want to find ALL colors in an image that we would identify as red. Thus, [1, 0.1, 0.1] is also easily seen as red by the eye. Its not so easy to do computationally however, since the set of colors which we might perceive as some given color name is probably not a simple set. Its probably not convex, and not all of us will even agree on the exact boundaries of that set. The fuzziness of those boundaries is why I've called this tool fuzzycolor.

Fuzzycolor uses a database that I've constructed for each color name, then applies interp3 to identify any color names in question. So fuzzycolor will be fast, and can be applied to entire images at will. See the demo.

Fuzzycolor can recognize colors as belonging to specific color name sets, or it can test all color names in its database. Again, see the demo.

Unfortunately, the database is not truly complete, including only a few select colornames, currently:

'red', 'green', 'blue', 'neutral', 'pastel', yellow', 'flesh'

I'll expand this list as I find time. I also hope to improve the existing lookup tables, as their margins are still not quite as accurate as I would like. I'll happily accept additions from others too. For those who wish to improve my database, I've included a tool that puts the user through a visual experiment to outline the set of all colors that fit a given colorname. (I will improve this tool for the next revision.)

I assumed a D65 iluminant to build the "neutral" and "pastel" lookup tables. The flesh tone lookup table was built from a small set of flesh tone patches that I dug up.

Cite As

John D'Errico (2021). Color name identification: fuzzycolor (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Amit kumar rajpoot

How to created this FuzzyColorData database ,thanks

Dom Lee

very good tutorial,thanks

Stephen Cobeldick

I wrote a color identifier function to convert between RGB and colornames:

The user can choose the to match RGB values using least-squares, or one of the color-difference methods CMC2:1, CIE76, or CIE94 (the default). A bonus function is also included that demonstrates that differences between these matching methods. For more info on these methods, see also:

Lyuboslav Petrov

Very happy with results. Great Work!

John D'Errico

No, the use of a different color metric would not make things more simple. For example, CIE L*a*b* does not make the color name boundaries that much simpler. In fact L*a*b* has some well known (published) flaws here, where if you fix hue angle and move inwards radially the color name will still vary from blue to purple. Even a Munsell color space would leave some people in disagreement about color boundaries. The fuzzycolor tool allows you to redefine the color name boundaries if you are unhappy with the set I've chosen in advance.

In addition, the visual experiment that I did to define the color name boundaries was performed on a monitor, and I provide a tool to change the database should a user wish to define some other color names. Suppose you tried to define the database in terms of some other color space, perhaps L*a*b*. There are serious gamut mapping problems when one would try to convert an L*a*b* color cube into monitor RGB values for the experiment. Remember, the gamut of a L*a*b* color cube is VERY different from that of your monitor. This would completely invalidate any such visual experiment. An HSV color cube would have the same issues.

Cris Luengo

Why use RGB space to find colors, and not a more suitable color space like HSV, or the more perceptually uniform CIE-Lab? I would guess your database would be a lot simpler! MATLAB has standard functions to convert RGB color triplets to HSV and the like, and you can find out about CIE-Lab and CIE-Luv here:

alebda3 ana

That's good
but we want know how you can do it in more details>>>>
if you can present any code for help us in our careful about color

Richard Brown

I really like the concept, and the results are good, along with the documentation, but it, on my machine (Matlab R14SP3, WinXP), creates a 14MB persistent variable, and runs slower than I might have expected for something like this.

FENDRI Mohamed Mourad

It could be more interesting if you could work on classification of each pixel for a possible color image segmentation using your concept of "natural color"
sincerely yours

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!