function ycbcr=YCbCr(image)




red=double(image(:,:,1));
green=double(image(:,:,2));
blue=double(image(:,:,3));




Y=0.2126*red + 0.7152*green + 0.0722*blue;

RmaxY= 0.2126*1;
BmaxY= 0.0722*1;

Crmax=1-RmaxY;
Cbmax=1-BmaxY;


Cb=blue-Y; 
Cr=red-Y; 

ycbcr=zeros(size(image));

ycbcr(:,:,1)=Y;
ycbcr(:,:,2)=(0.5/ Cbmax)*Cb+128;
ycbcr(:,:,3)=(0.5/ Crmax)*Cr+128;