image enhancement using MATLAB Digital Image Processing 2014 Fall NTU 1
Outline Spatial domain – gray-level transformation – histogram processing – linear filter – non-linear filter Frequency domain – Gaussian low-pass filter (smoothing filter) – Gaussian high-pass filter (sharpening filter) – high-frequency emphasis filtering 2
Outline Spatial domain – gray-level transformation gamma transformation image negatives contrast stretching log transformation – histogram processing – linear filter – non-linear filter Frequency domain 3
gray-level transformation gray-level transformation is a pixel by pixel operation to change the contrast of an overall image 4
gamma transformation g = imadjust(f, [low_in high_in], [low_out high_out], gamma); 5
gamma transformation g = imadjust(f, [ ], [0 1]); 6
gamma transformation g = imadjust(f, [ ], [0 1]); 7
gamma transformation g = imadjust(f, [], [], 2); 8
gamma transformation g = imadjust(f, [], [], 2); 9
image negatives g = imadjust(f, [0 1], [1 0]); g = imcomplement(f); 10
contrast stretching Low_High = stretchlim(f); g = imadjust(f, Low_High, []); 11
contrast stretching Low_High = stretchlim(f); g = imadjust(f, Low_High, [1 0]); 12
contrast stretching Low_High = stretchlim(f); g = imadjust(f, Low_High, [1 0]); 13
log transformation g = log(1 + double(f)); 14
Outline Spatial domain – gray-level transformation – histogram processing histogram equalization histogram matching contrast-limited adaptive histogram equalization – linear filter – non-linear filter Frequency domain 15
histogram equalization g = histeq(f, 256); 16
histogram equalization g = histeq(f, 256); 17
histogram matching p = twomodegauss(0.15, 0.05, 0.75, 0.05, 1, 0.07, 0.002); g = histeq(f, p); 18
histogram matching p = twomodegauss(0.15, 0.05, 0.75, 0.05, 1, 0.07, 0.002); g = histeq(f, p); 19
contrast-limited adaptive histogram equalization g = adapthisteq(f); 20
contrast-limited adaptive histogram equalization g = adapthisteq(f, 'NumTiles', [25 25]); 21
contrast-limited adaptive histogram equalization g = adapthisteq(f, 'NumTiles', [25 25], 'ClipLimit', 0.05); 22
Outline Spatial domain – gray-level transformation – histogram processing – linear filter mean filter Laplacian filter – non-linear filter Frequency domain 23
mean filter mean filter is windowed filter of linear class, that smoothes image 24
Laplacian filter f2 = tofloat(f); g2 = imfilter(f2, w, 'replicate'); 25
Laplacian filter Image enhanced using the Laplacian filter 26
Outline Spatial domain – gray-level transformation – histogram processing – linear filter – non-linear filter median filter Frequency domain 27
median filter salt and pepper noise : – fn = imnoise(f, 'salt & pepper', 0.2); 28
median filter gm = medfilt2(fn); 29
median filter gms = medfilt2(fn, 'symmetric'); 30
Outline Spatial domain – gray-level transformation – histogram processing – linear filtering – non-linear filtering Frequency domain – Gaussian low-pass filter (smoothing filter) – Gaussian high-pass filter (sharpening filter) – high-frequency emphasis filtering 31
Gaussian low-pass filter F = fft2(f); H = lpfilter('gaussian', M, N, sig); G = H.* F; g = ifft2(G); 32
Outline Spatial domain – gray-level transformation – histogram processing – linear filtering – non-linear filtering Frequency domain – Gaussian low-pass filter (smoothing filter) – Gaussian high-pass filter (sharpening filter) – high-frequency emphasis filtering 33
Gaussian high-pass filter H = hpfilter('gaussian', PQ(1), PQ(2), D0); g = dftfilt(f, H); 34
Outline Spatial domain – gray-level transformation – histogram processing – linear filtering – non-linear filtering Frequency domain – Gaussian low-pass filter (smoothing filter) – Gaussian high-pass filter (sharpening filter) – high-frequency emphasis filtering 35
high-frequency emphasis filtering HBW = hpfilter('btw', PQ(1), PQ(2), D0, 2); gbw = dftfilt(f, HBW, 'fltpoint'); gbw = gscale(gbw); 36
high-frequency emphasis filtering H = *HBW; ghf = dftfilt(f, H, 'fltpoint'); ghf = gscale(ghf); 37
high-frequency emphasis filtering ghe = histeq(ghf); figure, imshow(ghe); 38