functionmain img=imread('lena_color.jpg'); img=mat2gray(img); %任意区间映射到[0,1]; [m n dim]=size(img); imshow(img); %%图像的RGB R=img(:,:,1); G=img(:,:,2); B=img(:,:,3); %%图像RGB2HSL H=zeros(m,n); %色相角 S=zeros(m,n); %饱和度 L=zeros(m,n); %亮度fo...
function hsl=rgb2hsl(rgb)Converts Red-Green-Blue Color value to Hue-Saturation-Luminance Color value Usage HSL = rgb2hsl(RGB)converts RGB, a M X 3 color matrix with values between 0 and 1 into HSL, a M X 3 color matrix with values between 0 and 1 See also hsl2rgb, ...