SlideShare a Scribd company logo
1 of 52
Ch3. Image enhancement in spatial domain
-1-
Ch3. Image Enhancement in
the Spatial Domain
Ch3. Image enhancement in spatial domain
-2-
Contents
3.1 Background
3.2 Some basic gray level transformations
3.3 Histogram processing
3.4 Enhancement using arithmetic/logic operations
3.5 Basics of spatial filtering
3.6 Smoothing spatial filters
3.7 Sharpening spatial filters
3.8 Combining spatial enhancement methods
Ch3. Image enhancement in spatial domain
-3-
3.1 Background
 Two categories in image enhancement
approaches
1) Spatial domain processing
1) Based on direct manipulation of pixels in an image plane
itself
2) Frequency domain processing
• Based on modifying the Fourier transform of an image
 Spatial domain processing
–
– Where, f(x,y): input image, g(x,y): processed image, T:
an operator on f, defined over some neighborhood of
(x,y)
 
)
,
(
)
,
( y
x
f
T
y
x
g 
Ch3. Image enhancement in spatial domain
-4-
 Neighborhood of (x,y)
– Use a square or rectangular subimage area centered at
(x,y):
– Mask (filters, kernels, templates, windows): mask
processing or filtering
Ch3. Image enhancement in spatial domain
-5-
– In case of 1x1 (that is, a single pixel): point processing
•
• Where, r: gray level of f(x,y), s: gray level of g(x,y)
• examples:
 Contrast stretching: Fig 3.2(a)
 Thresholding: Fig 3.2(b)
)
(r
T
s 
Ch3. Image enhancement in spatial domain
-6-
3.2 Some basic gray level transformations
 3 types of gray-
level transformation
functions
1) Linear: negative and
identity
transformations
2) Logarithmic: log and
inverse-log
transformations
3) Power-law: nth
power and nth root
transformations
Ch3. Image enhancement in spatial domain
-7-
 Image negatives
– Function:
– Reverse the intensity levels of an image:
positive  negative
levels
gray
of
num
where 


 L
r
L
s ,
1
Ch3. Image enhancement in spatial domain
-8-
 Log transformations
– General form:
– Expand the values of dark pixels while compressing the
higher-level values.
– The opposite is true of the inverse log transformation
– Characteristic: compress the dynamic range of images
with large variations in pixel values
0
)
1
log( 


 r
c
r
c
s const,
where
,
Ch3. Image enhancement in spatial domain
-9-
– example: Fourier spectrum
0 ~ 1.5x106  0 ~ 255
Ch3. Image enhancement in spatial domain
-10-
 Power-law transformations
– Basic form: const
postive
and
where
, 
 

c
cr
s
Ch3. Image enhancement in spatial domain
-11-
– Gamma correction:
• Intensity-to-voltage
response of CRT:
=1.8~2.5
• If =2.5, s = r1/2.5 = r0.4
– Example 3.1 & Fig 3.8
– Example 3.2 & Fig 3.9
Ch3. Image enhancement in spatial domain
Example: Gamma Transformations
Ch3. Image enhancement in spatial domain
Example: Gamma Transformations
Ch3. Image enhancement in spatial domain
Example: Gamma Transformations
Ch3. Image enhancement in spatial domain
-15-
 Piecewise-linear
transformation functions
– Contrast stretching:
• Increase the dynamic range
of the gray levels
• If r1=s1 and r2=s2, then
identity function
• If r1= r2, s1=0 and s2=L-1,
then thresholding function
• In general, r1 r2 and s1s2,
so the function is single
valued and monotonically
increasing
Ch3. Image enhancement in spatial domain
-16-
– Gray-level slicing
• Highlighting a specific range of gray level in an image
Ch3. Image enhancement in spatial domain
5/11/2024
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
Ch3. Image enhancement in spatial domain
-18-
– Bit-plane slicing:
• Highlighting the specific bit planes
• The higher-order bits contain the majority of the visually
significant data
• Useful for image compression
• Bit-plane 7 is a thresholded (binary) image with 127
• Fig 3.13 & 3.14
Ch3. Image enhancement in spatial domain
Bit-plane Slicing
Ch3. Image enhancement in spatial domain
Bit-plane Slicing
Ch3. Image enhancement in spatial domain
-21-
3.3 Histogram processing
– Histogram function of a digital image:
• Discrete function h(rk)=nk, where rk : k th gray level, nk :
number of pixels with gray level rk
– Normalized histogram
• p(rk)=nk/n, for k=0,1,…,L-1, where n : total number of
pixels
• Sum of all components of the normalized histogram is
equal to 1
– Fig 3.15
• High dynamic range  uniform distribution
 histogram equalization
Ch3. Image enhancement in spatial domain
-22-
Ch3. Image enhancement in spatial domain
-23-
3.3.1 Histogram equalization
– Assume that gray level r is continuous and normalized
to [0,1], that is,
s = T(r) 0  r  1
– Assume that the transformation function T(r) satisfies
the following conditions:
(a)T(r) is single-valued and monotonically increasing in the
interval 0  r  1
(b) 0  T(r)  1 for 0  r  1
Ch3. Image enhancement in spatial domain
-24-
– If the inverse transformation function
r = T-1(s) 0  s  1 satisfies the above conditions,
then
– If we use CDF(Cumulative Distribution Function) of r for
the transformation function, that is,
– Then, the above equation satisfies both conditions of (a)
and (b).
PDF
is
p()
where
,
)
(
)
(
)
(
1
s
T
r
r
s
ds
dr
r
p
s
p












r
r dw
w
p
r
T
s
0
)
(
)
(
Ch3. Image enhancement in spatial domain
-25-
)
(
)
(
)
(
0
r
p
dw
w
p
dr
d
dr
r
dT
dr
ds
r
r
r










1
0
1
)
(
1
)
(
)
(
)
(





s
r
p
r
p
ds
dr
r
p
s
p
r
r
r
s
If we use CDF for the transformation function, histogram of
the transformed image becomes uniform.
 Histogram equalization
 Uniform density
- Thus,
[Leibniz’s rule]
Ch3. Image enhancement in spatial domain
-26-
– In digital image, gray level is discrete. Thus,
and, transformation function for histogram equalization
is
– also, inverse transformation function is
– Example 3.3, Fig 3.17, and Fig 3.18
1
,
,
2
,
1
,
0
)
( 

 L
k
n
n
r
p k
k
r 
1
,
,
2
,
1
,
0
)
(
)
(
0
0









L
k
n
n
r
p
r
T
s
k
j
j
k
j
j
r
k
k

1
,
,
2
,
1
,
0
)
(
1


 
L
k
s
T
r k
k 
Ch3. Image enhancement in spatial domain
5/11/2024 27
Ch3. Image enhancement in spatial domain
-31-
3.3.3 Local enhancement
 Histogram processing for entire image: global
 Local histogram processing:
– Define a square or rectangular neighborhood and move the
center of this area from pixel to pixel. At each location,
histogram equalization or histogram matching is obtained
– Another approach is to utilize non-overlapping regions, but it
usually produces an undesirable checkerboard effect.
Ch3. Image enhancement in spatial domain
-32-
3.3.4 Use of histogram statistics for
image enhancement
 Some statistical parameters obtainable directly from
the histogram for image enhancement
 nth moment:
– and . The second moment is
 variance of r ( )
)
(
)
(
)
(
)
(
1
0
1
0
i
L
i
i
L
i
i
n
i
n
r
p
r
m
r
m
r
p
m
r
r









:
of
value
mean
the
is
where

i
i r
r
p level
gray
of
histogram
normalized
:
)
(
1
0 
 0
1 






1
0
2
2 )
(
)
(
)
(
L
i
i
i r
p
m
r
r
 )
(
2
r

 measure of average gray level
 measure of average contrast
Ch3. Image enhancement in spatial domain
-35-
3.4 Enhancement using
arithmetic/logic operations
 Arithmetic/logic operations: pixel-by-pixel basis
 Arithmetic operations
– Image subtraction
– Image addition
– Image multiplication
– Image division
 Logic operations
– NOT: negative transformation
– AND/OR
• Used for masking
• Masking is ROI(region of interest) processing
Ch3. Image enhancement in spatial domain
-36-
Ch3. Image enhancement in spatial domain
-37-
3.4.1 Image subtraction
 Difference between f(x,y) and h(x,y):
 Subtraction is the enhancement of difference between
images.
 Fig 3.28:
 Example 3.7, Fig 3.29
 Comments on implementation
– The difference image can range –255~255 => need to scale to
0~255
• Add 255 and then divide by 2
• (diff image – min)x255/max; max: maximum of (diff image – min)
image
 Image subtraction can be used for segmentation (changes)
)
,
(
)
,
(
)
,
( y
x
h
y
x
f
y
x
g 

Ch3. Image enhancement in spatial domain
-38-
Ch3. Image enhancement in spatial domain
-39-
3.42 Image averaging
 Consider a noisy image g(x,y), original image f(x,y), noise
(x,y)
 At every (x,y), assume that noise is uncorrelated and has
zero average, then averaging K different noisy images
 Example 3.8, Fig 3.30, 3.31
)
,
(
)
,
(
)
,
( y
x
y
x
f
y
x
g 


2
)
,
(
2
)
,
(
1
1
)
,
(
)}
,
(
{
)
,
(
1
)
,
(
y
x
y
x
g
K
i
i
K
y
x
f
y
x
g
E
y
x
g
K
y
x
g


 

 

and
that
follows
it
then
)
,
(
)
,
(
1
y
x
y
x
g
K


 
Ch3. Image enhancement in spatial domain
-40-
3.5 Basics of spatial filtering
 Response of linear filtering with 3x3 mask at (x,y)
– Fig 3.32
)
1
,
1
(
)
1
,
1
(
)
,
1
(
)
0
,
1
(
)
,
(
)
0
,
0
(
)
,
1
(
)
0
,
1
(
)
1
,
1
(
)
1
,
1
(
















y
x
f
w
y
x
f
w
y
x
f
w
y
x
f
w
y
x
f
w
R


Ch3. Image enhancement in spatial domain
-41-
Ch3. Image enhancement in spatial domain
-42-
3.5 Basics of spatial filtering
 In general, linear filtering with m x n mask
– w(s,t): convolution mask, or convolution kernel
2
/
)
1
(
,
2
/
)
1
(
)
,
(
)
,
(
)
,
(






 

 

n
b
m
a
t
y
s
x
f
t
s
w
y
x
g
a
a
s
b
b
t
where
Ch3. Image enhancement in spatial domain
-43-
 Fig 3.33: 3x3 spatial filter mask
 Nonlinear spatial filters
– Filtering operation is based conditionally on the values
of the pixels in the neighborhood under consideration
– Example: median filtering
 Handling methods for boarder pixels
1) Not process the pixels at a distance no less than (n-
1)/2 pixels from the border
2) “padding” the image by adding rows and columns of
0’s







9
1
9
9
2
2
1
1
i
i
i z
w
z
w
z
w
z
w
R 
Ch3. Image enhancement in spatial domain
-44-
3.6 Smoothing spatial filters
 Smoothing linear filters
– Used for blurring and for noise reduction
– Averaging filter, or lowpass filter
– Undesirable side effect: blur edges
– Fig 3.34: (a)box filter, (b)weighted average
Ch3. Image enhancement in spatial domain
45
Ch3. Image enhancement in spatial domain
-46-
3.6 Smoothing spatial filters
 Smoothing linear filters
– General implementation for weighted average filtering
– Example 3.9 & Fig 3.35, Fig 3.36



 


 



 a
a
s
b
b
t
a
a
s
b
b
t
t
s
w
t
y
s
x
f
t
s
w
y
x
g
)
,
(
)
,
(
)
,
(
)
,
(
Ch3. Image enhancement in spatial domain
47
Ch3. Image enhancement in spatial domain
48
Example: Gross Representation of Objects
Ch3. Image enhancement in spatial domain
-49-
3.6.2 Order-statistics filters
 Based on ordering (ranking) the pixels: nonlinear
spatial filters
 Median filter
– Replace the value of a pixel by the median of the gray
levels in the neighborhood of that pixel
– advantages:
• Excellent noise reduction capabilities
• Less blurring than linear smoothing filters of similar size
• Effective in the presence of impulse noise (or salt-and
pepper noise)
– Example 3.10
Ch3. Image enhancement in spatial domain
50
Example: Use of Median Filtering for Noise
Reduction
Ch3. Image enhancement in spatial domain
-51-
3.7 Sharpening spatial filters
 Sharpening:
– To highlight fine detail in an image
– To enhance detail that has been blurred
 Applications
– Electronic printing
– Medical imaging
– Industrial inspection
– Autonomous guidance in military systems
 Accomplished by spatial differentiation
Ch3. Image enhancement in spatial domain
-52-
3.7.1 Foundation
 First-order derivative of 1-D function f(x)
 second-order derivative of 1-D function f(x)
 Fig 3.38
– First-order derivatives
• Produce thicker edges
• Stronger response to a gray-level steps
– Second-order derivatives
• Stronger response to fine detail, such as thin lines and isolated
points
• Double response at step changes in gray-level
)
(
)
1
( x
f
x
f
x
f





)
(
2
)
1
(
)
1
(
2
2
x
f
x
f
x
f
x
f







Ch3. Image enhancement in spatial domain
-53-
Ch3. Image enhancement in spatial domain
-54-
3.7.2 Laplacian
– Isotropic filter: independent of the direction  rotation
invariant
 Development of the method
– Lapacian: simplest isotropic derivative operator, Linear
operator
– discrete form (partial 2nd-order derivative in x, y direction)
2
2
2
2
2
y
f
x
f
f







)
,
(
2
)
1
,
(
)
1
,
(
)
,
(
2
)
,
1
(
)
,
1
(
2
2
2
2
y
x
f
y
x
f
y
x
f
y
f
y
y
x
f
y
x
f
y
x
f
x
f
x
















:
direction
:
direction
Ch3. Image enhancement in spatial domain
-55-
– 2-D Laplacian is obtained by summing two components
  )
,
(
4
)
1
,
(
)
1
,
(
)
,
1
(
)
,
1
(
2
y
x
f
y
x
f
y
x
f
y
x
f
y
x
f
f 









Ch3. Image enhancement in spatial domain
-56-
– Adding the original and Laplacian images (superimpose)
– Example 3.11 & Fig 3.40












positive
is
mask
Laplacian
the
of
t
coefficien
center
the
if
negative
is
mask
Laplacian
the
of
t
coefficien
center
the
if
)
,
(
)
,
(
)
,
(
)
,
(
)
,
( 2
2
y
x
f
y
x
f
y
x
f
y
x
f
y
x
g
Ch3. Image enhancement in spatial domain
-57-

More Related Content

Similar to Ch 3. Image Enhancement in the Spatial Domain_okay.ppt

Image enhancement in spatial domain.ppt
Image enhancement in spatial domain.pptImage enhancement in spatial domain.ppt
Image enhancement in spatial domain.pptpravin patil
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
SpatialEnhancement of course CE7491 of NTU
SpatialEnhancement of course CE7491 of NTUSpatialEnhancement of course CE7491 of NTU
SpatialEnhancement of course CE7491 of NTUlyumingzhi
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portionMoe Moe Myint
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1shabanam tamboli
 
Image Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.pptImage Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.pptShabanamTamboli1
 
Image enhancement
Image enhancementImage enhancement
Image enhancementKuppusamy P
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2Surabhi Ks
 
chAPTER1CV.pptx is abouter computer vision in artificial intelligence
chAPTER1CV.pptx is abouter computer vision in artificial intelligencechAPTER1CV.pptx is abouter computer vision in artificial intelligence
chAPTER1CV.pptx is abouter computer vision in artificial intelligenceshesnasuneer
 
computervision1.pptx its about computer vision
computervision1.pptx its about computer visioncomputervision1.pptx its about computer vision
computervision1.pptx its about computer visionshesnasuneer
 
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdfnatnaeltamirat6212
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptssuser7ec6af
 
imageCorrectionLinearDiffusion
imageCorrectionLinearDiffusionimageCorrectionLinearDiffusion
imageCorrectionLinearDiffusionKellen Betts
 
Basics of CT- Lecture 9.ppt
Basics of CT- Lecture 9.pptBasics of CT- Lecture 9.ppt
Basics of CT- Lecture 9.pptMagde Gad
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)Mathankumar S
 

Similar to Ch 3. Image Enhancement in the Spatial Domain_okay.ppt (20)

Image enhancement in spatial domain.ppt
Image enhancement in spatial domain.pptImage enhancement in spatial domain.ppt
Image enhancement in spatial domain.ppt
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Histogram processing
Histogram processingHistogram processing
Histogram processing
 
SpatialEnhancement of course CE7491 of NTU
SpatialEnhancement of course CE7491 of NTUSpatialEnhancement of course CE7491 of NTU
SpatialEnhancement of course CE7491 of NTU
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portion
 
h.pdf
h.pdfh.pdf
h.pdf
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 
Image Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.pptImage Enhancement in the Spatial Domain1.ppt
Image Enhancement in the Spatial Domain1.ppt
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2
 
chAPTER1CV.pptx is abouter computer vision in artificial intelligence
chAPTER1CV.pptx is abouter computer vision in artificial intelligencechAPTER1CV.pptx is abouter computer vision in artificial intelligence
chAPTER1CV.pptx is abouter computer vision in artificial intelligence
 
computervision1.pptx its about computer vision
computervision1.pptx its about computer visioncomputervision1.pptx its about computer vision
computervision1.pptx its about computer vision
 
annotated-chap-3-gw.ppt
annotated-chap-3-gw.pptannotated-chap-3-gw.ppt
annotated-chap-3-gw.ppt
 
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf
2024-master dityv5y65v56u4b6u64u46p 0318-25.pdf
 
Image Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.pptImage Enhancement in the Spatial Domain U2.ppt
Image Enhancement in the Spatial Domain U2.ppt
 
imageCorrectionLinearDiffusion
imageCorrectionLinearDiffusionimageCorrectionLinearDiffusion
imageCorrectionLinearDiffusion
 
DIP Lecture 7-9.pdf
DIP Lecture 7-9.pdfDIP Lecture 7-9.pdf
DIP Lecture 7-9.pdf
 
Basics of CT- Lecture 9.ppt
Basics of CT- Lecture 9.pptBasics of CT- Lecture 9.ppt
Basics of CT- Lecture 9.ppt
 
Image Processing
Image ProcessingImage Processing
Image Processing
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)
 

Recently uploaded

Lect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptxLect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptxHamzaKhawar4
 
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4T.D. Shashikala
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfKamal Acharya
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptxfaamieahmd
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfKamal Acharya
 
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单tuuww
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxkarthikeyanS725446
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-IVigneshvaranMech
 
An improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technologyAn improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technologyBOHRInternationalJou1
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfKamal Acharya
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDrGurudutt
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdfKamal Acharya
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfAyahmorsy
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdfKamal Acharya
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdfKamal Acharya
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2T.D. Shashikala
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Prakhyath Rai
 
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...Amil baba
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单
一比一原版(UofT毕业证)多伦多大学毕业证成绩单一比一原版(UofT毕业证)多伦多大学毕业证成绩单
一比一原版(UofT毕业证)多伦多大学毕业证成绩单tuuww
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdfKamal Acharya
 

Recently uploaded (20)

Lect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptxLect 2 - Design of slender column-2.pptx
Lect 2 - Design of slender column-2.pptx
 
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
RM&IPR M4.pdfResearch Methodolgy & Intellectual Property Rights Series 4
 
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdfA CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
A CASE STUDY ON ONLINE TICKET BOOKING SYSTEM PROJECT.pdf
 
retail automation billing system ppt.pptx
retail automation billing system ppt.pptxretail automation billing system ppt.pptx
retail automation billing system ppt.pptx
 
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdfONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
ONLINE VEHICLE RENTAL SYSTEM PROJECT REPORT.pdf
 
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单
一比一原版(UNK毕业证)内布拉斯加州立大学科尼分校毕业证成绩单
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
An improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technologyAn improvement in the safety of big data using blockchain technology
An improvement in the safety of big data using blockchain technology
 
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdfONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
ONLINE CAR SERVICING SYSTEM PROJECT REPORT.pdf
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
School management system project report.pdf
School management system project report.pdfSchool management system project report.pdf
School management system project report.pdf
 
Peek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdfPeek implant persentation - Copy (1).pdf
Peek implant persentation - Copy (1).pdf
 
Dairy management system project report..pdf
Dairy management system project report..pdfDairy management system project report..pdf
Dairy management system project report..pdf
 
Online resume builder management system project report.pdf
Online resume builder management system project report.pdfOnline resume builder management system project report.pdf
Online resume builder management system project report.pdf
 
Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2Research Methodolgy & Intellectual Property Rights Series 2
Research Methodolgy & Intellectual Property Rights Series 2
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
NO1 Pandit Black Magic Removal in Uk kala jadu Specialist kala jadu for Love ...
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单
一比一原版(UofT毕业证)多伦多大学毕业证成绩单一比一原版(UofT毕业证)多伦多大学毕业证成绩单
一比一原版(UofT毕业证)多伦多大学毕业证成绩单
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
 

Ch 3. Image Enhancement in the Spatial Domain_okay.ppt

  • 1. Ch3. Image enhancement in spatial domain -1- Ch3. Image Enhancement in the Spatial Domain
  • 2. Ch3. Image enhancement in spatial domain -2- Contents 3.1 Background 3.2 Some basic gray level transformations 3.3 Histogram processing 3.4 Enhancement using arithmetic/logic operations 3.5 Basics of spatial filtering 3.6 Smoothing spatial filters 3.7 Sharpening spatial filters 3.8 Combining spatial enhancement methods
  • 3. Ch3. Image enhancement in spatial domain -3- 3.1 Background  Two categories in image enhancement approaches 1) Spatial domain processing 1) Based on direct manipulation of pixels in an image plane itself 2) Frequency domain processing • Based on modifying the Fourier transform of an image  Spatial domain processing – – Where, f(x,y): input image, g(x,y): processed image, T: an operator on f, defined over some neighborhood of (x,y)   ) , ( ) , ( y x f T y x g 
  • 4. Ch3. Image enhancement in spatial domain -4-  Neighborhood of (x,y) – Use a square or rectangular subimage area centered at (x,y): – Mask (filters, kernels, templates, windows): mask processing or filtering
  • 5. Ch3. Image enhancement in spatial domain -5- – In case of 1x1 (that is, a single pixel): point processing • • Where, r: gray level of f(x,y), s: gray level of g(x,y) • examples:  Contrast stretching: Fig 3.2(a)  Thresholding: Fig 3.2(b) ) (r T s 
  • 6. Ch3. Image enhancement in spatial domain -6- 3.2 Some basic gray level transformations  3 types of gray- level transformation functions 1) Linear: negative and identity transformations 2) Logarithmic: log and inverse-log transformations 3) Power-law: nth power and nth root transformations
  • 7. Ch3. Image enhancement in spatial domain -7-  Image negatives – Function: – Reverse the intensity levels of an image: positive  negative levels gray of num where     L r L s , 1
  • 8. Ch3. Image enhancement in spatial domain -8-  Log transformations – General form: – Expand the values of dark pixels while compressing the higher-level values. – The opposite is true of the inverse log transformation – Characteristic: compress the dynamic range of images with large variations in pixel values 0 ) 1 log(     r c r c s const, where ,
  • 9. Ch3. Image enhancement in spatial domain -9- – example: Fourier spectrum 0 ~ 1.5x106  0 ~ 255
  • 10. Ch3. Image enhancement in spatial domain -10-  Power-law transformations – Basic form: const postive and where ,     c cr s
  • 11. Ch3. Image enhancement in spatial domain -11- – Gamma correction: • Intensity-to-voltage response of CRT: =1.8~2.5 • If =2.5, s = r1/2.5 = r0.4 – Example 3.1 & Fig 3.8 – Example 3.2 & Fig 3.9
  • 12. Ch3. Image enhancement in spatial domain Example: Gamma Transformations
  • 13. Ch3. Image enhancement in spatial domain Example: Gamma Transformations
  • 14. Ch3. Image enhancement in spatial domain Example: Gamma Transformations
  • 15. Ch3. Image enhancement in spatial domain -15-  Piecewise-linear transformation functions – Contrast stretching: • Increase the dynamic range of the gray levels • If r1=s1 and r2=s2, then identity function • If r1= r2, s1=0 and s2=L-1, then thresholding function • In general, r1 r2 and s1s2, so the function is single valued and monotonically increasing
  • 16. Ch3. Image enhancement in spatial domain -16- – Gray-level slicing • Highlighting a specific range of gray level in an image
  • 17. Ch3. Image enhancement in spatial domain 5/11/2024 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
  • 18. Ch3. Image enhancement in spatial domain -18- – Bit-plane slicing: • Highlighting the specific bit planes • The higher-order bits contain the majority of the visually significant data • Useful for image compression • Bit-plane 7 is a thresholded (binary) image with 127 • Fig 3.13 & 3.14
  • 19. Ch3. Image enhancement in spatial domain Bit-plane Slicing
  • 20. Ch3. Image enhancement in spatial domain Bit-plane Slicing
  • 21. Ch3. Image enhancement in spatial domain -21- 3.3 Histogram processing – Histogram function of a digital image: • Discrete function h(rk)=nk, where rk : k th gray level, nk : number of pixels with gray level rk – Normalized histogram • p(rk)=nk/n, for k=0,1,…,L-1, where n : total number of pixels • Sum of all components of the normalized histogram is equal to 1 – Fig 3.15 • High dynamic range  uniform distribution  histogram equalization
  • 22. Ch3. Image enhancement in spatial domain -22-
  • 23. Ch3. Image enhancement in spatial domain -23- 3.3.1 Histogram equalization – Assume that gray level r is continuous and normalized to [0,1], that is, s = T(r) 0  r  1 – Assume that the transformation function T(r) satisfies the following conditions: (a)T(r) is single-valued and monotonically increasing in the interval 0  r  1 (b) 0  T(r)  1 for 0  r  1
  • 24. Ch3. Image enhancement in spatial domain -24- – If the inverse transformation function r = T-1(s) 0  s  1 satisfies the above conditions, then – If we use CDF(Cumulative Distribution Function) of r for the transformation function, that is, – Then, the above equation satisfies both conditions of (a) and (b). PDF is p() where , ) ( ) ( ) ( 1 s T r r s ds dr r p s p             r r dw w p r T s 0 ) ( ) (
  • 25. Ch3. Image enhancement in spatial domain -25- ) ( ) ( ) ( 0 r p dw w p dr d dr r dT dr ds r r r           1 0 1 ) ( 1 ) ( ) ( ) (      s r p r p ds dr r p s p r r r s If we use CDF for the transformation function, histogram of the transformed image becomes uniform.  Histogram equalization  Uniform density - Thus, [Leibniz’s rule]
  • 26. Ch3. Image enhancement in spatial domain -26- – In digital image, gray level is discrete. Thus, and, transformation function for histogram equalization is – also, inverse transformation function is – Example 3.3, Fig 3.17, and Fig 3.18 1 , , 2 , 1 , 0 ) (    L k n n r p k k r  1 , , 2 , 1 , 0 ) ( ) ( 0 0          L k n n r p r T s k j j k j j r k k  1 , , 2 , 1 , 0 ) ( 1     L k s T r k k 
  • 27. Ch3. Image enhancement in spatial domain 5/11/2024 27
  • 28. Ch3. Image enhancement in spatial domain -31- 3.3.3 Local enhancement  Histogram processing for entire image: global  Local histogram processing: – Define a square or rectangular neighborhood and move the center of this area from pixel to pixel. At each location, histogram equalization or histogram matching is obtained – Another approach is to utilize non-overlapping regions, but it usually produces an undesirable checkerboard effect.
  • 29. Ch3. Image enhancement in spatial domain -32- 3.3.4 Use of histogram statistics for image enhancement  Some statistical parameters obtainable directly from the histogram for image enhancement  nth moment: – and . The second moment is  variance of r ( ) ) ( ) ( ) ( ) ( 1 0 1 0 i L i i L i i n i n r p r m r m r p m r r          : of value mean the is where  i i r r p level gray of histogram normalized : ) ( 1 0   0 1        1 0 2 2 ) ( ) ( ) ( L i i i r p m r r  ) ( 2 r   measure of average gray level  measure of average contrast
  • 30. Ch3. Image enhancement in spatial domain -35- 3.4 Enhancement using arithmetic/logic operations  Arithmetic/logic operations: pixel-by-pixel basis  Arithmetic operations – Image subtraction – Image addition – Image multiplication – Image division  Logic operations – NOT: negative transformation – AND/OR • Used for masking • Masking is ROI(region of interest) processing
  • 31. Ch3. Image enhancement in spatial domain -36-
  • 32. Ch3. Image enhancement in spatial domain -37- 3.4.1 Image subtraction  Difference between f(x,y) and h(x,y):  Subtraction is the enhancement of difference between images.  Fig 3.28:  Example 3.7, Fig 3.29  Comments on implementation – The difference image can range –255~255 => need to scale to 0~255 • Add 255 and then divide by 2 • (diff image – min)x255/max; max: maximum of (diff image – min) image  Image subtraction can be used for segmentation (changes) ) , ( ) , ( ) , ( y x h y x f y x g  
  • 33. Ch3. Image enhancement in spatial domain -38-
  • 34. Ch3. Image enhancement in spatial domain -39- 3.42 Image averaging  Consider a noisy image g(x,y), original image f(x,y), noise (x,y)  At every (x,y), assume that noise is uncorrelated and has zero average, then averaging K different noisy images  Example 3.8, Fig 3.30, 3.31 ) , ( ) , ( ) , ( y x y x f y x g    2 ) , ( 2 ) , ( 1 1 ) , ( )} , ( { ) , ( 1 ) , ( y x y x g K i i K y x f y x g E y x g K y x g         and that follows it then ) , ( ) , ( 1 y x y x g K    
  • 35. Ch3. Image enhancement in spatial domain -40- 3.5 Basics of spatial filtering  Response of linear filtering with 3x3 mask at (x,y) – Fig 3.32 ) 1 , 1 ( ) 1 , 1 ( ) , 1 ( ) 0 , 1 ( ) , ( ) 0 , 0 ( ) , 1 ( ) 0 , 1 ( ) 1 , 1 ( ) 1 , 1 (                 y x f w y x f w y x f w y x f w y x f w R  
  • 36. Ch3. Image enhancement in spatial domain -41-
  • 37. Ch3. Image enhancement in spatial domain -42- 3.5 Basics of spatial filtering  In general, linear filtering with m x n mask – w(s,t): convolution mask, or convolution kernel 2 / ) 1 ( , 2 / ) 1 ( ) , ( ) , ( ) , (             n b m a t y s x f t s w y x g a a s b b t where
  • 38. Ch3. Image enhancement in spatial domain -43-  Fig 3.33: 3x3 spatial filter mask  Nonlinear spatial filters – Filtering operation is based conditionally on the values of the pixels in the neighborhood under consideration – Example: median filtering  Handling methods for boarder pixels 1) Not process the pixels at a distance no less than (n- 1)/2 pixels from the border 2) “padding” the image by adding rows and columns of 0’s        9 1 9 9 2 2 1 1 i i i z w z w z w z w R 
  • 39. Ch3. Image enhancement in spatial domain -44- 3.6 Smoothing spatial filters  Smoothing linear filters – Used for blurring and for noise reduction – Averaging filter, or lowpass filter – Undesirable side effect: blur edges – Fig 3.34: (a)box filter, (b)weighted average
  • 40. Ch3. Image enhancement in spatial domain 45
  • 41. Ch3. Image enhancement in spatial domain -46- 3.6 Smoothing spatial filters  Smoothing linear filters – General implementation for weighted average filtering – Example 3.9 & Fig 3.35, Fig 3.36              a a s b b t a a s b b t t s w t y s x f t s w y x g ) , ( ) , ( ) , ( ) , (
  • 42. Ch3. Image enhancement in spatial domain 47
  • 43. Ch3. Image enhancement in spatial domain 48 Example: Gross Representation of Objects
  • 44. Ch3. Image enhancement in spatial domain -49- 3.6.2 Order-statistics filters  Based on ordering (ranking) the pixels: nonlinear spatial filters  Median filter – Replace the value of a pixel by the median of the gray levels in the neighborhood of that pixel – advantages: • Excellent noise reduction capabilities • Less blurring than linear smoothing filters of similar size • Effective in the presence of impulse noise (or salt-and pepper noise) – Example 3.10
  • 45. Ch3. Image enhancement in spatial domain 50 Example: Use of Median Filtering for Noise Reduction
  • 46. Ch3. Image enhancement in spatial domain -51- 3.7 Sharpening spatial filters  Sharpening: – To highlight fine detail in an image – To enhance detail that has been blurred  Applications – Electronic printing – Medical imaging – Industrial inspection – Autonomous guidance in military systems  Accomplished by spatial differentiation
  • 47. Ch3. Image enhancement in spatial domain -52- 3.7.1 Foundation  First-order derivative of 1-D function f(x)  second-order derivative of 1-D function f(x)  Fig 3.38 – First-order derivatives • Produce thicker edges • Stronger response to a gray-level steps – Second-order derivatives • Stronger response to fine detail, such as thin lines and isolated points • Double response at step changes in gray-level ) ( ) 1 ( x f x f x f      ) ( 2 ) 1 ( ) 1 ( 2 2 x f x f x f x f       
  • 48. Ch3. Image enhancement in spatial domain -53-
  • 49. Ch3. Image enhancement in spatial domain -54- 3.7.2 Laplacian – Isotropic filter: independent of the direction  rotation invariant  Development of the method – Lapacian: simplest isotropic derivative operator, Linear operator – discrete form (partial 2nd-order derivative in x, y direction) 2 2 2 2 2 y f x f f        ) , ( 2 ) 1 , ( ) 1 , ( ) , ( 2 ) , 1 ( ) , 1 ( 2 2 2 2 y x f y x f y x f y f y y x f y x f y x f x f x                 : direction : direction
  • 50. Ch3. Image enhancement in spatial domain -55- – 2-D Laplacian is obtained by summing two components   ) , ( 4 ) 1 , ( ) 1 , ( ) , 1 ( ) , 1 ( 2 y x f y x f y x f y x f y x f f          
  • 51. Ch3. Image enhancement in spatial domain -56- – Adding the original and Laplacian images (superimpose) – Example 3.11 & Fig 3.40             positive is mask Laplacian the of t coefficien center the if negative is mask Laplacian the of t coefficien center the if ) , ( ) , ( ) , ( ) , ( ) , ( 2 2 y x f y x f y x f y x f y x g
  • 52. Ch3. Image enhancement in spatial domain -57-