image processing 1 (ip1) bildverarbeitung 1seppke... · 2. gonzales & woods "digital image...

18
MIN-Fakultät Fachbereich Informatik Arbeitsbereich SAV/BV (KOGS) Image Processing 1 (IP1) Bildverarbeitung 1 Lecture 6 – Image Properties and Filters Winter Semester 2014/15 Slides: Prof. Bernd Neumann Slightly revised by: Dr. Benjamin Seppke & Prof. Siegfried Stiehl

Upload: others

Post on 28-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 2: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 3: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 4: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 5: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 6: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 7: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 8: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 9: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 10: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 11: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 12: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 13: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 14: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 15: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 16: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 17: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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

Page 18: Image Processing 1 (IP1) Bildverarbeitung 1seppke... · 2. Gonzales & Woods "Digital Image Processing" (2nd edition) old greyvalue i, new greyvalue k = T(i) Transformation function

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