lect 03 - first portion

42
Digital Image Processing (2 nd Edition) Rafael C. Gonzalez Richard E.Woods Dr Moe Moe Myint Technological University (Kyaukse) www.slideshare.net/MoeMoeMyint [email protected] drmoemoemyint.blogspot.com

Upload: moe-moe-myint

Post on 18-Jan-2017

18 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Lect 03 - first portion

Digital Image Processing (2nd Edition)

Rafael C. GonzalezRichard E.Woods

Dr Moe Moe Myint

Technological University (Kyaukse)

www.slideshare.net/MoeMoeMyint [email protected] drmoemoemyint.blogspot.com

Page 2: Lect 03 - first portion

2 Miscellanea Lectures: Class A

Monday 5-6 Tuesday 6-7

Lectures: Class B Monday 1-2 Wednesday 5-6

Labs: Tuesday for Class A and Wednesday for Class B

Web Site:

www.slideshare.net/MoeMoeMyint drmoemoemyint.blogspot.com

E-mail: [email protected]

Page 3: Lect 03 - first portion

3 Contents for Chapter 3

This lecture will cover: Background Some Basic Gray Level Transformations Histogram Processing Enhancement Using Arithmetic/Logic Operations Basics of Spatial Filtering Smoothing Spatial Filters Sharpening Spatial Filters Combining Spatial Enhancement Methods Summary

Page 4: Lect 03 - first portion

4 Introduction

“It makes all the difference whether one sees darkness through the light or brightness through the shadows”

David Lindsay

Page 5: Lect 03 - first portion

5 Preview The principal objective

to process an image so that the result is more suitable than the original image for a specific application

The word specific is important because algorithms development for enhancing X-ray images may not necessarily be the best approach for enhancing pictures of Mars transmitted by a space probe.

Page 6: Lect 03 - first portion

6 Image enhancement example

Page 7: Lect 03 - first portion

7 Two categories

There is no general theory of image enhancement Spatial domain

image plane itself (the ‘natural’ image) and based on direct manipulation of pixels in an image

Frequency domain based on modifying the Fourier transform of an

image (modify the image frequency components)

Page 8: Lect 03 - first portion

8

No general theory

Image Enhancement

Enhancement technique

Input image “Better” image

Specific Application

Spatial DomainManipulate pixel intensity directly

Frequency DomainModify the Fourier transform

Page 9: Lect 03 - first portion

9

x

yOrigin(0,0)

*(x,y)

x

y

Origin(0,0)

*(x,y)

Spatial coordinate system Cartesian coordinate system

g (x, y)=T [ f (x, y)]

Image Enhancement in Special Domain

The processed image Operator on f input image

Page 10: Lect 03 - first portion

10 Background

Spatial domain processing the aggregate of pixel composing an image procedures that

operate directly on these pixels By expression: g(x, y)=T[ f(x, y) ] Where f(x, y): input image

g(x, y): output (processed) image

T: operator on f(Defined over some neighborhood of (x, y))

Tf(x,y) g(x,y)

Page 11: Lect 03 - first portion

11 The operator T can be defined overa) The set of pixels (x, y) of the imageb) The set of ‘neighborhoods’ N(x, y) of each pixelc) A set of images f1,f2,f3,…

a)

6 8 2 012 200 20 10

3 4 1 06 100 10 5

(Operator: Div. by 2)

Page 12: Lect 03 - first portion

12b)

c)

6 8 2 01220020 10

226

6 812200

(Operator: sum)

6 8 2 012 200 20 10

5 5 1 02 20 3 4

11 13 3 014 220 23 14

(Operator: sum)

Page 13: Lect 03 - first portion

Cont’d13Defining the neighborhood around (x, y)

Use a square/rectangle subimage area that is centered at (x, y)

OperationMove the center of

the subimage from pixel to pixel and apply the operation T at each location (x, y) to compute the output g(x, y)

Page 14: Lect 03 - first portion

14 The easiest case of operators

When the neighborhood is 1 x 1(i.e, a single pixel) then g depends only on the value of f at (x,y)

T becomes a gray-level transformation ( an intensity or mapping) function:

s = T(r)

where;

r = gray-level at (x,y) in original image f(x,y)

s = gray-level at (x,y) in original image g(x,y)This kind of processing is referred as point processing

Point processing techniques (e.g., contrast stretching , thresholding)

Cont’d

Page 15: Lect 03 - first portion

15Point processing

a) T(r) performs contrast stretching by producing an image of higher contrast than the original by darkening the levels below m and brightening the levels above m in the original image.

b) T(r ) produces a two-level (binary) image. (thresholding function)

Con

tras

t str

etch

ing

thre

shol

ding

Page 16: Lect 03 - first portion

16 Contrast Stretching

Original Enhanced

Page 17: Lect 03 - first portion

17

Thresholding transformations are particularly useful for segmentation in which we want to isolate an object of interest from a background.

Thresholding

Original Enhanced

s = 1.0 r > thresholds = 0.0 r<= threshold

Page 18: Lect 03 - first portion

18 If neighborhood is greater than 1 x 1,

General approach: to use a function of the values of f in a predefined neighborhood of (x, y) to determine the value of g at (x, y).

The use of masks (or filters, kernels, template, or windows)

a mask is a small (e.g., 3x3 ) 2-D array

The values of mask coefficients determine the nature of the process (image sharpening)

Enhancement technique :mask processing or filtering

Neighborhood Processing

Page 19: Lect 03 - first portion

19Some Basic Gray Level TransformationsGray–level transformation functions are among the simplest of all image enhancement techniquesThe values of pixels, before and after processing are related by an expression s = T (r)For an 8-bit environment, a lookup table will have 256 entriesSome basic gray level transformations functions:

Image Negatives Log Transformations Power-Law Transformations Piecewise Transformation

oContrast StretchingoGray-level SlicingoBit-plane Slicing

Page 20: Lect 03 - first portion

20

Image Negatives

The negative of an image with gray levels in the range [0, L-1] is obtained by using the negative transformation which is given by the expression

s = L – 1 – r

where; r is value of input pixel

s is value of processed pixel

input gray level ranges from 0 to L-1 ( [0, L-1] )

Reversing the intensity level of image

Suited for enhancing white or gray detail embedded in dark regions of an image, especially when the black areas are dominant in size

Page 21: Lect 03 - first portion

21Image negatives

Original Image : Digital Mammogram showing a small lesion

Much easier : to analyze the breast tissue in the negative image

Original mammogram Negative image

Small lesion

Page 22: Lect 03 - first portion

22

Some basic gray-level transformation functions used for image enhancement

Linear: Negative, Identity

Logarithmic: Log, Inverse Log

Power-Law: nth power, nth root

Page 23: Lect 03 - first portion

23Log Transformation

General form:

s = c log (1 + r )where; c is a constant and r>=0

Maps a narrow range of low gray-level values in the input image into a wider range of output levels

Use to expand the values of dark pixels in an image while compressing the higher-level values

The opposite is true of the inverse log transformation

Compress the dynamic range of images with large variations in pixel values

Page 24: Lect 03 - first portion

24

(a)Fourier spectrum with vales in the range 0 to 1.5x106

(b) Result of applying the log transformation with c = 1

If c = 1, values of result become 0 to 6.2

Log Transformation Example

s = log (1+r)

(a) (b)

Page 25: Lect 03 - first portion

25 Basic form: s = c r γ

where; c and γ are positive constants To account for an offset (a measurable output when the input is

zero) :

s = c (r + ε )γ

Power law is similar to log when γ < 1 and similarto inverse log when γ > 1

Varying obtains family of possible transformation curves

Power-Law Transformation

Figure: Plots of the equation s = c r γ for various values of γ (c=1); γ = c = 1, identity

Page 26: Lect 03 - first portion

26

Power-Law Transformation Examples A variety of device used for image capture, printing and

display respond The power law equation is referred to as gamma The process used to correct power-law response is called

gamma correction Example:

Cathode ray tubes have

an intensity-to-voltage

response that is a power

function with exponent

varies from 1.8 to 2.5.

=2.5

=1/2.5

=2.5

(a) (b)

(c) (d)

Page 27: Lect 03 - first portion

27Cont’d

Also useful for general-purpose contrast manipulation

Different curves highlight different detail

< 1Expand dark gray levels

= 0.6

= 0.4 = 0.3Figure : Magnetic

resonance (MR) image

Page 28: Lect 03 - first portion

28Cont’d

>1Expand light gray levels

= 3

= 5 = 4

Page 29: Lect 03 - first portion

29Why power laws are popular?

A cathode ray tube (CRT), for example, converts a video

signal to light in a nonlinear way. The light intensity I is

proportional to a power (γ) of the source voltage VS

For a computer CRT, γ is about 2.2

Viewing images properly on monitors requires γ-correction

Page 30: Lect 03 - first portion

30

Advantage: the form of piecewise functions can be arbitrarily complex

a practical implementation of some implementation of some important transformations can be formulated only as piece wise functions

Disadvantage: specification requires considerably more user input

Contrast Stretching Gray-level slicing Bit-plane slicing

Piecewise-Linear Transformation Functions

Page 31: Lect 03 - first portion

31 One of the simplest piecewise linear functions To increase the dynamic range of the gray levels in the image

being processed The locations of (r1,s1) and (r2,s2) control the shape of the

transformation function If r1= s1 and r2= s2 the transformation is a linear function

and produces no changes If r1=r2, s1=0 and s2=L-1, the transformation becomes a

thresholding function that creates a binary image Intermediate values of (r1,s1) and (r2,s2) produce various

degrees of spread in the gray levels of the output image, thus affecting its contrast

Contrast Stretching

Page 32: Lect 03 - first portion

32

Generally, r1≤r2 and s1≤s2 is assumed to preserve the order of

gray levelsprevent the creation of

intensity artifacts in the processed image

Cont’d

control point

Page 33: Lect 03 - first portion

33Example of contrast stretching

Contrast stretching

8-bit image with low contrast Thresholding

Page 34: Lect 03 - first portion

34 Highlight a specific range of gray levels in an image (e.g. to

enhance certain features)

Tow basic approaches:To display a high value for all gray levels in the range of interest and a low value for all other gray levels (binary image)Brightens the desired range of gray levels but preserves the background and gray-level tonalities in the image

Gray-level slicing

Page 35: Lect 03 - first portion

35

Cont’d Highlight the major blood vessels and study the shape of the flow of the contrast medium (to detect blockages, etc.)

Measuring the actual flow of the contrast medium as a function of time in a series of images

Page 36: Lect 03 - first portion

36 Gray-level slicing

Highlighting a specific range of gray levels

Page 37: Lect 03 - first portion

37Bit-plane slicing

Highlight the contribution made to total image appearance by specific bits

Example: - each pixel is represented by 8 bits - the image is composed of eight 1-bit planes

- plane 0 contains the least significant bit and plane 7 contains the most significant bit.

Plane 0 contains all the lowest order bits and plane 7 contains all the high-order bits

Only the higher-order bits (especially the top four) contain the majority of the visually significant data. The other bit planes contribute the more subtle details

Is useful for analyzing the relative importance played by each bit of the image

Determine the adequacy of the number of bits used to quantize each pixel

Plane 7 corresponds exactly with an image thresholded at gray level 128

Page 38: Lect 03 - first portion

38Bit-plane slicing

* Highlight specific bits

bit-planes of an image(gray level 0~255)

Ex. 15010

10010100

Page 39: Lect 03 - first portion

39

10110011

11

00

11

01

Bit-plane 0(least significant)

Bit-plane 7(most significant)

Page 40: Lect 03 - first portion

40

7 6

5 4 3

2 1 0

For imagecompression

An 8-bit fractal image

MSB

LSB

Page 41: Lect 03 - first portion

41 References

“Digital Image Processing”, 2/ E, Rafael C. Gonzalez & Richard E. Woods, www.prenhall.com/gonzalezwoods.

Only Original Owner has full rights reserved for copied images. This PPT is only for fair academic use.

Page 42: Lect 03 - first portion

Chapter 3 – Next Section (Coming Soon)

Questions?