digital image processing - oghabianoghabian.net/download/4-enhancementspdom.pdf · digital image...

71
Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4)

Upload: dothuan

Post on 13-Apr-2019

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Digital Image Processing

Image Enhancement in the Spatial Domain

(Chapter 4)

Page 2: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

The principal objective of enhancement is to process an images so that the result is more suitable than the original image for a SPECIFICapplication

Category of image enhancement• Spatial domain• Frequency domain

Objective

Page 3: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Pixel neighborhood

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

Page 4: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Point Processing,Gray-Level Transformation Function

s = T (r)

Contraststretching

Thresholding

Page 5: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

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

0

0

-1

0

0

0

0

0

T

f(x,y) g(x,y)

Mask Processing Filtering

Page 6: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Some Basic gray-Level transformation for image Enhancement

Basic Gray Level Transformation

Page 7: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Image Negative

s = L - 1 - r

Page 8: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Log Transformations

s = c log(1+r)

Pixel values dynamic range=[0 - 1.5×106]

Page 9: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Power-Law Transformations

s = cr

s = r2.5

r = [1 10 20 30 40 210 220 230 240 250 255]

s( = 2.5) = [0 0 0 1 2 157 176 197 219 243 255]

s( =.4) = [28 70 92 108 122 236 240 245 249 253 255]

Page 10: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Power-Law Transformations - Gamma Correction

Page 11: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Power-Law Transformations

c=1

= 0.4c=1

= 0.3

c=1

= 0.6

Page 12: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Power-Law Transformations

c=1

= 3

c=1

= 5

c=1

= 4

Page 13: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

•Advantage–Arbitrarily complex

•Disadvantage–More user input

•Type of Transformations–Contrast stretching

–Gray-level slicing

–Bit-plane slicing

Piecewise-Linear Transformation Functions

Page 14: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Contrast Stretching

Objective: Increase the dynamic range of the gray levels

Causes for poor image-Poor illumination-Lack of dynamic rangein the imaging sensor-Wrong lens aperture

Page 15: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Example 1For image with intensity range [50 - 150]What should (r1,s1) and (r2,s2) be to increase the dynamic range of the image to [0 - 255]?

r

s

Contrast Stretching

Page 16: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Objective: Highlighting a specific range of gray levels in an image.

Gray-Level Slicing

Page 17: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

255 138 30

65 12 201

180 111 85

255

138

30

65

12

201

183

111

85

1 1 1 1 1 1 1 1

0 1 0 1 0 0 0 1

1 1 1 1 1 0 0 0

1 0 0 0 0 0 1 0

0 0 1 1 0 0 0 0

1 0 0 1 0 0 1 1

1 1 1 0 1 1 0 1

1 1 1 1 0 1 1 0

1 0 1 0 1 0 1 0

MSBLSB

1 1 0

0 0 1

1 0 0

MSB plane

1 0 1

1 0 1

1 1 1

LSB plane

Bit-Plane Slicing

Page 18: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

8-bit fractal image used for Bit-Plane Slicing

Page 19: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Bit-Plane Slicing

Page 20: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

HistogramThe histogram of a digital image with gray levels in the range [0, L-1] is a discrete function

h(rk) = nk, where rk is the kth gray level and nk is the number of pixels in the image having gray level rk.

Normalized HistogramDividing each value of the histogram by the total number of pixels in the image, denoted by n.

p(rk) = nk /n.Normalized histogram provide useful image statistics.

Histogram Processing

Page 21: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

function Normalized_Hist = Img_Hist(img)

[R,C]=size(img);

Hist=zeros(256,1);

for r = 1:R

for c=1:C

Hist(img(r,c)+1,1)=Hist(img(r,c)+1,1)+1;

end

end

Normalized_Hist = Hist/(R*C);

plot(Normalized_Hist)

Histogram Extraction using Matlab

Page 22: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Histogram Processing

Page 23: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Histogram equalization is used to enhance image contrast and gray-level detail by spreading the histogram of the original image.

s = T ( r ) 0 r 1, where r and s are normalized pixel intensities

Conditions for the transformation(a) T( r ) is single-valued and monotonically increasing in the

interval 0 r 1(b) 0 T ( r ) 1 for 0 r 1

1

Histogram Equalization

Page 24: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Objective of histogram equalizationTransform the histogram function of the original image pr(r) to a uniform histogram function.

ps(s) = 1 0 s 1

Equalizer

Transformationpr(r) ps(s)

r

r dwwprTs

0

)()(

k

j

jrkk rprTs0

)()(

Continuous case Discrete case

Histogram Equalization

Page 25: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

0

1

2

3

:

:

128

129

130

:

:

253

254

255

0

0

:

0

:

:

0.004

0.15

0.05

:

:

0.005

0.006

0.004

pr(rk)k

T (rk)

0

0

:

0

0

0

0.004

0.154

0.204

:

:

0.989

0.994

1

sk

0

0

0

0

:

:

10

39

52

:

:

252

253

255

0

0.004

0.008

0.011

:

:

0.5

0.505

0.51

:

:

0.992

0.996

1

rk

/255 *255

Input image Output image

Page 26: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Histogram Equalization

Page 27: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

255

Histogram Equalization

Page 28: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Is histogram equalization a good approach to enhance the image?

Histogram Matching

Page 29: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

0.6

0.12

0.08

0.0

:

0.01

0.005

0

0.6

0.72

0.8

0.8

:

0.9

0.95

1

153

184

204

204

:

230

242

255

Histogram Equalization

pr(rk) sks

Page 30: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Histogram Matching method generates a processed image that has a specified histogram.

Input image

pr(r)

T (r)

r

r dttp

0

)( s

Desired

Output image

pz(z)

G (z)

z

z dttp

0

)( v

s v, since both will have

approximately uniform pdf

z = G-1[T( s )] s = G[T( r )]

Histogram Matching

Page 31: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Histogram Matching

Page 32: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

1) Modify the histogram ofthe image to obtain pz(z).

2) Find transformation function G (z) using themodified histogram instep 1.

3) Find the inverse G-1 (z)

4) ApplyG-1 to the pixels of the histogram-equalized image.

G (z)

G-1 (z)

Histogram Matching

Page 33: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

125

128

0.98

0.002

250

2550.7

0.3

178

255

Local Histogram

Global Histogram

125 128

Local Histogram Enhancement

Page 34: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Local Histogram Enhancement

Page 35: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Contrast manipulation using local statistics, such as the mean and variance, is useful for images where part of the image is acceptable,but other parts may contain hidden features of interest.

Histogram Statistics for Image Enhanc.

Page 36: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Let (x,y) be the coordinates of a pixel in an image, and let Sxy

denote a neighborhood (sub-image) of specified size, centered at(x,y).

.)(][

)(

),(

,2

,2

),(

,,

xy

xyxy

xy

xy

Sts

tsStsS

Sts

tstsS

rpmr

rprm

The local mean and variance are the decision factors to whether applylocal enhancement or not.

Histogram Statistics for Image Enhanc.

Page 37: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

otherwise ),(

AND if ),(.),(

210

yxf

DkDkMkmyxfEyxg

GSGGS xyxy

MG: Global meanDG: Global standard deviationE, k0, k1, k2: Specified parameters

E = 4,

k0 = 0.4,

k1= 0.02,

k2 = 0.4

Size of local area = 3 3

Histogram Statistics for Image Enhanc.

Page 38: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

125 135 145 135 ..

168 175 158 149 ..

210 231 215 129 ..

187 192 145 200 ..

174

Image Mean

164

187

(x,y) (x,y) E

Histogram Statistics for Image Enhanc.

Page 39: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Enhanced ImageOriginal Image

Histogram Statistics for Image Enhanc.

Page 40: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Arithmetic/logic operations involving images are performed on a pixel-by-pixel basis between two or more images.

Arithmetic OperationsAddition, Subtraction, Multiplication, and Division

Logic OperationsAND, OR, NOT

Enhancement Using Arithmetic/Logic Op.

Page 41: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

AND

OR

Logic operations are performed on the binary representation of the pixel intensities

Enhancement Using AND and OR Logic Op.

Page 42: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Enhancement Using Arithmetic Op. _ SUB

Original4

Upper-order

Bit

ErrorHE of

Error

Page 43: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Problem:The pixel intensities in the difference image can range from -255 to 255.Solutions:1) Add 255 to every pixel and then divide by 2.2) Add the minimum value of the pixel intensity in the difference image

to every pixel and then divide by 255/Max. Max is the maximumpixel value in the modified difference image.

Enhancement Using Arithmetic Op. _ SUBMask Mode Radiography

Page 44: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

2

),(

2

),(

1

1

),(),(

),(1

),(

),(),(),(

yxyxg

k

i

i

k

yxfyxgE

yxgk

yxg

yxyxfyxg

Original image Noise with zero mean

Enhancement Using Arithmetic Op. Averaging

Page 45: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Gaussian Noise

mean = 0

variance = 64

K = 8

K = 32

K = 16

K = 128

f(x,y) g(x,y)

+-

x

Enhancement Using Arithmetic Op. Averaging

Page 46: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Difference images between original image and images obtained from averaging.

K = 8

K = 16

K = 32

K = 128

Notice the mean and varianceof the difference imagesdecrease as Kincreases.

Enhancement Using Arithmetic Op. Averaging

Page 47: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Spatial filtering are filtering operations performed on the pixel intensities of an image and not on the frequency components of the image.

a

as

b

bt

tysxftswyxg ),(),(),(

a = (m - 1) / 2 b = (n - 1) / 2

Basics of Spatial Filtering - Linear

Page 48: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Response, R, of an m n mask at any point (x, y)

mn

i

iizwR1

Special consideration is given when the center of the filterapproach the boarder of the image.

Basics of Spatial Filtering

Page 49: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Nonlinear spatial filters operate on neighborhoods, and the mechanics of sliding a mask past an image are the same as was just outlined. In general however, the filtering operation is based conditionally on the values of the pixel in the neighborhood under consideration, and they do not explicitly use coefficients in the sum-of products manner described previously.

ExampleComputation for the median is a nonlinear operation.

Nonlinear of Spatial Filtering

Page 50: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Smoothing filters are used- Noise reduction- Smoothing of false contours- Reduction of irrelevant detail

Undesirable side effect of smoothing filters- Blur edges

Weighted

average

Box

filter

Weighted average filterreduces blurring in the

smoothing process.

Smoothing Spatial Filtering - LinearAveraging (low-pass) Filters

Page 51: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

n = filter size

n = 3

n = 5 n = 9

n = 15

n = 35

Smoothing Spatial Filtering _ LinearAveraging (low-pass) Filters

Page 52: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

filter size

n = 15

Thrsh = 25% of

highest intensity

Smoothing Spatial FilteringAveraging & Threshold

Page 53: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Order-statistics filters are nonlinear spatial filters whose response is based on ordering (ranking) the pixels contained in the image area encompassed by the filter, and then replacing the value of the center pixel with the value determined by the ranking result.

3 3 Median filter [10 125 125 135 141 141 144 230 240] = 141

3 3 Max filter [10 125 125 135 141 141 144 230 240] = 240

3 3 Min filter [10 125 125 135 141 141 144 230 240] = 10

Median filter eliminates isolated clusters of pixels that are light or dark with respect to their neighbors, and whose area is less than n2/2.

Smoothing Spatial FilteringOrder Statistic Filters

Page 54: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

n = 3

Average

filter

n = 3

Median

filter

Order Statistic Filters

Page 55: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

The principal objective of sharpening is to highlight fine detail in an image or to enhance detail that has been blurred.

9

1

9

1

9

1

9

1

z

zi

Image Blurred Image

The derivatives of a digital function are defined in terms of differences.

Sharpening Spatial Filters

Page 56: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Requirements for digital derivativeFirst derivative

1) Must be zero in flat segment2) Must be nonzero along ramps.3) Must be nonzero at the onset of a gray-level step or ramp

Second derivative1) Must be zero in flat segment2) Must be zero along ramps. 3) Must be nonzero at the onset and end of a gray-level step

or ramp

)(2)1()1(

)()1(

2

2

xfxfxfx

f

xfxfx

f

Sharpening Spatial Filters

Page 57: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Sharpening Spatial Filters

Page 58: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Comparing the response between first- and second-ordered derivatives:1) First-order derivative produce thicker edge2) Second-order derivative have a stronger response to fine detail, such as thin lines and isolated points.3) First-order derivatives generally have a stronger response to a gray-level step {2 4 15}4) Second-order derivatives produce a double response at step changes in gray level.

In general the second derivative is better than the first derivative for image enhancement. The principle use of first derivative is for edge extraction.

Sharpening Spatial Filters

Page 59: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

First derivatives in image processing are implemented using the magnitude of the gradient.

yx

t

GGy

f

x

fmagf

y

f

x

f

5.022

)( f

f z1 z2

z6

z8

z4

z7

z3

z9

z5

Roberts operator

Gx = (z9-z5) and Gy = (z8 - z6)Sobel operator

Gx = (z7+2z8+z9) - (z1+2z2+z3) and

Gy = (z3+2z6 +z9) - (z1+2z4+z7)

Use of First Derivative for Edge Extraction Gradient

Page 60: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Sobel operators

Robert operator

Use of First Derivative for Edge Extraction Gradient

Page 61: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

f(x,y) = [40, 140]

…. 0 0 0 0 0 0

…. 0 200 400 400 400 400 ……

…. 0 400 600 400 400 400 …...

…. 0 400 400 0 0 0

…. 0 400 400 0 0 0

…. 0 400 400 0 0 0

-1 -2

0

2

0

1

-1

1

0

-1 0

2

0

-2

-1

1

1

0

… 0 0 0 0 0

… 0 100 200 200 200

… 0 200 0 0 0

… 0 200 0 0 0

-11

-11

Use of First Derivative for Edge Extraction Gradient

Page 62: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Use of First Derivative for Edge Extraction Gradient

Page 63: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

2

2

2

22

y

f

x

ff

)],(4)1,()1,(),1(),1([

),(2)1,()1,(

),(2),1(),1(

2

2

2

2

2

yyfyxfyxfyxfyxff

yxfyxfyxfy

f

yxfyxfyxfx

f

2nd Derivative _ Laplacian

Page 64: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

2

2

2

22

y

f

x

ff

Isotropic filter response is independent of the direction of the discontinuities in the image to which the filter is applied.

Use of 2nd Derivative for EnhancementLaplacian

Page 65: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

f(x,y) = [90, 100]0 1

1

1

1

0

0

0

-4

… 0 0 0 0 …

… 0 10 0 0 …

… 10 -40 10 0 …

… 0 10 0 0 …

… 0 0 0 0 …

Use of 2nd Derivative for EnhancementLaplacian

Page 66: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

),(),(

),(),(),(

2

2

yxfyxf

yxfyxfyxg

If the center coefficientof the laplacian mask isnegative

1 1

1

1

1

1

1

1

-8

Use of 2nd Derivative for EnhancementLaplacian

Page 67: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

g(x,y) = f(x,y) -

0 1

1

1

1

0

0

0

-4

),(2 yxf

=

)],(4)1,()1,(),1(),1([2 yxfyxfyxfyxfyxff

Use of 2nd Derivative for EnhancementLaplacian

Page 68: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

High-boost filtering is used when the original image isblurred and dark.

),(),( 2 yxfyxAffhb A > 1

Un-sharp Masking and High-boost Filtering

Page 69: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

(b)

Un-sharp Masking and High-boost Filtering

Page 70: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Combining Spatial Enhancement Methods

Page 71: Digital Image Processing - Oghabianoghabian.net/download/4-EnhancementSpDom.pdf · Digital Image Processing Image Enhancement in the Spatial Domain (Chapter 4) The principal objective

Combining Spatial Enhancement Methods