References R.C. Gonzales and R.E. Woods, Digital Image Processing , Addison-Wesley, Reading, 1992. I. Newton, Opticks , 4th Edition, Dover, New York, 1704/1952. Internet Nipun Thapa’s Notes. 2
What is C olor ? Color is a sensation produced by the human eye and nervous system. It is useful to represent a color by a set of exactly three numbers. 3
Color Model A color model is an orderly system for creating a whole range of colors from a small set of primary colors. It is an abstract mathematical model describing the way colors can be represented as tuples of numbers. 4
Most Common Used Color Model RGB Model HSV Model 5
RGB Color Model: Additive color model. For computer displays. Uses light to display color. Colors result from transmitted light. Red + Green + Blue = White. 6
7
HSV Color Model Hue, Saturation, Value(Brightness) Hexcone subset of cylindrical (polar) coordinate system. 8
Means……. Hue - The color we see (red, green, purple). Saturation - How far is the color from gray (pink is less saturated than red, sky blue is less saturated than royal blue). Brightness/Lightness (Luminance) - How bright is the color. 9
Hue Hue (H), the color type (such as red, green). It ranges from to 360 degree, with red at degree, green at 120 degree, blue at 240 degree and so on. 10
Saturation Saturation (S) of the color ranges from to 100% . Also sometimes, it called the " purity ". The lower the saturation of a color, the more " grayness " is present and the more faded the color will appear. Saturation Scale 11
Value Value (V), the Brightness ( V ) of the color ranges from to 100% . Value Scale 12
HSV & RGB Color Picker The HSV color picker is used to control the V value, while the corresponding slices through the cylinder are displayed, and a color is selected by clicking on a point in the disk. The RGB picker below simply uses sliders to control the three components, while the spectrum picker at the bottom lets you pick your color directly by clicking. 13
14
Conversion RGB to HSV Input: RGB Output: HSV Step1: [normalize the RGB values to be in the range [0, 1]] r = R/ 255 g = G/ 255 b = B/ 255 Step2: [Find the difference between max and min values] M = max(r, g, b), m = min(r, g, b). And, difference Δ = M-m. Step3: [Calculate value V] V = max(r, g, b) Step4: [Calculate saturation S] If Δ = 0, then S = 0, otherwise S = Δ / M Step5: [Calculate hue H] If M=r then H = 60*((g-b / Δ) * mod 6) If M=g then H = 60*(2 + (b-r)/Δ) If M=b then H = 60(4 + (r-g)/ Δ) Step6: [output HSV] The calculated H, S, and V are the output of the algorithm. 15
Conversion HSV to RGB Input: HSV Output: RGB When 0 ≤ H < 360, 0 ≤ S ≤ 1 and 0 ≤ V ≤ 1. C = V × S X = C × (1 - |(H / 60º) mod 2 - 1|) m = V – C ( R, G, B) = (R'+ m, G'+ m, B'+ m). 16
Application of Color Model RGB model is used in hardware devices such as computer monitors, cameras, and scanners. HSV color model is used in real life applications to describe perception of viewer. 17