识别RGB空间中不同颜色的范围是什么? [英] What are the ranges to recognize different colors in RGB space?

查看:1060
本文介绍了识别RGB空间中不同颜色的范围是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式确定给定像素是否为黄色?还是红色?还是另一种颜色?

How do I programmatically determine whether or not a given pixel is yellow? Or red? Or another color?

红色通常在RGB空间中为(255,0,0),但我们也知道(230,0,0)也将显示为红色

Red is usually (255,0,0) in the RGB space, but we also know that (230,0,0) will also appear red.

是否存在将RGB空间划分为八种主要颜色的标准-红色,绿色,蓝色,黄色,品红色,青色,黑色和白色。 ?

Is there any standard which splits the RGB space into, say, the eight major colors - red, green, blue, yellow, magenta, cyan, black, and white?

推荐答案

确定RGB可能很复杂,但是您可以将RGB值转换为HSV,这种格式可以通过色相,饱和度和价值。这是用于在诸如Photoshop之类的软件中选择特定颜色的系统。

Determining that in RGB can be complicated, but you can convert a RGB value into HSV, a format that represents colors by Hue, Saturation and Value. This is the system used to pick specific colors in software like Photoshop.

在此系统中,光谱的所有颜色都用一个范围为单个浮点数(Hue)表示。从0到360度,其他2个数字只会修改此颜色(告诉它是灰色还是明亮)。

In this system all colors of the spectrum are represented in a single floating pointer number (Hue) that ranges from 0 to 360 degrees, the other 2 numbers only modify this color (tell if it's grayer or brighter).

这使比较颜色变得容易,因为您可以在该图像上看到RGB和CMYK系统中的每个原色都相差60度。

This makes it easy to compare colors, as you can see on this image every primary color in both the RGB and CMYK systems are exactly 60 degrees apart.

在这里您可以很容易地看出30到90之间的任何东西都是黄色,330(或-30)到30之间的任何东西都是红色,依此类推。

Here you can easily tell that anything between 30 and 90 is a tone of yellow, anything between 330 (or -30) and 30 is a tone of red and so on.

您甚至可以更具体地确定橙色,紫色和其他非主要颜色的色调范围。

You can even be more specific and determine ranges for tones of orange, purple, and other colors that are not primary.

关于黑白,您可以通过检查颜色的值是否低来确定颜色是否为黑色,例如说小于0.1(范围从0到1),如果找到高值(例如大于0.9)和低的组合,则确定颜色是否为白色饱和度(例如低于0.1)。当然没有确切的数字,因此您必须自己决定什么时候深色或非常亮的颜色变成黑色或白色。

About black and white, you can determine if a color appears black by checking if it's Value is low, say less than 0.1 for instance (it ranges from 0 to 1), and if it's white if you find the combination of high Value (bigger than 0.9 for instance) and low Saturation (lower than 0.1 for instance). There are no exact numbers of course, so you will have to decide for yourself when a very dark or very bright color becomes black or white.

这篇关于识别RGB空间中不同颜色的范围是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆