% yiq color components of a 4x4 RGB subimage and 
% yiq to RGB 
clear
%
xr=double([245  246  246  248;
  246  247  246  247;
  246  246  245  248; 
  248  247  246  248])/255; % normalized red component
xg=double([191  196  193  190;
  192  197  192  189;
  192  197  192  189; 
  192  198  191  188])/255; % normalized green component
xb=double([222  225  223  223;
  223  226  223  222;
  223  225  222  222; 
  223  224  221  224 ])/255; % normalized blue component 
%
x=cat(3,xr,xg,xb); % rgb image
yiq=rgb2ntsc(x); % rgb to yiq
% yiq components of a 4x4 subimage 
yiq_y= (yiq(:,:,1)) % y component
yiq_i= (yiq(:,:,2)) % i component
yiq_q= (yiq(:,:,3)) % q component
rgb=ntsc2rgb(yiq); % yiq to rgb
rgb=round(255*rgb)
