image processing 1 (ip1) bildverarbeitung 1seppke... · 2. gonzales & woods "digital image...
TRANSCRIPT
MIN-FakultätFachbereich InformatikArbeitsbereich SAV/BV (KOGS)
ImageProcessing1(IP1)Bildverarbeitung1
Lecture 6 – ImagePropertiesand Filters
WinterSemester2014/15
Slides:Prof.BerndNeumannSlightly revised by:Dr.BenjaminSeppke&Prof.SiegfriedStiehl
GlobalImageProperties
Globalimage properties refer to animage as awhole ratherthan components.Computation of globalimage propertiesis often required for image enhancement,preceding imageanalysis.We treat
– empiricalmean and variance– histograms– projections– cross-sections– frequency spectrum
IP1– Lecture 6:ImagePropertiesand Filters
02.11.15 University of Hamburg, Dept. Informatics 2
Empirical Mean and Variance
Empirical mean =averageof allpixels of animage
Empirical variance =averageof squared deviation of allpixels frommean
IP1– Lecture 6:ImagePropertiesand Filters
g = 1MN
gmnn=0
N−1∑m=0
M−1∑ with image size: M ×N
Simplified notation: g = 1K
gkk=0K−1
∑
Incremental computation: g0 = 0 gk =gk−1(k −1)+ gk
k with k = 2…K
σ 2 =1K
(gkk=1
K∑ − g)2 = 1
Kgk2
k=1
K∑ − g 2
σ 02 = 0 σ k
2 =σ k-1
2 + gk−12( )(k −1)+ gk
2
k−gk−1(k −1)+ gk
k"
#$
%
&'
22
with k = 2…K
Incremental computation:
02.11.15 University of Hamburg, Dept. Informatics 3
GreyvalueHistogramsAgreyvalue histogram hf (z) of animage f provides the frequency ofgreyvalues z inthe image.
Thehistogramof animage with N quantization levels is represented by a1DarraymitN elements.
Agreyvalue histogramdescribes discrete values,agreyvalue distributiondescribes continuous values.
IP1– Lecture 6:ImagePropertiesand Filters
hf(z)
qN-1
z
02.11.15 University of Hamburg, Dept. Informatics 4
Example of Greyvalue Histogram
IP1– Lecture 6:ImagePropertiesand Filters
Image
Ahistogramcan be "sharpened"bydiscountingpixels at edges(more about edges later):
2550
255(darkest)0
Histogram
02.11.15 University of Hamburg, Dept. Informatics 5
HistogramModification (1)
Greyvaluesmaybe remapped into new greyvalues to• facilitate image analysis• improve subjective imagequality
Example:Histogramequalization
IP1– Lecture 6:ImagePropertiesand Filters
1.CuthistogramintoNstripesofequalarea(N=newnumberofgreyvalues)2.Assignnewgreyvaluestoconsecutivestripes
Examples show improved resolution ofimage parts with most frequent greyvalues(road surface)
02.11.15 University of Hamburg, Dept. Informatics 6
HistogramModification (2)Two algorithmic solutions:
N pixels perimage,greyvalues i=0...255,histogram h(i)
1."Cuttingup ahistogram into stripesof equal area"
stripe area S = N/256
Cutting up anarbitrary histogram into equal stripes may requireassignment of differentnew greyvalues to pixels of the sameoldgreyvalue.
2.Gonzales&Woods"DigitalImageProcessing"(2ndedition)
old greyvalue i,new greyvalue k = T(i)
Transformationfunction
Histogram is only coarsely equalized.
7
IP1– Lecture 6:ImagePropertiesand Filters
T (i) = round 255 h( j)Nj=0
i∑
"
#$
%
&'
02.11.15 University of Hamburg, Dept. Informatics
Projections
Aprojectionof greyvalues inanimage is the sumof allgreyvalues orthogonalto abase line:
Often used:• "row profile"=row vector of all(normalized)column sums• "column profile"=column vector of all(normalized)rowsums
IP1– Lecture 6:ImagePropertiesand Filters
m
n
pm = gmnn∑
02.11.15 University of Hamburg, Dept. Informatics 8
Cross-sections
Across-section of agreyvalue image is avector of allpixels alongastraight line through the image.• fasttest for localizingobjects
• commonly taken alongarow or column or diagonal
9
IP1– Lecture 6:ImagePropertiesand Filters
02.11.15 University of Hamburg, Dept. Informatics
NoiseDeviations fromanidealimage can often be modelled as additivenoise:
Typical properties:
• mean 0,variance σ2 > 0• spatially uncorrelated:E[ rij rmn] = 0 for ij ≠ mn• temporally uncorrelated:E[ rij,t1 rij,t2] = 0 for t1 ≠ t2
• Gaussian probability density:
Noisearises from analogsignal generation (e.g.amplification)andtransmission.
There are several other noisemodels other than additivenoise.
IP1– Lecture 6:ImagePropertiesand Filters
= +
p(r) = 1σ 2π
e−r2
2σ 2
E[x] is"expectedvalue"of x
02.11.15 University of Hamburg, Dept. Informatics 10
NoiseRemoval by Averaging
There are basically 2ways to "average out"noise:• temporalaveraging if several samples gij,t of the samepixel
butat differenttimes t = 1 ... T are available• spatial averaging if gmn ≈ gij for allpixels gmn inaregion around gij
How effective is averagingof K greyvalues?
IP1– Lecture 6:ImagePropertiesand Filters
Principle: samplemean approaches densitymeanrK =1K
rkk=1
K
∑ ⇒ 0
rK =1K
rkk=1
K
∑ is random variablewith mean and variance depending onK
mean
E (rK −E rK[ ])2"# $%= E rK2"# $%= E
1K 2 ( rk )
2
k=1
K
∑"
#'
$
%(=
1K 2 E rk
2"# $%=σ 2
Kk=1
K
∑ variance
Example:Inorder cut the standard deviation inhalf,4values have to averaged
E rK[ ] = 1K
E rk[ ]k=1
K
∑ = 0
02.11.15 University of Hamburg, Dept. Informatics 11
Example of Averaging
IP1– Lecture 6:ImagePropertiesand Filters
Intensity averagingwith 5x5mask
11 1111 1111 1111 1111 11
11111
125
02.11.15 University of Hamburg, Dept. Informatics 12
SimpleSmoothing Operations
1. Averaging
2. Removal of outliers
3. Weighted average
IP1– Lecture 6:ImagePropertiesand Filters
gij =1D
gmngmn∈ D∑ with D the set of all greyvalues around gij
Example of3-by-3region D
gij =1wk∑
wkgkgk∈ D∑ with wk = weights in D
Notethat these operations are heuristics and notwell founded!
Example of weightsin3-by-3region
gij =1D
gmn gmn∈ D∑ if gij −
1D
gmngmn∈ D∑ ≥ S with threshold S
gij else
%
&''
(''
ij
1 2 1
2 2
1 2 1
3
02.11.15 University of Hamburg, Dept. Informatics 13
Bimodal AveragingTo avoid averagingacross edges,assumebimodal greyvalue distributionandselect average value of modalitywith largest population.Determine:
IP1– Lecture 6:ImagePropertiesand Filters
A
B
g D =1D gmn
gmn∈ D∑
A = gk with gk ≥ gD{ } B= gk with gk < gD{ }
!gD =
1A gkgk∈ A∑ if A ≥ B
1B gkgk∈ B∑ else
%
&
''
(
''
Example:gD =16.7 A, B g´D= 1311 14 15
13 12 25
15 19 26
02.11.15 University of Hamburg, Dept. Informatics 14
Averaging with Rotating MaskReplace center pixel by averageover pixels from the most homogeneous subsettaken from the neighbourhood of center pixel.
Measure for (lackof)homogeneity is dispersion σ2 (=empirical variance)of thegreyvalues of aregion D:
Possible rotated masks in5x5neighbourhood of center pixel:
Algorithm:1.Consider each pixel gij2.Calculate dispersion inmask for allrotated positions of mask3.Choose mask with minimum dispersion4.Assign average greyvalue of chosen mask to gij
IP1– Lecture 6:ImagePropertiesand Filters
σ ij2 =
1D
(gmngmn∈ D∑ − gij )
2gij =1D
gmngmn∈ D∑
02.11.15 University of Hamburg, Dept. Informatics 15
MedianFilterMedianof adistributionP(x):xm suchthatP(x < xm) = 1/2
MedianFilter:1.Sort pixels inD according to greyvalue2.Choose greyvalue inmiddle position
Example:
IP1– Lecture 6:ImagePropertiesand Filters
gij = max a( ) with gk ∈ D and {gk < a} <D2
11 14 15
13 12 25
15 19 26
111213141515192526
greyvalue of center pixel ofregion is set to 15
MedianFilter reduces influence of outliers ineither direction!02.11.15 University of Hamburg, Dept. Informatics 16
Local Neighbourhood OperationsManyuseful image transformationsmaybe defined as aninstance of alocalneighbourhood operation:
IP1– Lecture 6:ImagePropertiesand Filters
Generate anew imagewith pixels by applying operator f to allpixels gij of animage
gmn = f (g1,g2,...,gK ) g1,g2,...,gK ∈ Dij
gmn
ij
Dijmn
Pixelindices i, j may be incremented by steps largerthan 1 to obtain reducednew image.
example ofneighbour-
hood
02.11.15 University of Hamburg, Dept. Informatics 17
Example of Sharpening
IP1– Lecture 6:ImagePropertiesand Filters
intensity sharpeningwith 3x3mask
"unsharpmasking"=subtraction of blurred image
gij = gij −1
|D|gmn
gmn∈ D∑
-1 -1 -1
-1 -1
-1 -1 -1
9
02.11.15 University of Hamburg, Dept. Informatics 18