Upload
others
View
25
Download
4
Embed Size (px)
Citation preview
Image enhancement
Image enhancement belongs to image pre-processing methods.
Objective of image enhancement – process the image (e.g. contrast improvement, image sharpening ,…) so that it is better suited for further processing or analysis
P. Strumiłło, M. Strzelecki
Image enhancement methods are based on subjective image quality criteria.
No objective mathematical criteria are used for optimizing processing results.
subjective perception
Image enhancement
Pseudo
colouring
False
colouring
Linear filters
Nonlinear filters
Edge detection
Zooming
Contrast
enhancement
Histogram modelling
Image
averaging
Image enhancemet methods
Point processing
Spatialfiltering
Imagecolouring
M, N – image dimensions f(i,j) – gray level value at (i,j)
∑∑
∑∑
= =
= =
−=
=
M
i
N
j
M
i
N
j
JjifMN
C
jifMN
J
1 1
2
1 1
]),([1
),(1Brightness
Contrast
Image enhancement
J=29, C=38J=112, C=47
Image brightness and contrast influence image subjective quality perceptionJ=194, C=29
Image histogram
Image histogram
Image : array[1..M,1..N] of byte;
Hist : array[0..L-1] of longint;
...
Hist:=0;
for i:=1 to M do for j:=1 to N do
Inc( Hist[ Image[i, j] ] );…
0 50 100 150 200 250
0
200
400
600
800
0 50 100 150 200 250
0
200
400
600
800
0 50 100 150 200 250
0
500
1000
1500
0 50 100 150 200 250
0
200
400
600
800
1000
1200 darkdark
Source Source imageimage
brightbright
Image histogramrepresents statistical distribution of image pixel brightnesses
Image histogram
L-1
L-1
d
m
0 f
g
Linear gray scale transformation
OUTPUT IMAGE
SOURCE IMAGE
g f
g(i,j) = m f(i,j) + d
m ~ contrast
d ~ brightness POINT OPERATION
MATLAB Demo – image histogram
Histogram „stretching”
g(i,j) =
0 f(i,j)<fMIN
L-1 f(i,j)>fMAX
L-1fMAX- fMIN
(f(i,j)- fMIN), fMIN≤≤≤≤ f(i,j) ≤≤≤≤fMAX
POINT OPERATION?
L-10 f fM A X
fM I N
g
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
fMIN=110, fMAX=225
Histogram „stretching” - example
Grayscale inversion
L-1
L-10 f
g
OUTPUT IMAGE
SOURCE IMAGE
g f
g(i,j) = T( f(i,j))
Grayscale normalization!
γ correction
Nonlinear grayscale transformation
POINT OPERATION
L-1
L-1
exp(x)
ln(x)
x2
sqrt(x)
0 f
g
Source image
Nonlinear grayscale transformation - example
0 50 100 150 200 250
0
200
400
600
800
1000
0 100 200
0
500
1000
1500
T=x2
0 100 200
0
200
400
600
800
1000
1200T=sqrt(x)
Nonlinear grayscale transformation - example
0 100 200
0
500
1000
1500
0 100 200
0
500
1000
1500
2000T=ex
T=log(x)
Nonlinear grayscale transformation - example
Example: square function
normalization: minimum value - 0 -> 0
maximum value - 255 -> 2552
Normalization coefficient: norm=1/255
...
for i:=1 to M do for j:=1 to N do
g[i,j]:=round(sqr(f[i,j])*norm);
...
Nonlinear grayscale transformation - algorithm
Example: square function (using look-up-table)
lut : array[0..255]of byte;
...
for k:=0 to 255 do lut[k]:=round(k*k*norm)
for i:=1 to M do for j:=1 to N do
g[i,j]:=lut[(f[i,j])];
...
Nonlinear grayscale transformation - algorithm
Enhacement of a telescope moon image
T=b log( ax)
Consider a noisy image:
( ) ( ) ( )jijifjig ,,, η+=
contaminated by additive noise η(i,j) of zero average an variance σh
2 that is not correlated to the image.
We will show that after N averagings (acquisitions) of
the noisy image g(i,j) the variance of noise
component will be reduced to:
N
22 ηη
σσ =
Image ehancement by image averaging
Image ehancement by image averaging
∑∑==
+=+=N
kk
N
kk jin
Njifjinjif
Njig
11),(
1),()],(),([
1),(
1N
+ +...+ =
WARNING ! – grayscale range
Noise variance in the averaged image:
( ){ }22
21
22
1
22
2212
2
12
2
1
2
111
211
11
ηη=
≠=
==η
σ=σ=
η=
=
ηη+η⋅=η++η+η⋅=
=
η⋅=
η=σ
∑
∑∑
∑∑
NN
NE
N
EN
EN
ENN
E
N
kk
N
pkpk
N
kkN
N
kk
N
kk
K
=0
Image ehancement by image averaging
One can also show that the pick value of noise {n} is reduced by a factor of √Nafter N image averagings
N=1
N=8 N=16
N=2
Microscope image of a cell
Additive Gaussian noise
Addison-Wesley
Image averaging – example
Cumulative histogram
ensionsimageNM
LiMNkhistihistc
ofarrayhists
ofarrayhist
histogramcumulativehistchistogramimagehist
i
k
dim,
1,...,0,/])[(][
;]255..0[:
]255..0[:
,
0
−
−==
−−
∑=
single
longint;
0 50 100 150 200 250
0
0.5
1
1.5
0 50 100 150 200 250
0
200
400
600
800
1000
Histogram Cumulative histogram
Cumulative histogram
Histogram equalization
By histogram equalization one gets:
• contrast enhancement
• image normalization
Histogram equalization aims at obtaining uniform statistical distribution of image gray levels (uniform probability density function)
L-10 f
p (f)f
L-1
1/(L-1)
0 g
p (g)g
pf(f)=hist[f]/MN pg(g)=1/(L-1)
Histogram equalization
][)1(][
)1()()1(
12,1,0,1
)(
1,011
1
1
1)(
)()(
00
0
0 00
fhistcLMN
ihistLipLg
,...,L-gfL
gip
LgfL
gu
Ldu
Ldhhp
duupdhhp
f
i
f
if
f
if
f gg
f
gf
−=−=−=
=−
=
−≤≤−
=−
=−
=
=
∑∑
∑
∫ ∫
∫∫
==
=
Histogram equalization
Histogram equalization
0 50 100 150 200 250
0
500
1000
1500
2000
2500
3000
3500
4000
0 50 100 150 200 250
0
0.5
1
Histogram
Cumulativehistogram
Equalizedhistogram
][)1( fhistcLg −=
g
f
Cumulative histogram - algorithm
hist : array[0..255] of longint;
histc : array[0..255] of single;
...
histc[0]:=hist[0];
for k:=1 to 255 do
histc[k]:=histc[k-1]+hist[k];
...
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
6000
Histogram equalization
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
6000
7000
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
6000
7000
Histogram equalization - example
0 50 100 150 200 250
0
1000
2000
3000
4000
5000
6000
7000
MATLAB Demo – intensity adjustment
Correction of nonuniform illumination