RGB to HSI, HSI to RGB Conversion Calculator

The RGB color model is an additive system in which each color is defined by the amount of red, green, and blue light emitted. In the RGB scheme, colors are represented numerically with a set of three numbers, each of which ranges from 0 to 255. White has the highest RGB value of (255, 255, 255) while black has the lowest value of (0, 0, 0). This is consistent with the additive nature of the RGB system, since white light is the presence of all colors of light, and black is the absense of all light.

There are other three-parameter representations of colors. One such system is the HSI color model, which encodes colors according to their Hue, Saturation, andIntensity. The HSI model is used by some graphics programs and color monitors as an alternative to, or alongside the RGB representation.

In the HSI system, the hue of a color is its angle measure on a color wheel. Pure red hues are 0°, pure green hues are 120°, and pure blues are 240°. (Neutral colors--white, gray, and black--are set to 0° for convenience.) Intensity is the overall lightness or brightness of the color, defined numerically as the average of the equivalent RGB values.

The HSI definition of saturation is a measure of a color‘s purity/grayness. Purer colors have a saturation value closer to 1, while grayer colors have a saturation value closer to 0. (In other color models, the meanings and mathematical definitions of "saturation" are slightly different. See HSL and HSV color models for comparison.)

Equations to Convert RGB Values to HSI Values

Suppose R, G, and B are the red, green, and blue values of a color. The HSI intensity is given by the equation

I = (R + G + B)/3.

Now let m be the minimum value among R, G, and B. The HSI saturation value of a color is given by the equation

S = 1 - m/I    if I > 0, or
S = 0            if I = 0.

To convert a color‘s overall hue, H, to an angle measure, use the following equations:

H = cos-1[ (R - ½G - ½B)/√R² + G² + B² - RG - RB - GB ]            if G ≥ B, or 
H = 360 - cos-1[ (R - ½G - ½B)/√R² + G² + B² - RG - RB - GB ]    if B > G,

where the inverse cosine output is in degrees.

Equations to Convert HSI Values to RGB Values

To convert hue, saturation, and intensity to a set of red, green, and blue values, you must first note the value of H. If H = 0, then R, G, and B are given by

R = I + 2IS
G = I - IS
B = I - IS.

If 0 < H < 120, then

R = I + IS*cos(H)/cos(60-H)
G = I + IS*[1 - cos(H)/cos(60-H)]
B = I - IS.

If H = 120, then the red, green, and blue values are

R = I - IS
G = I + 2IS
B = I - IS.

If 120 < H < 240, then

R = I - IS
G = I + IS*cos(H-120)/cos(180-H)
B = I + IS*[1 - cos(H-120)/cos(180-H)].

If H = 240 then

R = I - IS
G = I - IS
B = I + 2IS.

And if 240 < H < 360, we have

R = I + IS*[1 - cos(H-240)/cos(300-H)]
G = I - IS
B = I + IS*cos(H-240)/cos(300-H).

时间: 2024-10-22 06:34:21

RGB to HSI, HSI to RGB Conversion Calculator的相关文章

RGB 与 (RGB转 YCbCr再转为 RGB)的图像

RGB 与 (RGB转 YCbCr再转为 RGB)的图像   不可逆,可以从 矩阵的逆运算看出来. 附上 matlab 代码: clc,clear; Source=imread('1.jpg');%读入原始RGB图像 figure(1); subplot(1,2,1); imshow(Source):title('original image');%显示图像 [r c d]=size(Source);%计算图像大小 %------计算红色分量并显示分解图------% R(:,:,1)=Sour

RGB 颜色空间转 HSI 颜色空间的matlab程序实现

程序实现的时候注意把RGB像素值归一化就是了,然后千千万万要根据公式来,不能大意,我之前就有theta为复数的情况,是sqrt对负数进行运算进而得到了复数的结果(BUG) 程序是由matlab实现的,利用了矩阵运算的便捷性,这里如果直接操作单个元素的话...会很慢很慢,慢到能把我电脑卡死...如果改写成C可能程序的性能还是会有问题 好吧,介绍一下HSI和RGB的转化方法 %****************************************** % Code writer : EOF

如何将24位RGB颜色转换16位RGB颜色

有许多朋友第一次使用16位彩色显示屏会遇到如何将24位RGB颜色转换为对应的16位RGB颜色的问题,通过查阅相关资料,就写一下其中的转换原理吧,希望对大家会有所帮助. 我们知道24位RGB是分别由8位红色,8位绿色以及8位蓝色组成: RRRRRRRR GGGGGGGG BBBBBBBB 例如:24位RGB红色表示方法为 11111111 00000000 00000000        (十六进制表示为:0xFF0000) 而对应的16位RGB颜色则是由5位红色,6位绿色以及5位红色组成: RR

D2. RGB Substring (hard version)||D1. RGB Substring (easy version)

D2. RGB Substring (hard version)    原题传送门 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions is the size of the input. You are given a strin

RGB、HSV、HSI颜色空间

概述 这篇博客主要介绍RGB.HSV和HSI颜色空间以及转换公式. RGB颜色空间 定义 RGB颜色空间通常用于显示器系统,例如:电脑.电视机的显示器使用的都是RGB颜色空间.利用物理学中的三原色叠加原理,可以产生各种颜色.在RGB颜色空间中,R.G.B各颜色分量彼此独立. RGB颜色空间的缺点在于不符合人眼的视觉特性,直接处理多有不便,因此通常需要转换到其他颜色空间进行处理,最后再转换到RGB颜色空间,用于显示器显示. 数学模型 RGB颜色空间中,R.G.B三个分量彼此独立,所能表示的范围也相

引入HSI彩色模型与RGB转HIS?

1.为什么要引入HSI彩色模型? 简单的来说,RGB模型可以很好的适应颜色的事实,但是并不能很好的适应人解释的颜色.当人观察一个彩色物体时候,我们用色调(Hue),饱和度(Saturation )和强度(Intensity)来描述. 色 调:是指一种纯色的颜色属性,(色调与波长有关,是人对不同颜色的感受): 饱和度:是指纯色被白光稀释的程度的度量,(饱和度越大越鲜艳): 亮 度:是一个主观因子,实际上是不可度量的,(亮度和图像灰度是颜色的明亮程度). 总体来说,RGB模型更适合图像颜色生成,而H

引入HSI彩色模型与RGB转HSI?

1.为什么要引入HSI彩色模型? 简单的来说,RGB模型可以很好的适应颜色的事实,但是并不能很好的适应人解释的颜色.当人观察一个彩色物体时候,我们用色调(Hue),饱和度(Saturation )和强度(Intensity)来描述. 色 调:是指一种纯色的颜色属性,(色调与波长有关,是人对不同颜色的感受): 饱和度:是指纯色被白光稀释的程度的度量,(饱和度越大越鲜艳): 亮 度:是一个主观因子,实际上是不可度量的,(亮度和图像灰度是颜色的明亮程度). 总体来说,RGB模型更适合图像颜色生成,而H

图像色彩空间之RGB与HSI

根据颜色感知的角度来分类,颜色空间可考虑分成如下3类. 1)混合型颜色空间:按3种基色的比例合成颜色.例如,RGB,CMY(K)和XYZ等颜色空间就属于这种类型. 2)非线性亮度/色度型颜色空间:这种色彩空间的特点是用一个分量表示非色彩的感知,用两个独立的分量表示色彩的感知.当需要黑白图像时,这样的系统非常方便.例如,YUV等. 3)强度/饱和度/色调型颜色空间:用饱和度和色度描述色彩的感知,可使颜色的解释更直观,而且对消除光亮度的影响很有用.例如,HSV, HSL等. RGB颜色模型对应笛卡儿

RGB,CMYK,HSB各种颜色表示的转换 C#语言

Introduction Why an article on "colors"? It's the same question I asked myself before writing this series. The fact is, in .NET, there are only two color formats that can be used: the RGB color model and the HSB color model. Those two are encaps