Given the intensities of the three primaries ,
, and
of a color,
we can find its HSV representation using different models. Here we use the
RGB plane of the cube to find the corresponding HSV. The three vertices are
represented by
,
and
, and the three
components of the given color is represented by a point
in
the RGB 3-D space. Here we assume the intensities are normalized so that the
,
and
values are between 0 and 1, and point
is inside or on
the surface of the color cube.
The intensity can be defined as:
We first find the intersection of the color vector
with the
RGB plane (triangle) determined by equation
:
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
![]() |
![]() |
|
![]() |
![]() |
The saturation of the colors on any of the three edges of the RGB triangle
is defined as 1 (100% saturated), and the saturation of
is zero. Denote as
the intersection of the extension of line
with the edge. If the normalized color is
,
,
and if
,
. The saturation of any color point
between
and
is defined as
In summary, given the R, G, and B components of a color in the cubic color
model, we can find the H, S, and I values by:
Note that before the RGB to HSI conversion, we need to normalize the
R, G, and B components of a pixel in a color image from the range of
to
.