如何从它的rgb值获取颜色名称

问题描述:

我在写一个程序来获取颜色的名称。我可以得到像素的rgb值,但找不到如何得到它的名称。
是否有任何c ++库可以从其rgb值获取颜色的名称?
或者找到最匹配的颜色名称?

I'm writing a program to get the name of a color. I can get the rgb value of the pixel, but couldn't find out how to get its name. Is there any c++ library that can get the name of a color from its rgb value? Or find the closest matching color name?

除了 HTML颜色表,还有 RAL标准,这是一个行业中使用的熟知系统。

Aside from HTML color tables, there's also the RAL standard, a well known system used in the industry.

基本上,需要的是代码表,其中包含名称和RGB值。只要表格的分辨率和频谱足够,就可以很容易地找到最接近匹配的颜色名称:

What one would need is basically the code table with names and RGB values. One can easily find the closest match for the appropriate color name, as long as the table's resolution and spectrum is sufficient:

  • http://www.ralcolor.com/
  • http://www.gobias.com/convert-ral-to-rgb.html
  • http://en.wikipedia.org/wiki/List_of_colors

一个简单的 CSV阅读器,加载颜色表可能是一个解决方案。

A simple CSV reader, to load the color tables may be a solution.