MATLAB图像增强程序举例

 

1.灰度变换增强程序


% GRAY TRANSFORM
clc;
I=imread('pout.tif');
imshow(I);
J=imadjust(I,[0.3 0.7],[0 1],1);  %transforms the walues in the %intensity image I to values in J by linealy mapping %values between 0.3 and 0.7 to values between 0 and 1.
figure;
imshow(J);
J=imadjust(I,[0.3 0.7],[0 1],0.5);  % if GAMMA is less than 1,the  mapping si weighted toward higher (brighter)
%output values.
figure;
imshow(J);
J=imadjust(I,[0.3 0.7],[0 1],1.5);  % if GAMMA is greater than 1,the mapping si weighted toward lower (darker)
%output values.
figure;
imshow(J)
J=imadjust(I,[0.3 0.7],[0 1],1);  % If TOP<BOTTOM,the output image is reversed,as in a photographic negative.
figure;
imshow(J);


 

2.直方图灰度变换

%直方图灰度变换
[X,map]=imread('forest.tif');
I=ind2gray(X,map);%把索引图像转换为灰度图像
imshow(I);
title('原图像');
improfile%用鼠标选择一条对角线,显示线段的灰度值
figure;subplot(121)
plot(0:0.01:1,sqrt(0:0.01:1))
axis square
title('平方根灰度变换函数')
subplot(122)
maxnum=double(max(max(I)));%取得二维数组最大值
J=sqrt(double(I)/maxnum);%把数据类型转换成double,然后进行平方根变换
%sqrt函数不支持uint8类型
J=uint8(J*maxnum);%把数据类型转换成uint8类型
imshow(J)
title('平方根变换后的图像')

3.直方图均衡化程序举例

% HISTGRAM EAQUALIZATION
clc;
% Clear command window

I=imread('tire.tif');
% reads the image in tire.tif into I

imshow(I);
% displays the intensity image I with 256 gray levels

  • 0
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值