%HSI颜色不同于RGB,均衡化只需针对对亮度即可
Y1=rgb2hsi(X11);
H1=Y1(:,:,1);
S1=Y1(:,:,2);
X1=Y1(:,:,3);
g1=histeq(X1);
g2=histeq(S1);
g3=histeq(X1);
Y1=cat(3,H1,S1,g3);
f1=hsi2rgb(Y1);
figure
imshow(f1),title('HSI图像均衡化');
下面是两个颜色空间变换的函数
function rgb=hsi2rgb(hsi)
%HSI2RGB Converts an HSI image to RGB.
% HSI2RGB Converts an HSI image to RGB, where HSI is assumed to be of
% class double with:
% hsi(:,:,1)= hue image normalized values to the range [0,1] by
% dividing all angle values by 2*pi.
% hsi(:,:,2)=saturation image, in the range [0,1].
% hsi(:,:,3)=intensity image, in the range [0,1].
% The components of the output image are:
% rgb(:,:,1)=red;
% rgb(:,:,2)=green.
% rgb(:,:,3)=b