目录
一、功能
二、使用
1.格式
2.具体用法
3.代码
总结
功能:通过灰度变换调整对比度
J=imadjust(I,[low high],[bottom top],gamma)
将图像I中的灰度值映射到J中的新值,即将灰度在[low high]之间的值映射到[bottom top]之间。
gamma 为校正量r ,默认为1(线性变换);
[low high] 为原图像中要变换的灰度范围,取值范围在[0,1](归一化后的灰度值);
[bottom top]指定了变换后的灰度范围,取值范围在[0,1]。
Im=imread('rice.png');
Jm=imadjust(Im,[0.15,0.9],[0,1]);
figure(1);subplot(211);imshow(Im);subplot(212);imhist(Im);
figure(2);subplot(211);imshow(Jm);subplot(212);imhist(Jm);
使用imadjust的两个步骤
(1)观察图像的直方图,判断灰度范围
(2)将灰度范围转换为0.0~1.0之间的分数,使得灰度范围可以通过向量[low,high]传递给imadjust函数。
(3)可以利用stretchlim函数以分数向量形式返回灰度范围, 直接传递给imadjust().
Im=imread('rice.png');
Jm=imadjust(Im,stretchlim(Im),[0,1]);
figure(1);subplot(211);imshow(Im);subplot(212);imhist(Im);
figure(2);subplot(211);imshow(Jm);subplot(212);imhist(Jm);
上一篇:【算法基础】高精度除法