图像增强(1) 灰度变换强度(matlab)

灰度变强增强

imadjust()

J = imadjust(I,[low_in,high_in],[low_out,high_out],gamma)
RGB2 = imadjust(RGB1,[low_in,high_in],[low_out,high_out],gamma)
I:输入图像;
[low_in,high_in]:原图像中要变换的灰度范围;
[low_out,high_out]:变后的灰度范围;
gamma:映射方式,默认为1,即为线性映射,不等于1即为非线性变换。

调整灰度图像范围:

>> I=imread('E:\persional\matlab\images\ba.tif');
>> J = imadjust(I,[0 1],[0.8 0.2]);
>> figure,
>> subplot(121),imshow(I);
>> subplot(122),imshow(J);

在这里插入图片描述

调整图像亮度:

>> I=imread('E:\persional\matlab\images\ba.tif');
>> J = imadjust(I,[0.2 0.8],[0 1],0.3);
>> K = imadjust(I,[0.2 0.8],[0 1],3);
>> figure,
>> subplot(131),imshow(I);
>> subplot(132),imshow(J);
>> subplot(133),imshow(K);

在这里插入图片描述
对彩色图片进行增强:

>> I=imread('E:\persional\matlab\images\ad1.tif');
>> J = imadjust(I,[0.2 0.3 0;0.7 0.8 1],[]);
>> figure,
>> subplot(121),imshow(I);
>> subplot(122),imshow(J);

在这里插入图片描述

brighten()

brighten(h,beta)
h:对句柄为h的图像进行操作
beta:大于0小于1图像变亮,小于0大于-1图像变暗

>> I=imread('E:\persional\matlab\images\ba.tif');
>> figure,imshow(I);
>> brighten(0.6);
>> figure,imshow(I);
>> brighten(-0.6);
>> figure,imshow(I);

在这里插入图片描述

stretchlim()

获取最佳区间

>> I=imread('E:\persional\matlab\images\ba.tif');
>> M = stretchlim(I);%获取最佳区间
>> J = imadjust(I,M,[]);
>> figure,
>> subplot(121),imshow(I);
>> subplot(122),imshow(J);

在这里插入图片描述

imcomplement()

对灰度图像进行反转

>> I=imread('E:\persional\matlab\images\ba.tif');
>> J = imcomplement(I);
>> figure,
>> subplot(121),imshow(I);
>> subplot(122),imshow(J);

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_56260304/article/details/127324859