function imlum=rgbim2luminance(im)
    im=double(im);
    r=im(:,:,1);g=im(:,:,2);b=im(:,:,3);
    Y=0.299*r+0.587*g+0.114*b;
    U=b-Y;
    V=r-Y;
    imlum(:,:,1)=Y;
    imlum(:,:,2)=U;
    imlum(:,:,3)=V;