digital image processing - bu shoubra... · 2016. 10. 3. · spatial & frequency domains there...

45
Digital Image Processing Image Enhancement (Histogram Processing)

Upload: others

Post on 27-Aug-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

Digital Image Processing

Image Enhancement

(Histogram Processing)

Page 2: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

2

of

45Contents

Over the next few lectures we will look at

image enhancement techniques working in

the spatial domain:

– What is image enhancement?

– Different kinds of image enhancement

– Histogram processing

– Point processing

– Neighbourhood operations

Page 3: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

3

of

45A Note About Grey Levels

So far when we have spoken about image

grey level values we have said they are in

the range [0, 255]

– Where 0 is black and 255 is white

There is no reason why we have to use this

range

– The range [0,255] stems from display technologies

For many of the image processing

operations in this lecture grey levels are

assumed to be given in the range [0.0, 1.0]

Page 4: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

4

of

45What Is Image Enhancement?

Image enhancement is the process of

making images more useful.

The reasons for doing this include:

– Highlighting interesting detail in images,

– Removing noise from images,

– Making images more visually appealing.

Page 5: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

5

of

45Image Enhancement Examples

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 6: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

6

of

45Image Enhancement Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 7: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

7

of

45Image Enhancement Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 8: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

8

of

45Image Enhancement Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 9: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

9

of

45Spatial & Frequency Domains

There are two broad categories of image

enhancement techniques

– Spatial domain techniques

• Direct manipulation of image pixels

– Frequency domain techniques

• Manipulation of Fourier transform or wavelet

transform of an image

For the moment we will concentrate on

techniques that operate in the spatial

domain.

Page 10: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

10

of

45Image Histograms

The histogram of an image shows us the

distribution of grey levels in the image

Massively useful in image processing,

especially in segmentation.

Grey Levels

Fre

quencie

s

Page 11: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

11

of

45Image Histograms

Histograms plots how many times (frequency)

each intensity value in image occurs

Page 12: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

12

of

45Image Histograms

• Many cameras display real time histogram of a

scene.

• Also easier to detect types of processing

previously applied to image

Page 13: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

13

of

45Image Histograms

• Histograms: only statistical information

• No indication of pixels locations

Page 14: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

14

of

45Image Histograms

• Different images can have same histogram

• 3 images below have same histogram

• Half of pixels are gray, half are white - Same histogram = same statisics

- Distribution of intensities could be different

NO• Can we reconstruct image from histogram?

Page 15: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

15

of

45Image Histograms

The histogram of a digital image with gray

levels in the range [0, L-1] is a discrete function

h (rk) = nk

rk: the kth gray level

nk: the number of pixels in the image having

gray level rk

Page 16: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

16

of

45Normalized histogram

Dividing each of its values by the total number

of pixels in the image (n).

p(rk) = nk/ n

For k = 0,1,……, L-1.

p(rk): Gives an estimate of the probability of

occurrence of gray level rk.

The sum of all components of a normalized

histogram is equal to 1.

Page 17: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

17

of

45Image Contrast

The contrast of a grayscale image

indicates how easily objects in the image

can be distinguished

• High contrast image: many distinct

intensity values.

• Low contrast: image uses few

intensity values.

Page 18: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

18

of

45Histograms and Contrast

Good Contrast?Widely spread intensity values + large difference

between min and max intensity values

Low contrast Normal contrast High contrast

Page 19: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

19

of

45Histogram Examples

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 20: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

20

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 21: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

21

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 22: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

22

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 23: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

23

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 24: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

24

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 25: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

25

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 26: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

26

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 27: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

27

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 28: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

28

of

45Histogram Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 29: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

29

of

45Histogram Examples (cont…)

A selection of images and

their histograms

Notice the relationships

between the images and

their histograms

Note that the high contrast

image has the most

evenly spaced histogram

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 30: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

30

of

45Contrast Stretching

We can fix images that have poor contrast

by applying a pretty simple contrast

specification

The interesting part is how do we decide on

this transformation function?

Page 31: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

31

of

45Histogram Equalisation

Spreading out the frequencies in an image (or equalising the image) is a simple way to improve dark or washed out images

Can be expressed as a transformation of histogram

Where:

– rk: input intensity

– sk: processed intensity

– k: the intensity range (e.g 0.0 – 1.0)

)( kk rTs

Page 32: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

32

of

45Histogram Equalisation

Let the variable r represent the gray levels of the image to be enhanced, with r=0 representing black and r=1 representing white.

For any r, the following transformations produce a level s for every pixel value r in the original image.

s = T(r) 0 <=r <=1

The transformation function T(r) satisfies the following condition:(a) T(r) is a single-valued and monotonically increasing in the interval 0 <=r <=1

(b) 0 <= T(r) <=1 for 0 <=r <=1

Page 33: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

33

of

45Histogram Equalisation

• The requirement in (a) that T(r) be single valued is needed to guarantee that the inverse transformation will exist, and monotonicity condition preserves the increasing order from black to white in the output image.

• i.e. A pixel which is darker in the original image should remain darker in the processed image, and a pixel which is brighter in the original should remain brighter in the processed image.

Page 34: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

34

of

45Histogram Equalisation

• Condition (b) guarantees that the output graylevels will be in the same range as the input levels.

• i.e. Ensure that the processed image that you get doesn’t lead to a pixel value which is higher than the max. intensity value that is allowed.

Page 35: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

35

of

45Histogram Equalisation

The formula for histogram equalisation is given where

– rk: input intensity

– sk: processed intensity

– k: the intensity range (e.g 0.0 – 1.0)

– nj: the frequency of intensity j

– n: the sum of all frequencies

)( kk rTs

k

j

jr rp1

)(

k

j

j

n

n

1

Page 36: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

36

of

45Equalisation Transformation Function

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 37: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

37

of

45Equalisation Examples

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

1

Page 38: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

38

of

45Equalisation Transformation Functions

The functions used to equalise the images in

the previous example

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 39: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

39

of

45Equalisation Examples

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

2

Page 40: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

40

of

45Equalisation Transformation Functions

The functions used to equalise the images in

the previous example

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 41: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

41

of

45Equalisation Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

) 3

4

Page 42: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

42

of

45Equalisation Examples (cont…)

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

) 3

4

Page 43: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

43

of

45Equalisation Transformation Functions

The functions used to equalise the images in

the previous examples

Ima

ge

s ta

ke

n fro

m G

on

za

lez &

Wood

s, D

igita

l Im

age

Pro

ce

ssin

g (

20

02

)

Page 44: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

44

of

45Quiz

1. Histogram equalization proof.

2. Exposure?a. Underexposed

b. Properly Exposed

c. Overexposed

Page 45: Digital Image Processing - BU Shoubra... · 2016. 10. 3. · Spatial & Frequency Domains There are two broad categories of image enhancement techniques –Spatial domain techniques

45

of

45Summary

We have looked at:

– Different kinds of image enhancement

– Histograms

– Histogram equalisation

Next time we will start to look at point

processing and some neighbourhood

operations