This class let the user to convert the image from one color model to another color model. There are different color models that are RGB, HSV and YUV. In RGB each pixel is associated with three values which are red, green and blue and the combination of them is the color of the pixel. In this model all these lights are added together to reproduce colors. In HSV color model colors are described as points in a cylinder. The angle around the central axis corresponds to "hue", and distance from the axis corresponds to "saturation", and distance along the axis corresponds to "brightness" or "value". The cylinder is shown below.
The other color space is YUV where colors are typically created from a
combination of different portions of original RGB (red, green and blue)
source. The weighted values of R, G, and B are added together to produce
Y, U and V signals. The last color model which is not actually color is
gray model in which each pixel is associated with one value and the
image is a black and white image. The available conversion formulas used
to convert from each of these color spaces to another. For example for
conversion between RGB and YUV we used:
RGB to YUV Conversion
Y
= 0.299*red + 0.587*green + 0.114*blue;
U = -0.147*red - 0.289*green
+ 0.436*blue;
V = 0.615*red - 0.515*green - 0.100*blue;
YUV to
RGB Conversion
red = Y + 1.140*V;
green = Y - 0.395*U -
0.581*V;
blue = Y + 2.032*U;
In order to convert from one color
space to another the user go to the tools menu and select the
"Colorspace", and the image in the panel is converted to the selected
color model. When the user wants to convert from RGB to Gray, the image
should be of type float so he/she first needs to use the change type
option to convert it to float type.