% Standard Image  (Mandrill)
clear;
I1=imread('Mandrill.bmp');
figure(1)
imagesc(I1);

I1r=im2double(I1(:,:,1));
I1g=im2double(I1(:,:,2));
I1b=im2double(I1(:,:,3));
I1Y=0.297*I1r+ 0.587*I1g+0.114*I1b;
I1Cb=-0.169*I1r-0.331*I1g+0.5*I1b;
I1Cr=0.5*I1r-0.419*I1g-0.081*I1b;
imwrite(I1Y,'Mandrill_Y.bmp');
imwrite(I1Cb,'Mandrill_Cb.bmp');
imwrite(I1Cr,'Mandrill_Cr.bmp');

figure(2)
imagesc(I1Y);colormap(gray)
figure(3)
imagesc(I1Cb);colormap(gray)
figure(4)
imagesc(I1Cr);colormap(gray)

plot3(I1Cb, I1Cr,I1Y,'.','LineWidth',1)
axis([-0.5 0.5 -0.5 0.5 0 1]);axis square, grid on
xlabel('Cb'); ylabel('Cr');zlabel('Y')

