Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2009-05-04
年龄: 39
帖子: 1
声望力: 0 ![]() |
![]()
%名称:彩色图像增强
Image_rgb=imread('43.bmp'); Image_hsv=rgb2hsv(Image_rgb); %格式转换:From RGB to HSI figure(1) Imshow(Image_rgb); %显示图像 Title('原始RGB图像'); H=Image_hsv(:,:,1); %hue image in the range[0,1] S=Image_hsv(:,:,2); %saturation image in the range [0,1] v=Image_hsv(:,:,3); %intensity image in the range [0,1] [p,q]=size(v) %******************************************************** %******************************************************** %初始相关参数 alpha_L=0.06931; alpha_Theta=0.05; beta=0.2; vL=1.00; vtheta=200; %连接幅度因子 np=70000; %阈值幅度因子 %初始化所有用到的矩阵 EnhImage=zeros(p,q); L=zeros(p,q); U=zeros(p,q); Y=zeros(p,q); Y0=zeros(p,q); %************************************************* %*********************************************** %突触连接权系数矩阵 W=[0.1091 0.1409 0.1091;0.1409 0 0.1409;0.1091 0.1409 0.1091]; %************************************************** %******************************************* %实现PCNN像增强 Bri=max(v( ![]() La=[-1 -1 -1;-1 8 -1;-1 -1 -1] %灰度图像中最亮的像素的灰度值 Theta=Bri-conv2(v,La,'same'); F=v; for n=1:np K=conv2(Y,W,'same'); L=exp(-alpha_L)*L+vL*K Theta=exp(-alpha_Theta)*Theta+vtheta*Y; U=F.*(1+beta*L); Y=im2double(U>Theta); EnhImage=log(Bri)-(n-1); Y0=EnhImage; if any(Y( ![]() fprintf('第%d次迭代后没有点火点了.\n',n); break; end end %图像饱和度调整 gamma=1.2; S_1=imadjust(S,[],[0 1],gamma); %******************************************************** %******************************************************** %格式转换 Image_hsv(:,:,1)=H; %hue image in the range [0,1] Image_hsv(:,:,2)=S_1; %saturation image in the range[0,1] Image_hsv(:,:,3)=Y0; %intensity image in the range [0,1] rgb=hsv2rgb(Image_hsv); figure(2) imshow(rgb); Title('图像增强'); %********************************************************* %********************************************************** |
![]() |
![]() |