Monday 22 July 2013

How to create an OpenCv projcet in visual studio 2010

We need to take following steps to do this:-

1)Create a windows 32 console application project.
2)We need to add following dependencies to the project properties->configuration properties->linker->input->Additonal dependencies

opencv_core220d.lib;opencv_highgui220d.lib;opencv_imgproc220d.lib;opencv_legacy220d.lib;opencv_ml220d.lib;opencv_video220d.lib;




3)We need to add following directories to the project properties->C/C++ ->general->Additional include directories

C:\OpenCV2.2\include;C:\OpenCV2.2\include\opencv;





4)We need to add "C:\OpenCV2.2\lib" directory to the project properties->configuration properties->linker->input->Additonal library directories

C:\OpenCV2.2\lib

Wednesday 10 July 2013

Face Detection algos

Algos of Face detection

PCA:
·      Principal Component Analysis is a mathematical procedure that uses an orthogonal transformation to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables called principal components.

Eigenface:
·         Eigenfaces are a set of eigenvectors.
·         Averaging each grayscale image in database pixel by pixel.
·         Database subtracts the average image from it.
·         Eigenvectors are formed to the column vector and brought together in one matrix (covariance matrix)

EP (Evolutionary Pursuit):
·         Eigenspace-based adaptive approach that searches for the best set of projection axes in order to maximize a fitness function, measuring at the same time the classification accuracy and generalization ability of the system.

AdaBoost + Haar cascade (Viola-Jones):
·         Haar(square wave output in mathematics) cascade (series of Haar Like features)
·         f(i)= sum(Ri,white)-sum(Rj,black)
Ri (white part of Haar rect.) and Rj (black part of Haar rect.) are the selected region of the selected image pixels.
if f(i)>thershold,1
if f(i)<threshold,-1
·         AdaBoost combines all weak classifiers into a strong classifier for matching the features.
·         s(A)+s(D)-s(B)-s(C)=i(x,y)
Here A, B, C, D are pixels of image.

Gabor jets (EBGM):
·         Faces are represented as graphs, with nodes positioned at fiducial points,(eyes, nose, ends of mouth) and edges labeled with 2-D distance vectors.
·      Node contains a set of 40 complex Gabor wavelet coefficients at different scales and orientations (phase, amplitude) and is called "jets".
·         Recognition is based on set of nodes connected by edges, nodes are labeled with jets, and edges are labeled with distances.

Kernel SVM:
·         Eigenface and fisher methods aim to find projection directions in 2nd order, whereas kernel provides higher order correlations.

LDA:
·         It finds the vectors in the underlying space that best discriminate among classes.

Trace Transform:
·         Generalizations of the Radon transform.
·         Tool for image processing which can be used for recognizing objects under transformations, e.g. rotation, translation and scaling.

Fisher faces:
·         This method for facial recognition is less sensitive to variation in lighting and pose of the face than the method using eigenfaces.

Active appearance model:

·         It decouples the face's shape from its texture: it does an eigenface decomposition of the face after warping it to mean shape. This allows it to perform better on different projections of the face, and when the face is tilted.

Tuesday 18 June 2013

Row smearing and column smearing in image

Row smearing:-Row smearing convert an input image  into a image which is smeared row wise .Here is the code ,input image and output image for the row smearing:-

for(i=0;i<height;i++)
        for(j=0;j<width;j++)
 {
if(data1[i*step+j]==0)
data2[i*step+j]=0;
else
{
for(k=0;data1[i*step+(j+k)]==255;k++);
if(k<h)
{
for(l=0;l<k;l++)
data2[i*step+(j+l)]=0;
}
j=j+(k-1);
}
}


                                                                   Input Image



Output Image



Column smearing:-Column smearing convert an input image into a image smeared column wise .Here is the code ,input image and output image for the column smearing:-


for(j=0;j<width;j++)
{
for(i=0;i<height;i++)
{
if(data1[i*step+j]==0)
{
data3[i*step+j]=0;
}
else
{
if(data1[i*step+j]==255)
{
k=0;
while(data1[(i+k)*step+j]==255)
{
k++;
if((i+k)>=height)
{
break;
}
}
if(k<v)
{
for(l=0;l<k;l++)
{
data3[((i+l)*step)+j]=0;
}
}
i=i+(k-1);
}
else
{
printf("%d",data1[(i*step)+j]);
}
}

}
}

                                                                   
                                                                    Input Image




Output Image





Monday 10 June 2013

SURF, FREAK, BRISK, ORB classes in opencv

SURF:-SURF class is used for or extracting Speeded Up Robust Features from an image.The class SURF implements Speeded Up Robust Features descriptor Bay06 . There is fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option), but the descriptors can be also computed for the user-specified keypoints. The function can be used for object tracking and localization,
image stitching etc.

FREAK:-The Class implementing the FREAK (Fast Retina Keypoint) keypoint descriptor, described in [AOV12]. The algorithm propose a novel keypoint descriptor inspired by the human visual system and more precisely the retina, coined Fast Retina Key- point (FREAK). A cascade of binary strings is computed by efficiently comparing image intensities over a retinal sampling pattern. FREAKs are in general faster to compute with lower memory load and also more robust than SIFT, SURF or BRISK. They are competitive alternatives to existing keypoints in particular for embedded applications.

BRISK:-Class implementing the BRISK keypoint detector and descriptor extractor, described in [LCS11].

ORB :-Class implementing the ORB (oriented BRIEF) keypoint detector and descriptor extractor, described in [RRKB11]. The algorithm uses FAST in pyramids to detect stable keypoints, selects the strongest features using FAST or Harris response, finds their orientation using first-order moments and computes the descriptors using BRIEF (where the coordinates of random point pairs (or k-tuples) are rotated according to the measured orientation).

Saturday 6 April 2013

Average low pass filter for 24-bit color Image

The average low-pass filter is a algorithm where we take average of all adjacent pixels for the each pixel.We start it from the pixel [1][1] and to the pixel[h-2][w-2] and the boundary pixels copy same as available in input image.So we get a filter which takes a pixel and take average of all 8-neighbor and put it into the pixel.Thus if a pixel having a higher value than its neighbors it  is reduced thus there is only  a pass for the low value pixels and it reduces the pixels with high value.So it is called low pass filter.Here is the input and output image used for the program .There is a slight change in input and output image which very difficult to see.

Input Image

Output Image

Friday 5 April 2013

Horizontal Flip,vertical Flip and Reflection about origin in 24-bit color Image

Horizontal Flip:-Horizontal flip is an exchange of pixels in an image which shift the image left pixels into the right of the image and right pixels in left of the image.We need to traverse the whole image column wise and put all left most pixels into the right most side .Thus we move in each row and the image we get after traversing each row is a horizontally flipped image.Here is an input and output image for the horizontal flip program:-



Input Image
Output Image
 Vertical Flip:-Vertical flip shifts the topmost pixels to the bottom most pixels thus the whole pixels from top to bottom traverse and the pixels which are at the top in the input image goes to the bottom in the output image .In this we move row wise and traverse whole image .Here is the input and output image for the blog.


Input Image
Output Image
  Reflection about origin:-In this algorithms we move pixels diagonally .Thus the pixels which are located at the top left in the input image move to the bottom right in the output image and the output image is reflection about origin .We can say that this the combination of horizontal flip and vertical flip.Here is the input image and  image for the program:-

Input Image

Output Image

Connected component labeling for 24-bit bitmap Image

Connected component labeling is an application where we search the pixel of same pixel value and if found then labeled them with same value .Thus the whole image is processed and the pixels having same value shows the same label.This is also known as blob extraction,region labeling .Connected component labeling  is used in computer vision to detect connected region in binary digital image or color image.There is two method used for connected component labeling 4-way connectivity and 8-way connectivity .In 4-way connectivity the top,bottom ,right and left neighbors are checked while in 8-way connectivity all 8-neighbors are checked and the lowest label is given to the same neighbor .Thus the whole image is traversed and we get a labelled image.
                                          


  Here is the output of a labeled pixels of an image.We can see here the pixels with same color have same      
label.

Monday 4 March 2013

RGB to YUV and YUV to RGB color space conversion

RGB  to YUV conversion is and YUV to RGB conversion is so simple.There are two different formulas for these two operation:-

RGB to YUV Conversion

Y  =ceil ( (0.257 * R) + (0.504 * G) + (0.098 * B) + 16)

V = ceil ((0.439 * R) - (0.368 * G) - (0.071 * B) + 128)

U = ceil(-(0.148 * R) - (0.291 * G) + (0.439 * B) + 128)

YUV to RGB Conversion

B =ceil (1.164(Y - 16)+ 2.018(U - 128))

G =ceil (1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128))

R =ceil (1.164(Y - 16) + 1.596(V - 128)) 

 Here is the input and output images for this program:


RGB to YUV Conversion:-

Input RGB Image


Output YUV Image






YUV to RGB Conversion:-


Input YUV Image
                                       



Output RGB Image





Sunday 3 March 2013

RGB to TSL and RGB to noramalized RGB

Here we need to discuss some color space conversion which are helpful in face detection .In this program we take 24-Bit color image as an input.

RGB to TSL :- RGB to TSL conversion in which we use following formula :-


T =
\begin{cases}
\frac{1}{2\pi} \arctan{\frac{r'}{g'}} + \frac{1}{4}, & \mbox{if}~g'>0 \\
\frac{1}{2\pi} \arctan{\frac{r'}{g'}} + \frac{3}{4}, & \mbox{if}~g'<0 \\
0,                                         & \mbox{if}~g'=0 \\
\end{cases}
S = \sqrt{\frac{9}{5}\left( r'^2 + g'^2 \right)}
L = 0.299R + 0.587G + 0.114B
where:
r' = r - \tfrac{1}{3}*255
g' = g - \tfrac{1}{3}*255
r = \tfrac{R}{R+G+B}*255
g = \tfrac{G}{R+G+B}*255

Here is the input  and output image for this program:-
Input Color Image 

Output TSL Image


RGB to noramalized RGB:-In this approach the each normalized RGB channel is formed by the dividing the respective  channel with the sum of all three channel values and further multiplying it by 255.Here is the input and output image for this program:-
Input color image

Normalized RGB image


Wednesday 27 February 2013

Noisy Bit-Planes

When we create bit planes of any image then some of them appears near to the original image & some of them are pure dark .So these bit planes are noisy .To detecting noisy bit plane we need to compare each pixel to its three adjacent pixels .If  we talk about pixel(x,y) then we need to compare it to the pixel(x-1,y),pixel(x-1,y-1)& pixel(x-1,y-1) .If pixel(x,y) is same as the at least two of them then this pixel is not noisy.A noisy noisy bit plane will have 49 to 51% pixels that are noise.

Sunday 24 February 2013

Different Color Spaces


We already know that pixels are the smallest point in an image.Our eyes are most sensible for Red ,Green & Blue colors.Every pixel is made by these three colors.These three colors produce thousand of colors which we can see with their different combinations.

There are many other color spaces used :-
1)RGB
2)sRGB
3)RGBA
4)CMY
5)CMYK
6) HSL
7)HSB/HSV
8)HSI
9)YUV
10)YCbCr
11)Y'UV
12)Y'CbCr
13)YPbPr
14)YIQ
15)CIEXYZ
16)CIELAB
17)CIELUV
18)CIEUVW
19)TSL
20)RG Chromaticity
21)CIERGB
22)Y'CH
23)YCoCg
24)AYCoCg
25)YDbDr

1)RGB:-RGB Color space is an additive model in which they are added together to produce various range of  colors.The image which we see is the combination of these three colors.This is the most simple color space which is widely used.These color images are generally expressed in RGB values which is also know as color channel.We can easily calculate it in a 24-bit image & stores in three different arrays.We can also get the input image to put these three array values in a sequence.Popular usage of typical RGB are digital cameras ,video cameras ,image scanners etc which are used as input device.Typical output devices are LCD ,LED,PLASMA T.V.,Projectors etc.


2)sRGB:-sRGB is a standard color space created by HP & Microsoft co-operatively.It is used in monitors ,printers & internet.The sRGB color space is well specified & is designed to match home & office view conditions.LCDs ,digital cameras & scanners & printers all follow the RGB  color space.
sRGB also defines a non-linear transformation between the intensity of these primaries.
ChromaticityRedGreenBlueWhite point
x0.64000.30000.15000.3127
y0.33000.60000.06000.3290
Y0.21260.71530.07211.0000
                               





3)RGBA:-RGBA stands for red ,green,blue,alpha.It is actually an extension  of RGB color space.It have additional integral alpha value.Alpha channel is normally used as an opacity channel.If a pixel have a value of 0% in its alpha channel .Then it is fully transparent.Whereas a pixel having 100% in its alpha channel is fully opaque pixel.

4)CMY:-When we use color printing there is a problem occur because paper cannot generate light ,But it only reflects light which scattered on it.Then we need to apply ink on that surface.We need Cyan color to remove Red ,Magenta to remove Blue & Yellow to remove Green.These are called subtractive colors.This image simply a negative of RGB color Space .It means if we need to convert a CMY image to RGB image when we apply a process to get a negative image .Then declare it as a CMY image.

5)CMYK:-   It is an extension to the  CMY color space The main problem with CMY color space is it only removes only RGB colors & not removing all the light that is being reflected.So to resolve this problem we add a black color to remove all reflecting light.In CMYK K is stands for key which is Black & an another reason for using k Because the first letter of black is used for blue.The main benefit of using black color is that the text printed are black & black is less expensive than others.

6)HSL:-  HSL is the most common cylindrical co-ordinate representation .It have wide use in color pickers in image editing softwares.HSL stands for hue,saturation & lightness.In each cylinder the angle around the central vertical axis corresponds to hue,the distance from the axis corresponds to saturation & the distance along the  axis corresponds the lightness.

7)HSV/HSB:-HSV is the most common cylindrical co-ordinate representation.It also have wide use in color pickers in image editing softwares.HSV stands for hue,saturation & value and also called as HSB(B for brightness).In each cylinder the angle around the central vertical axis corresponds to hue,the distance from the axis corresponds to saturation & the distance along the  axis corresponds the brightness or value.

8)HSI:-It is also common in computer vision application.HSI stands for hue saturation and intensity.

9)YUV:-YUV is a color space typically used as a part of color image pipeline.It encodes a color image or video taking human perception into account,allowing reduced bandwidth for chrominance components thereby typical enabling transmission errors or compression artifacts to be more efficiently masked by the human perception than using a direct RGB representation .

10)YCbCr:-YCbCr is family of color spaces as a part of  the color image pipeline in video & digital photography system.YCbCr is a practical approximation to color processing & perceptual uniformity.
YCbCr stands for Y ,Cb & Cr where Y is luminance component,Cb & Cr is the two chroma component.
Cb and Cr are derivations from grey on blue-yellow and red-cyan axes.

11)Y'UV:-Y'UV defines a color space in terms of Y'which is luma & two chrominance component(UV).The Y'UV color model is used in the PAL and SECAM composite color video standards .Previous black and white used only luma information.Color information where added separately vai a sub-carrier so that a black and white receiver would still be able to receive and display a color picture transmission in the receiver's native black and white format.Formulas for RGB to Y'UV and Y'UV to RGB  color conversion are following:-



\begin{bmatrix} Y' \\ U \\ V \end{bmatrix}
=
\begin{bmatrix}
  0.299   &  0.587   &  0.114 \\
 -0.14713 & -0.28886 &  0.436 \\
  0.615   & -0.51499 & -0.10001
\end{bmatrix}
\begin{bmatrix} R \\ G \\ B \end{bmatrix}

\begin{bmatrix} R \\ G \\ B \end{bmatrix}
=
\begin{bmatrix}
 1 &  0       &  1.13983 \\
 1 & -0.39465 & -0.58060 \\
 1 &  2.03211 &  0
\end{bmatrix}
\begin{bmatrix} Y' \\ U \\ V \end{bmatrix}


12)Y'CbCr:-Y'CbCr is not an absolute color space,rather it is way of encoding  RGB information.THe actual color displayed depends on the actual RGB primaries used to display the signal.It is also a color approximation to color processing  & perceptual uniformity.

13)YPbPr:-YPbPr is a color space used in video electronics,in particular in reference component video cables.YPbPr is the analog version of the YCbCr color space the two are numerically equavalent but YPbPr is designed for use in anoalog systems where YCbCr is intended for digital video.YCbCr cables are also referred to as  Yipper cables.YPbPr is commonly called as component video but this is imprecise as there are many other types of component video most of which are some form of RGB.Pb and Pr are derivations from grey on blue-yellow and red-cyan axes.Here Y stands for luminance ,Pb carries difference between blue luma and Pr carries difference between red and luma.
YPbPr is converted from the RGB components:-

Y=.2126R+.7152G+.0722B
Pb=B-Y
Pr=R-Y

14)YIQ:-YIQ is the color space used by NTSC color TV system,employed mainly in north America ,central America & Japan.It is currently in used only for low power television stations,as full power analog transmission.The YIQ system is intended to take advantage of human color response characteristic.The eye is more sensitive to the changes in orange-blue range(I) than in the purple-green range(Q)-therefore less bandwidth is required for Q than I.In the YIQ .Y represents luma information is the only component used by the black & white TV receivers.I & Q represents the chrominance information.Formulas for RGB to YUV and YUV to RGB  color conversion are following:-


R, G, B, Y \in \left[ 0, 1 \right], \quad I \in \left[-0.5957, 0.5957\right], \quad Q \in \left[-0.5226, 0.5226\right]

\begin{bmatrix} Y \\ I \\ Q \end{bmatrix}
=
\begin{bmatrix}
  0.299    &  0.587    &  0.114 \\
  0.595716 & -0.274453 & -0.321263 \\
  0.211456 & -0.522591 &  0.311135
\end{bmatrix}
\begin{bmatrix} R \\ G \\ B \end{bmatrix}

\begin{bmatrix} R \\ G \\ B \end{bmatrix}
=
\begin{bmatrix}
  1 &  0.9563 &  0.6210 \\
  1 & -0.2721 & -0.6474 \\
  1 & -1.1070 &  1.7046
\end{bmatrix}
\begin{bmatrix} Y \\ I \\ Q \end{bmatrix}


15)CIEXYZ:-CIEXYZ color space is derived from CIERGB color space .In CIEXYZ ,Y is the luminance,Z is quasi equal to the blue stimulation & X is a mix of cone response curves chosen to be non negative .  The CIE defined the standard (colorimetric) observer.The value of XYZ is determined by following formula:-




X= \int_{380}^{780} I(\lambda)\,\overline{x}(\lambda)\,d\lambda
Y= \int_{380}^{780} I(\lambda)\,\overline{y}(\lambda)\,d\lambda
Z= \int_{380}^{780} I(\lambda)\,\overline{z}(\lambda)\,d\lambda

where λ is the wavelength of the monochromatic light.

16)CIELAB:-A lab color space is a color opponent with dimention  L for lightness ,a & b for the color opponent of dimension based on non-linearly compressed  CIEXYZ color space co-ordinates.CIELAB co-ordinates based on a cube root transformation of the color data.The lightness co-relate in CIELAB is calculated using the cube root of the relative luminance.The main advantage of CIELAB is it is designed to approximate human vision.It aspires to perceptual uniformity and its component closely matches human perception of lightness .CIELAB color space is most complete color space because it describes all the color visible to the  human eye & was created to serve as a device dependent model to be used as a reference.The
three co-ordinates of CIELAB represent the lightness of the color (L*=0 yields black while L *=100 yields diffuse white ),its position between Red/Magenta & green (a* negative values indicate green while positive value indicates magenta),& its position between yellow & blue(b* ,negative value indicates blue while positive value indicates yellow).There is no simple formula for RGB and CMY conversion because these two color space are device dependent.Following are the formula for the CIEXYZ to CIELAB & CIELAB to CIEXYZ :-

Forward transformation
\begin{align}
  L^\star &= 116 f(Y/Y_n) - 16\\
  a^\star &= 500 \left[f(X/X_n) - f(Y/Y_n)\right]\\
  b^\star &= 200 \left[f(Y/Y_n) - f(Z/Z_n)\right]
\end{align}
where
f(t) = \begin{cases}
  t^{1/3} & \text{if } t > (\frac{6}{29})^3 \\
  \frac13 \left( \frac{29}{6} \right)^2 t + \frac{4}{29} & \text{otherwise}
\end{cases} 

Here Xn,Yn & Zn are the CIE XYZ tristumulus values of the reference white point .

Reverse transformation

The reverse transformation is most easily expressed using the inverse of the function f above:
\begin{align}
  Y &= Y_n f^{-1}\left(\tfrac{1}{116}\left(L^*+16\right)\right)\\
  X &=  X_n f^{-1}\left(\tfrac{1}{116}\left(L^*+16\right) + \tfrac{1}{500}a^*\right)\\
  Z &=  Z_n f^{-1}\left(\tfrac{1}{116}\left(L^*+16\right) - \tfrac{1}{200}b^*\right)\\
\end{align}
where
f^{-1}(t) = \begin{cases}
  t^3 & \text{if } t > \tfrac{6}{29} \\
3\left(\tfrac{6}{29}\right)^2\left(t - \tfrac{4}{29}\right) & \text{otherwise}
\end{cases}

17)CIELUV:-In colorimetry ,the CIE 1976(L*,u*,v*) color space commonly known by its abbreviation CIELUV .CIELUV is an Adams chromatic valence color space & is an update of CIE 1964 color space 
          Following are the formula for the CIEXYZ to CIELUV & CIELUV to CIEXYZ :-

The forward transformation


\begin{align}
L^* &= \begin{cases}
  \left(\frac{29}{3}\right)^3 Y / Y_n,&   Y / Y_n \le \left(\frac{6}{29}\right)^3 \\
  116 \left( Y / Y_n \right)^{1/3} - 16,&  Y / Y_n  >   \left(\frac{6}{29}\right)^3      
\end{cases}\\
u^* &= 13 L^*\cdot (u^\prime - u_n^\prime) \\
v^* &= 13 L^*\cdot (v^\prime - v_n^\prime)
\end{align}
the quantities u'n & v'n are the chromaticity co-ordinates of a specified white ponit & Yn is its luminance.
Equation for u' & v' are given below:-
\begin{align}
u^\prime &= \frac{4 X}{X + 15 Y + 3 Z} &= \frac{4 x}{-2 x + 12 y + 3} \\
v^\prime &= \frac{9 Y}{X + 15 Y + 3 Z} &= \frac{9 y}{-2 x + 12 y + 3}
\end{align}

The reverse transformation

The transform from (u',v') to (x,y) is:-
\begin{align}
  x &= \frac{9u^\prime}{6u^\prime - 16v^\prime + 12}\\
  y &= \frac{4v^\prime}{6u^\prime - 16v^\prime + 12}
\end{align}
the transform from CIELUV to CIEXYZ is as follows:-
\begin{align}
  u^\prime&= \frac{u^*}{13L^*} + u^\prime_n \\
  v^\prime&= \frac{v^*}{13L^*} + v^\prime_n \\
  Y &= \begin{cases}
    Y_n \cdot L^* \cdot \left(\frac{3}{29}\right)^3,& L^* \le 8 \\
    Y_n \cdot \left(\frac{L^* + 16}{116}\right)^3,& L^* > 8
  \end{cases}\\
  X &= Y \cdot \frac{9u^\prime}{4v^\prime} \\
  Z &= Y \cdot \frac{12 - 3u^\prime - 20v^\prime}{4v^\prime} \\
\end{align}
 18)CIEUVW:-The CIEUVW is based on CIE 1964 color space is based on the CIE 1960 UCS.Wyszecki invented the UVW color space in order to be able to calculate color differences without having to hold the luminance constant.He defines a lightness index W* by simplifying expression .The chromaticty component U* & V* are defined such that the white point maps to the origin .

19)TSL:-TSL (Tint,Satuartion & Light) is a color space used in face detection & based on Hue ,Saturation & Luma.The formula for the transformation RGB  to TSL is :-

T =
\begin{cases}
\frac{1}{2\pi} \arctan{\frac{r'}{g'}} + \frac{1}{4}, & \mbox{if}~g'>0 \\
\frac{1}{2\pi} \arctan{\frac{r'}{g'}} + \frac{3}{4}, & \mbox{if}~g'<0 \\
0,                                         & \mbox{if}~g'=0 \\
\end{cases}
S = \sqrt{\frac{9}{5}\left( r'^2 + g'^2 \right)}
L = 0.299R + 0.587G + 0.114B


where
r' = r - \tfrac{1}{3}
g' = g - \tfrac{1}{3}
r = \tfrac{R}{R+G+B}
g = \tfrac{G}{R+G+B}
The reverse transformation from TSL to RGB is:-
R = k \cdot r
G = k \cdot g
B = k \cdot (1-r-g)
where

r =
\begin{cases}
\frac{\sqrt{5}}{3} S, & \mbox{if}~T=0 \\
x \cdot g + \frac{1}{3}, & \mbox{if}~T \ne 0 \\
\end{cases}
g =
\begin{cases}
- \sqrt{\frac{5}{9(x^2+1)}} \cdot S, & \mbox{if}~T>\frac{1}{2} \\
\sqrt{\frac{5}{9(x^2+1)}} \cdot S, & \mbox{if}~T<\frac{1}{2} \\
0,                                         & \mbox{if}~T=0 \\
\end{cases}
k = \frac{1}{0.185r + 0.473g + 0.114}
x = - \cot ({2\pi \cdot T})

20)RG Chromaticity:-The RG chromaticity space ,two dimension of the normalized RGB color space ,a two dimention color space in which there is no intensity information.Unlike RGB  color space ,In the rg chromaticty a color is represented by the proportin of Red.,Green & blue in the color ,rather than the intensity of each Since these proportion must always  add up  to atotal of 1,we are able to read just red & green proportions of the color & can calculate blue value if necessary.Rg chromaticty contains less information than RGB & HSV color space ,It has no of useful properties for computer vision application .
Given a color(R,G,B) where R,G,B= intensity of red,green & blue ,this can be converted to color (r,g) where r,g imply the proportion red & green in the original color:
 r = \frac{R}{R+G+B}
 g = \frac{G}{R+G+B} 
the inverse transformation is not possible ,as the intensity information is lost during the coversion to rg chromaticity.

21)CIERGB:-The CIE RGB  color space is one of many RGB color spaces ,distinguished by a particular set of mono chromatic primary colors.The RGB tristimulus values for a color with a spectral power distribution I(λ) would then be given by :






R= \int_0^\infty I(\lambda)\,\overline{r}(\lambda)\,d\lambda
G= \int_0^\infty I(\lambda)\,\overline{g}(\lambda)\,d\lambda
B= \int_0^\infty I(\lambda)\,\overline{b}(\lambda)\,d\lambda0

22)Y'CH:-Y'CH is stands for luma,chroma and hue .The formula for Y'CH to RGB color space is following:-

\begin{align}
  H^\prime &= \frac{H}{60^\circ} \\
  X        &= C (1 - |H^\prime \;\bmod 2 - 1|)
\end{align}

  (R_1, G_1, B_1) =
    \begin{cases}
      (0, 0, 0) &\mbox{if } H \mbox{ is undefined} \\
      (C, X, 0) &\mbox{if } 0 \leq H^\prime < 1 \\
      (X, C, 0) &\mbox{if } 1 \leq H^\prime < 2 \\
      (0, C, X) &\mbox{if } 2 \leq H^\prime < 3 \\
      (0, X, C) &\mbox{if } 3 \leq H^\prime < 4 \\
      (X, 0, C) &\mbox{if } 4 \leq H^\prime < 5 \\
      (C, 0, X) &\mbox{if } 5 \leq H^\prime < 6
    \end{cases}
Then we can find RG, and B by adding the same amount to each component, to match luma:
\begin{align}
  &m = Y^\prime_{601} - (.30R_1 + .59G_1 + .11B_1) \\
  &(R, G, B) = (R_1 + m, G_1 + m, B_1 + m)
\end{align}

23)YCoCg:-YCoCg stands for luminance,two color components orange and green.This color space was invented to use similar encoding techniques as YCbCr,but with frames in RGB color space.Is is possible to losslessly transform from RGB to YCoCg when using 2 more bits for YCoCg representation than for RGB .E.g.  it is possible to losslessly transform a pixel from a 30-bit RGB  frame into a pixel in a 32-bit  YCoCg .This assumes that each R,G and B component will have 10 bits of information which Y' will have 10 bits and Co and Cg will each have 11 bits. Following are the formula for the RGB  to YCoCg & YCoCg to RGB :-

Forward transformation

\begin{bmatrix} Y \\ Cg \\ Co \end{bmatrix}
=
\begin{bmatrix} 1/4  &  1/2  &  1/4\\ 
                -1/4 &  1/2  & -1/4\\ 
                1/2  &  0    & -1/2\end{bmatrix}
\cdot
\begin{bmatrix} R \\ G \\ B \end{bmatrix}


The reverse transformation


\begin{bmatrix} R \\ G \\ B \end{bmatrix}
=
\begin{bmatrix} 1  &  -1  & 1\\ 
                1  &  1  &  0\\ 
                1  & -1  & -1\end{bmatrix}
\cdot
\begin{bmatrix} Y \\ Cg \\ Co \end{bmatrix}

24)AYCoCg:-It is a color space wherein each color is represented as a quad (A,Y,Co,Cg) where A represents the alpha(transparency) component,Y represents the luminance component and Co and Cg represent the two chrominance(color) component orange and green respectively.Conversion between  the ARGB and AYCoCg color spaces can be performed by using forward and reverse transformation.The alpha channel is never converted in either direction.

Forward transformation
A = A


|Y|    | 1/4   1/2    1/4|   |R|
|Co| = |  1     0     -1 | * |G|
|Cg|   |-1/2    1    -1/2|   |B|


The reverse transformation

A = A

|R|   |1   1/2   -1/2|   |Y |
|G| = |1    0     1/2| * |Co|
|B|   |1  -1/2   -1/2|   |Cg|
25)YDbDr:-YDbDr is the color space used in the SÉCAM analog terrestrial colour television broadcasting standard, which is used in France and some countries of the former Eastern Bloc. It is very close to YUV (PAL) and its related color spaces such as YIQ (NTSC), YPbPr and YCbCr.
YDbDr is composed of three components - ,  and .  is the luminance,  and  are the chrominance components, representing the red and blue color differences.Formulas for RGB to YDbDr  and YDbDr  to RGB  color conversion are following:-
Forward transformation
\begin{align}
Y   &= +0.299 R +0.587 G +0.114 B\\
D_B &= -0.450 R -0.883 G +1.333 B\\
D_R &= -1.333 R +1.116 G +0.217B\\
\begin{bmatrix} Y \\ D_B \\ D_R \end{bmatrix} &=
\begin{bmatrix} 0.299 & 0.587 & 0.114 \\ 
-0.450 & -0.883 & 1.333 \\ 
-1.333 & 1.116 & 0.217 \end{bmatrix}
\begin{bmatrix} R \\ G \\ B \end{bmatrix}\end{align}

The reverse transformation

\begin{align}
R &= Y +0.000092303716148 D_B -0.525912630661865 D_R\\
G &= Y -0.129132898890509 D_B +0.267899328207599 D_R\\
B &= Y +0.664679059978955 D_B -0.000079202543533 D_R\\
\begin{bmatrix} R \\ G \\ B \end{bmatrix} &=
\begin{bmatrix} 1 & 0.000092303716148 & -0.525912630661865 \\
1 & -0.129132898890509 & 0.267899328207599 \\
1 & 0.664679059978955 & -0.000079202543533 \end{bmatrix}
\begin{bmatrix} Y \\ D_B \\ D_R \end{bmatrix}\end{align}