MENU

图像变换函数

March 5, 2019 • Read: 3458 • 数字图像处理阅读设置

空间滤波变换

$$ g(x,y) = \sum_{s = -a}^{a} \sum_{t = -b}^{b} w(s,t)f(x+s, y + t) $$

灰度变换

令$r$和$s$分别表示输入图像$f(x,y)$和输出图像$g(x,y)$在任意点$(x,y)$的灰度值,灰度变换可表示为:

$$ g(x,y) = T[f(x,y)] \rightarrow s = T(r) $$

例如:$s = T(r) = \frac{1}{1 + (\frac{m}{r})^{e}}$

根据灰度变换函数$T[r]$选择方法不同,会变换可分为:直方图处理方法直接灰度变换

线性函数(正比,反比,分段线性函数)

  • 图像反转
    对灰度范围为$[0,L-1]$的图像,表达式为$s = L - 1 - r$

这种处理尤其适用于增强嵌入图像暗色区域的白色或灰色细节,特别是当黑色面积占主导地位时

  • 分段线性变换函数
    对比度拉伸,低对比度(照明不足、传感器动态范围小)提高图像灰度级的动态范围,改善图像对比度

对数函数

$$ s = clog(1+r) $$

其中,$c$是一个常数,且假定$r\geq0$,对数变换常用于图像动态范围压缩

幂律(伽马)函数

$$ s = cr^{\gamma} $$

$0<\gamma<1$,图像的低值部分就会越大,使得图像整体更亮;
$\gamma>1$,图像的低值部分就会越小,是的图像整体更暗

Matlab实现亮度变换

Matlab提供了imadjust()函数用于实现亮度变换支持反转、幂次
g = imadjust(f, [low_in, high_in], [low_out, high_out], gamma)

f = imread('breast.tif');
out1 = imadjust(f, [0; 1], [1; 0]);
out2 = imadjust(f, [0.5; 0.75], [0; 1])
out3 = imadjust(f, [], [], 2)

subplot(2, 2, 1);imshow(f)
subplot(2, 2, 2);imshow(out1)
subplot(2, 2, 3);imshow(out2)
subplot(2, 2, 4);imshow(out3)
f1 = imread('Aerial Origninal.tif');
f1 = double(f1);
out1 = f1.^3;
out2 = f1.^4;
out3 = f1.^5;
subplot(2, 2, 1);imshow(f1);
title('原图')
subplot(2, 2, 2);imshow(out1);
title('out1 = f1.^3')
subplot(2, 2, 3);imshow(out2);
title('out2 = f1.^4')
subplot(2, 2, 4);imshow(out3);
title('out3 = f1.^5')
f2 = imread('Fig0305(a)(spectrum).tif');
out1 = im2uint8(mat2gray(log(1+double(f2))));
subplot(1, 2, 1);imshow(f2)
subplot(1, 2, 2);imshow(out1)
Last Modified: March 7, 2019
Archives Tip
QR Code for this page
Tipping QR Code