my_rgb2yuv

PURPOSE ^

MY_RGB2YUV computes the true color image YUV given a true color RGB image by

SYNOPSIS ^

function YUV=my_rgb2yuv(RGB);

DESCRIPTION ^

 MY_RGB2YUV computes the true color image YUV given a true color RGB image by
 using the matrix:

 Mrgb_yuv =

    0.2990    0.5870    0.1140
   -0.1726   -0.3388    0.5114
    0.5114   -0.4282   -0.0832

 MY_YUV2RGB is its inverse

 USE: YUV=my_rgb2yuv(RGB);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 
0002 % MY_RGB2YUV computes the true color image YUV given a true color RGB image by
0003 % using the matrix:
0004 %
0005 % Mrgb_yuv =
0006 %
0007 %    0.2990    0.5870    0.1140
0008 %   -0.1726   -0.3388    0.5114
0009 %    0.5114   -0.4282   -0.0832
0010 %
0011 % MY_YUV2RGB is its inverse
0012 %
0013 % USE: YUV=my_rgb2yuv(RGB);
0014 
0015 function YUV=my_rgb2yuv(RGB);
0016 
0017 Mrgb_yuv =[0.2990    0.5870    0.1140;-0.1726   -0.3388    0.5114;0.5114   -0.4282   -0.0832];
0018 
0019 RGB=double(RGB);
0020 YUV=RGB;
0021 
0022 YUV(:,:,1)=Mrgb_yuv(1,1)*RGB(:,:,1)+Mrgb_yuv(1,2)*RGB(:,:,2)+Mrgb_yuv(1,3)*RGB(:,:,3);
0023 YUV(:,:,2)=Mrgb_yuv(2,1)*RGB(:,:,1)+Mrgb_yuv(2,2)*RGB(:,:,2)+Mrgb_yuv(2,3)*RGB(:,:,3);
0024 YUV(:,:,3)=Mrgb_yuv(3,1)*RGB(:,:,1)+Mrgb_yuv(3,2)*RGB(:,:,2)+Mrgb_yuv(3,3)*RGB(:,:,3);

Generated on Fri 07-Mar-2014 13:29:20 by m2html © 2005