34
Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

  • View
    226

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Chap. 3: Image Enhancement in the Spatial Domain

Spring 2006, Jen-Chang LiuCSIE, NCNU

Page 2: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Announcement Where to find MATLAB ?

It’s not free… A book contains the student’s edition of

MATLAB NCNU CC support 50 on-line version in the

computer rooms (307, 308, 208, 413)

Page 3: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image Enhancement Goal: process an image so that the

result is more suitable than the original image for a specific application

Visual interpretation Problem oriented

Page 4: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image enhancement example

Page 5: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Two categories There is no general theory of image

enhancement Spatial domain

Direct manipulation of pixels Point processing Neighborhood processing

Frequency domain Modify the Fourier transform of an image

Page 6: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Outline: spatial domain operations

Background Gray level transformations Arithmetic/logic operations

Page 7: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Background

Spatial domain processing g(x,y)=T[ f(x,y) ] f(x,y): input image g(x,y): output image T: operator

Defined over some neighborhood of (x,y)

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

Page 8: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Background (cont.)

* T operates over neighborhood of (x,y)

* T applies to each pixel in the input image

Page 9: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Point processing 1x1 neighborhood

Gray level transformation, or point processing

s = T(r)

contraststretching

thresholding

Page 10: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Neighborhood processing

A larger predefined neighborhood Ex. 3x3 neighborhood mask, filters, kernels, templates,

windows Mask processing or filtering

Page 11: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Some Basic Gray Level Transformations

Image negatives (complement) Log transformation Power-law transform Piece-wise linear transform Gray level slicing Bit plane slicing

Page 12: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Some gray level transformations

•Lookup table•Functional form

Page 13: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image negatives Photographic negative 負片 Suitable for images with dominant black a

reas

Original mammogram( 乳房 X 光片 )

Page 14: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Log transformations s = c log(1+r)

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

Page 15: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Example: Log transformations

log(fft2(I)) : log of Fourier transform

2d Fourier transform 頻譜圖

log

Page 16: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Power-law transformations

s=cr

>1 <1 : gamma

display, printers, scanners follow power-law

Gamma correction

Page 17: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Example: Gamma correction

CRT: intensity-to-voltage response follow a power-law. 1.8<<2.5

=2.5

=1/2.5

=2.5

原始影像 顯示器偏差

Page 18: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Power-law:

Expand dark gray levels

<1

=0.6

=0.3=0.4

Page 19: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Power-law: >1

Expand light gray levels

=4 =5

=3

Page 20: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Piece-wise linear transformations

Advantage: the piecewise function can be arbitrarily complex

control point

Page 21: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Contraststretching

How to automatically adjust the gray levels?

Page 22: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Gray-level slicing 切片 Highlighting a specific range of gray

levels

Page 23: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Bit-plane slicing* Highlight specific bits

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

Ex. 15010

10010100

Page 24: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Bit-plane slicing: example

Page 25: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

7 6

5 4 3

2 1 0

For imagecompression

Page 26: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Arithmetic/logic operations

Logic operations Image subtraction Image averaging

Page 27: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Logic operations Logic operations: pixel-wise AND, OR,

NOT The pixel gray level values are taken as

string of binary numbers

Use the binary mask to take out the region of interest(ROI) from an image

Ex. 193 => 11000001

Page 28: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Logic operations: example

AND

OR

A B A and B

A or B

Page 29: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image subtraction

Difference image g(x,y)=f(x,y)-h(x,y)

f:original(8 bits) h:4 sig. bits

difference image

scaling

Page 30: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image subtraction: scaling the difference image

g(x,y)=f(x,y)-h(x,y) f and h are 8-bit => g(x,y) [-255, 255]

1. (1)+255 (2) divide by 2• The result won’t cover [0,255]

2. (1)-min(g) (2) *255/max(g)

Be careful of the dynamic range after the imageis processed.

Page 31: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image subtraction example: mask mode radiography

Inject contrast medium into bloodstreamoriginal (head) difference image

注射碘液拍攝影像與原影像相減

Page 32: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image averaging Noisy image g(x,y)=f(x,y)+η(x,y)

Suppose η(x,y) is uncorrelated and has zero mean

original noise

Clear image Noisy image

Page 33: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

Image averaging: noise reduction

),(),( yxfyxgE

2),(

2),(

1yxyxg K

期望值接近原圖

2K

Averaging over K noisy images gi(x,y)

K

ii yxg

Kyxg

1

),(1

),(

Page 34: Chap. 3: Image Enhancement in the Spatial Domain Spring 2006, Jen-Chang Liu CSIE, NCNU

original Gaussiannoise

averagingK=8

averagingK=16

averagingK=64

averagingK=128