1. 程式人生 > >顏色空間轉換:RGB轉換為Lab(Matlab)

顏色空間轉換:RGB轉換為Lab(Matlab)

 Convert RGB image to L*a*b*, assuming input image is sRGB.
        rgb = imread('peppers.png');
        cform = makecform('srgb2lab');
        lab = applycform(rgb, cform);

        lab = lab2double(lab);

        L = lab(:,:1);

        a = lab(:,:,2);
        b = lab(:,:,3);