This action might not be possible to undo. Are you sure you want to continue?
RGB to HSI Conversion:
First, we convert RGB color space image to HSI space beginning with normalizing RGB values:
R
r
R G B
=
+ +
,
G
g
R G B
=
+ +
,
B
R G B
=
+ +
b
.
Each normalized H, S and I components are then obtained by,
( ) ( )
( ) ( )( )
1
1
2 2
0.5
cos
r g r b
h
r g r b g b
−
¦ ¹
⋅ − + −
¦ ¦
¸
=
´ `
¦ ¦ (
− + − −
¸ ¸ ¹ )
(
¸ [0, ] h π ∈ for b g ≤
( ) ( )
( ) ( )( )
1
1
2 2
0.5
2 cos
r g r b
h
r g r b g b
π
−
¦ ¹
⋅ − + −
¦
¸
= −
´
¦ ¦ (
− + − −
¸ ¸ ¹ )
(
¸
¦
`
[ , 2 ] h π π ∈ for b g >
) , , min( 3 1 b g r s ⋅ − = ; [0,1] s ∈
( ) /(3 255) i R G B = + + ⋅ ; i . [0,1] ∈
For convenience, h, s and i values are converted in the ranges of [0,360], [0,100], [0, 255], respectively ,
by:
180 / H h π = × ; and 100 S s = × 255 I i = × .
HSI to RGB Conversion:
/ 1 8 0 h H π = ⋅ ; ; i 100 / S s = 255 / I =
) 1 ( s i x − ⋅ =
( )
(
¸
(
¸
−
⋅
+ ⋅ =
h
h s
i y
3 / cos
) cos(
1
π
); ( 3 y x i z + − =
when 3 / 2π < h , b x = ; y r = and . z g =
when 2 3 / 4 3 / π π < ≤ h , 3 / 2π − = h h , and x r = ; y g = and . z b =
when π π 2 3 / < ≤ h 4 , 3 / 4π − = h h , and x g = ; y b = and . z r =
The result r, g and b are normalized values, which are in the ranges of [0,1], therefore, they should be
multiplied by 255 for displaying.
Example: An image is shown here:
With RGB values as:
(100,100,100) (150, 0, 0) (0,150, 0)
(255, 0, 0) (255, 255, 255) (0, 0, 0)
(100,150, 200) (0, 0, 255) (100, 200,150)
 



\ .
RGB to HSI Conversion:
To compute HSI value of pixel (100,150,200)
1. Normalize:
0.222
R
r
R G B
= =
+ +
,
0.333
G
g
R G B
= =
+ +
,
0.444
B
R G B
= =
+ +
b
2. Here b > g, so we compute H value by equation:
( ) ( )
( ) ( )( )
1
1
2 2
0.5
2 cos 1.167
r g r b
h
r g r b g b
π π
−
¦ ¹
⋅ − + − (
¦ ¦
¸ ¸
= − =
´ `
¦ ¦ (
− + − −
¸ ¸ ¹ )
Compute S value by:
1 3 min( , , ) 0.333 s r g b = − ⋅ =
3. Represent H,S,I values in the ranges of [0,360], [0,100] and [0, 255]:
4.
180/ 210 H h π = × =
100 33.3 S s = × =
( ) / 3 150 I R G B = + + =
HSI to RGB Conversion
5. / 1 8 0 7 / 6 h H π π = ⋅ = ; / 100 0.333 s S = = ; / 255 0.588 i I = =
6. When 3 / 4 3 / 2 π π < ≤ h , we use following formulae
2 / 3 / 2 h h π π = − = ,
(1 ) 0.392 r x i s = = ⋅ − =
( )
cos( )
1 0.588
cos / 3
s h
g y i
h π
(
⋅
= = ⋅ + =
(
−
¸ ¸
3 ( b z i x y) = = − +
7. To represent R,G,B values in the ranges of [0,255], [0,255] and [0, 255]:
8.
255 100 R r = ⋅ =
255 150 G g = ⋅ =
255 200 B b = ⋅ =
333 3. h = H ⋅ π / 1 8 0 = 7 π / 6 . Normalize: r= B R G = 0.333 .167π 1 ( r − g )2 + ( r − b )( g − b ) 2 −1 Compute S value by: s = 1 − 3 ⋅ min( r . 0) (0.100] and [0. 0. so we compute H value by equation: 0. 0.222 . 255) (0.150) RGB to HSI Conversion: To compute HSI value of pixel (100.100) (255. 255) (100. Here b > g. 0) (255. Represent H.588 .150. 255.I values in the ranges of [0.444 = 0. i = I / 255 = 0.333 . s = S / 100 = 0.360]. 0. g . H = h × 180 / π = 210 S = s × 100 = 33. [0.200) 1.150. b ) = 0. 200) (0.5 ⋅ ( r − g ) + ( r − b ) h = 2π − cos = 1. 0.S.3 I = ( R + G + B ) / 3 = 150 HSI to RGB Conversion 5. b = R+G+ B R+G+ B R+G+ B 2.Example: An image is shown here: With RGB values as: (150.150. 255]: 4. g = = 0. 0) (100. 200.100. 0) (100.
392 s ⋅ cos(h) g = y = i ⋅ 1 + = 0. r = x = i ⋅ (1 − s ) = 0.6.588 cos (π / 3 − h ) b = z = 3i − ( x + y) 7. R = 255 ⋅ r = 100 G = 255 ⋅ g = 150 B = 255 ⋅ b = 200 . [0.255] and [0.G. we use following formulae h = h − 2π / 3 = π / 2 . When 2π / 3 ≤ h < 4π / 3 . 255]: 8. To represent R.B values in the ranges of [0.255].
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.