In this post, i will show you how to find y, cb, cr from ycbcr image. below is the simple code for it.


clear;
close all;
clc;

 img = imread('C:\Users\US\Desktop\CompVision\images\lenna.jpg');
 %imresize(img,[200 200]);
 img = rgb2ycbcr(img);
 figure('units','normalized','outerposition',[0 0 1 1]),
 subplot(221), imshow(img), title('Lenna Image');

 [r, c, ch] = size(img);
 img_y =img(:,:,1);
 subplot(222), imshow(img_y), title('Channel y');
 img_cb =img(:,:,2);
 subplot(223), imshow(img_cb), title('Channel cb');

 img_cr =img(:,:,3);
 subplot(224), imshow(img_cr), title('Channel cr');