http://www.cs.rit.edu/~ncs/color/t_convert.html

原创 2005年05月26日 08:52:00
What color space we should used in image retrieval
L*a*b*
Because the eculedian distance of this space is the same as the distance of which human man perceived!

Color Conversion Algorithms


Contents


RGB to HSV & HSV to RGB

The Hue/Saturation/Value model was created by A. R. Smith in 1978. It is based on such intuitive color characteristics as tint, shade and tone (or family, purety and intensity). The coordinate system is cylindrical, and the colors are defined inside a hexcone. The hue value H runs from 0 to 360º. The saturation S is the degree of strength or purity and is from 0 to 1. Purity is how much white is added to the color, so S=1 makes the purest color (no white). Brightness V also ranges from 0 to 1, where 0 is the black.

There is no transformation matrix for RGB/HSV conversion, but the algorithm follows:


When programming in Java, use the RGBtoHSB and HSBtoRGB  functions from the java.awt.Color class.


RGB to YIQ & YIQ to RGB

The YIQ system is the color primary system adopted by National Television System Committee (NTSC) for color TV broadcasting. The YIQ color solid is made by a linear transformation of the RGB cube. Its purpose is to exploit certain characteristics of the human eye to maximize the utilization of a fixed bandwidth. The human visual system is more sensitive to changes in luminance than to changes in hue or saturation, and thus a wider bandwidth should be dedicated to luminance than to color information. Y is similar to perceived luminance, I and Q carry color information and some luminance information. The Y signal usually has 4.2 MHz bandwidth in a 525 line system. Originally, the I and Q had different bandwidths (1.5 and 0.6 MHz), but now they commonly have the same bandwidth of 1 MHz.

Here is the RGB -> YIQ conversion:

    [ Y ]     [ 0.299   0.587   0.114 ] [ R ]
    [ I ]  =  [ 0.596  -0.275  -0.321 ] [ G ]
    [ Q ]     [ 0.212  -0.523   0.311 ] [ B ]

Here is the YIQ -> RGB conversion:

    [ R ]     [ 1   0.956   0.621 ] [ Y ]
    [ G ]  =  [ 1  -0.272  -0.647 ] [ I ]
    [ B ]     [ 1  -1.105   1.702 ] [ Q ]


RGB to XYZ & XYZ to RGB

RGB values in a particular set of primaries can be transformed to and from CIE XYZ via a 3x3 matrix transform. These transforms involve tristimulus values, that is a set of three linear-light components that conform to the CIE color-matching functions. CIE XYZ is a special set of tristimulus values. In XYZ, any color is represented as a set of positive values.

To transform from XYZ to RGB (with D65 white point), the matrix transform used is [3]:

   [ R ]   [  3.240479 -1.537150 -0.498535 ]   [ X ]
   [ G ] = [ -0.969256  1.875992  0.041556 ] * [ Y ]
   [ B ]   [  0.055648 -0.204043  1.057311 ]   [ Z ].

The range for valid R, G, B values is [0,1]. Note, this matrix has negative coefficients. Some XYZ color may be transformed to RGB values that are negative or greater than one. This means that not all visible colors can be produced using the RGB system.

The inverse transformation matrix is as follows:

   [ X ]   [  0.412453  0.357580  0.180423 ]   [ R ] **
   [ Y ] = [  0.212671  0.715160  0.072169 ] * [ G ]
   [ Z ]   [  0.019334  0.119193  0.950227 ]   [ B ].


** February 20, 2000 - typo in this line of the matrix was corrected (0.189423 to 0.180423), thanks to Michal Karczmarek, University of Toronto

XYZ to CIE L*a*b* (CIELAB) & CIELAB to XYZ

CIE 1976 L*a*b* is based directly on CIE XYZ and is an attampt to linearize the perceptibility of color differences. The non-linear relations for L*, a*, and b* are intended to mimic the logarithmic response of the eye. Coloring information is referred to the color of the white point of the system, subscript n.

L* = 116 * (Y/Yn)1/3 - 16    for Y/Yn > 0.008856
L* = 903.3 * Y/Yn             otherwise

a* = 500 * ( f(X/Xn) - f(Y/Yn) )
b* = 200 * ( f(Y/Yn) - f(Z/Zn) )
    where f(t) = t
1/3      for t > 0.008856
              f(t) = 7.787 * t + 16/116    otherwise

Here Xn, Yn and Zn are the tristimulus values of the reference white.
The reverse transformation (for Y/Yn > 0.008856) is

X = Xn * ( P + a* / 500 ) 3
Y = Yn * P 3
Z = Zn * ( P - b* / 200 ) 3
    where P = (L* + 16) / 116


XYZ to CIELUV & CIELUV to XYZ

CIE 1976 L*u*u* (CIELUV) is based directly on CIE XYZ and is another attampt to linearize the perceptibility of color differences. The non-linear relations for L*, u*, and v* are given below:

L*116 * (Y/Yn)1/3 - 16
u* =  13L** ( u' - un' )
v* =  13L* * ( v' - vn' )

The quantities un' and vn'  refer to the reference white or the light source; for the 2° observer and illuminant C,  un' = 0.2009, vn' = 0.4610 [ 1 ]. Equations for u' and v' are given below:

        u' = 4X / (X + 15Y + 3Z) = 4x / ( -2x + 12y + 3 )
        v' = 9Y / (X + 15Y + 3Z) = 9y / ( -2x + 12y + 3 ).

The transformation from (u',v') to (x,y) is:

        x = 27u' / ( 18u' - 48v' + 36 )
        y = 12v' / ( 18u' - 48v' + 36 ).

The transformation from CIELUV to XYZ is performed as following:

u' = u / ( 13L*) + un
v' = v / ( 13L* ) + vn
Y = (( L* + 16 ) / 116 )3
X = - 9Yu' / (( u' - 4 ) v' - u'v' )
Z = ( 9Y - 15v'Y - v'X ) / 3v'


Recursion http://www.cs.umd.edu/class/spring2002/cmsc214/Tutorial/recursion.html

Recursion Introduction The joke goes that in order to understand recursion, you must under...

http://www.cs.xu.edu/~otero/math330/kuratowski.html

Kuratowski's Theorem A necessary and sufficient condition for planarity of a graph.       Our prese...

jsp给图片添加水印 原文: http://www.3lian.com/edu/2012/10-11/38651.html

import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Font; import java.awt.Grap...

在T-SQL中创建和使用表参数值(TVP)(转自:http://www.ixpub.net/thread-2751953-1-1.html)

一.摘要  表值参数(Table-valued parameters)简称TVP,是SQL Server 2008中引入的一种新特性,它提供了一种内置的方式,让客户端应用可以只通过单独的一条参化数SQ...
  • lslxdx
  • lslxdx
  • 2011年03月19日 22:28
  • 5352

http://acm.hdu.edu.cn/showproblem.php?pid=1055&&Color a Tree

这道题整了一下午,最后还是看别人的解题报告弄出来的,先说说我的理解吧。大体处理思路是利用贪心思想,每次取权值最大的节点,不断的将权值最大节点与它的父节点合并。 过程: 1、初始时将序列中的time...

http://www.cs.waikato.ac.nz/ml/weka/

  • 2009年12月27日 19:54
  • 164B
  • 下载

ubuntu 下php的安装配置 转自http://dsec.pku.edu.cn/~lyj/Programming/configure_php.html

安装 Apache2: sudo apt-get install apache2 安装PHP模块: sudo apt-get install php5 php5-gd php5-cli 编辑测试页:(...
  • mahave
  • mahave
  • 2012年10月19日 14:40
  • 507

http://www.zznews.cn/wenyi/lndx/ 01je0d0t

[标签:标题] 防御道器在整个寰宇天界绝对不超过一掌之数,http://www.zznews.cn/wenyi/lndx/,而且,每一个拥有防御道器的都绝对超级高手,现在他们竟然发现了一件防御道器,...

# Color Name Table http://www.flounder.com/csharp_color_table.htmC

C# Color Name Table   Home Back To Tips Page The following color...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:http://www.cs.rit.edu/~ncs/color/t_convert.html
举报原因:
原因补充:

(最多只允许输入30个字)