chapter 3: image enhancement in the spatial domainit.nrru.ac.th › krit › 411304 ›...
TRANSCRIPT
Digital Image ProcessingChapter 3:
Digital Image ProcessingChapter 3: Chapter 3:
Image Enhancement in the Chapter 3:
Image Enhancement in the Image Enhancement in the Spatial Domain
Image Enhancement in the Spatial Domain
Spatial Domain Spatial Domain
i l ป ป i หมายถง ทตงอยหรอระนาบของ pixel ทประกอบขนเปน image ซงสามารถระบตาแหนงของ pixel ในความหมายของระยะทางได
กลาวคอ ใน spatial domain เราสามารถแทน image ดวย f(x,y)เมอ x และ y คอระยะทางในแนวแกนตงและแกนนอนวดจากจด Origin
ตวอยางทเปนของคกนคอ Spatial Domain กบ Frequency Domainตวอยางทเปนของคกนคอ Spatial Domain กบ Frequency Domain
รปภาพใน Spatial Domainเมอแปลงภาพโดยใช Fourier Transformรปภาพใน Spatial Domain
คอรปภาพทอยในระนาบ xy ทเรา
เหนกนตามปกต ใน Domain น
Transform ความหมายของระยะทางจะหายไป แตจะเกดความ
ใ เหนกนตามปกต ใน Domain นเราใชระยะทางในการกาหนดตาแหนง
หมายในเชงความถขนมาแทน ซง
ขอมลนจะอยใน Frequencydomaindomain
Image EnhancementImage Enhancement
I E h ป ป ใ Image Enhancement หมายถงการปรบปรงภาพใหเหมาะสมกบงานเฉพาะทางดานตางๆ เชนการทาใหภาพชดเจนขน (ในสายตามนษย)
ตวอยาง
หมายเหต: วธการปรบปรงภาพทเหมาะสาหรบงานอยางหนงไมจาเปนตองเหมาะสมกบ ไปงานอกอยางหนงเสมอไป
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Image Enhancement ExampleImage Enhancement Example
ภาพตงตน ภาพทปรบปรงแลวโดยใช
Gamma correction
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
ป ป โ ใ ใ S ti l d i ใ
Image Enhancement in the Spatial DomainImage Enhancement in the Spatial Domain
หมายถงการปรบปรงภาพโดยใชกระบวนการทกระทาใน Spatial domain และให
ผลลพธออกมาใน Spatial domain เชนกน กลาวคอ เราสามารถเขยนสตรในรป
( , ) ( , )g x y T f x y
เมอ f(x y) คอภาพตงตน g(x y) คอภาพผลลพธ เมอ f(x,y) คอภาพตงตน, g(x,y) คอภาพผลลพธ
และ T[ ] คอ Function ทถกกาหนดในพนทรอบๆจด (x,y)
หมายเหต: T[ ] อาจจะรบ input เปนคา pixel ทตาแหนง (x,y) อยางเดยวหรอ input จะเปนคา pixel ใน Neighbors ของจด (x,y) ขนาดใดๆกไดตามแตลกษณะของ Function นนๆเชน
การปรบความสวางของภาพ ม input เปนคาของ pixel (x,y) อยางเดยวการทาภาพเบลอโดยใช smoothing filter ตองใช input จาก pixelหลายๆ pixel รอบๆจด (x,y)
Types of Image Enhancement in the Spatial DomainTypes of Image Enhancement in the Spatial DomainSingle pixel methods- Single pixel methods
- Gray level transformationsExampleExample
- Historgram equalizationContrast stretching- Contrast stretching
- Arithmetic/logic operationsExamplesExamples
- Image subtractionImage averaging- Image averaging
- Multiple pixel methodsExamplesExamples
Spatial filtering Smoothing filters- Smoothing filters
- Sharpening filters
Gray Level TransformationGray Level Transformation
ป ป ป i i ไป ป i i รปแบบ: เปนการแปลง intensity ของภาพตงตนไปเปน intensity ของภาพผลลพธโดยใช function:
( )s T r
โดย r คอ input intensity และ s คอ output intensity
ตวอยาง :ตวอยาง : Contrast enhancementenhancement
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Image NegativeImage NegativeO i i lL 1ขาว
tyOriginaldigital
mammogram
L-1nt
ensi
t
1s L r
utpu
t in
Ou
Negativedigital
ดา0 L-1
digitalmammogram
ดา ขาวInput intensity
L = จานวนระดบของสเทา(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Log TransformationsLog TransformationsApplication
F i
log( 1)s c r
pp
Fourierspectrum
Log Tr. ofFourier
spectrum
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
PowerPower--Law TransformationsLaw Transformations
s cr
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
PowerPower--Law Transformations : Law Transformations : Gamma Correction ApplicationGamma Correction Application
ภาพทอยากภาพทแสดงท
ใหเปนภาพทแสดงท
Monitorโดยตรงโดยตรง
เมอปรบ
Gammai
ภาพทแสดงท
Monitorcorrection ภายหลง
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
PowerPower--Law Transformations : Law Transformations : Gamma Correction ApplicationGamma Correction Application
ภาพ MRI ทผาน
GammaGammaCorrectionโดยใชคา Gammaคาตางๆ
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
PowerPower--Law Transformations : Law Transformations : Gamma Correction ApplicationGamma Correction Application
ภาพถายทางอากาศท
ผาน GammaCorrectionโดยใชคา Gamma คาตางๆ
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Contrast StretchingContrast StretchingBefore contrast
henhancementContrast หมายถงความแตกตางระหวางสทมดทสดในภาพกบสทสวางทสดในภาพ
After
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
How to know where the contrast is enhanced ? How to know where the contrast is enhanced ?
Slope T(r)ดท Slope ของ T(r)- ถา Slope > 1 Contrast เพม- ถา Slope < 1 Contrast ลดลง ถา Slope 1 Contrast ลดลง- ถา Slope = 1 Contrast คงท
ss
r
ไ r แคบๆ ได s กวางๆ แสดงวา
Contrast เพม
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Gray Level SlicingGray Level Slicing
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
BitBit--plane Slicingplane Slicing
Bit 7 Bit 6
Bit
5
Bit
3
B B
Bit 2 Bit 1(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
HistogramHistogram
Histogram หมายถงกราฟแสดงความถของประชากรในชวงตางๆ
10
6
8
4จานวน นศ.
0
2
0
A B+ B C+ C D+ D F
เกรดวชา 178 xxxเกรดวชา 178 xxx
Histogram of an ImageHistogram of an Imageหมายถงเปนกราฟทแสดงจานวน pixel ของส หรอintensity คาตางๆ
( )k kh r n
หมายถงเปนกราฟทแสดงจานวน pixel ของส หรอintensity คาตางๆ
ภาพทมด จะม histogram
( )k k
xel
กองอยไปทางซายจานวน
pix
จ
ภาพทสวาง จะม histogramxel
gกองอยไปทางขวา
จานวน
pix
จ
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram of an Image (cont.)Histogram of an Image (cont.)
ภาพท low contrast จะมภาพท low contrast จะม
histogram กระจกกนอยในชวงแคบๆๆ
hi h t t ภาพท high contrast จะม
histogram กระจายกนอยในชวงกวางๆในชวงกวางๆ
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram ProcessingHistogram Processing
ป ป i t it ป ใ ไ hi t หมายถงกระบวนการปรบปรง intensity ของรปภาพเพอใหได histogram ทมลกษณะตามตองการ
- Histogram equalization
ป ใ hi t เปนการทาให histogram กระจายกนอยางสมาเสมอตลอด
Histogram matching- Histogram matchingเปนการทาให histogram มลกษณะเหมอนกราฟทกาหนดไว
Monotonically Increasing FunctionMonotonically Increasing Function
หมายถง Function ทเมอ r เพมขนแลว T(r) จะมคาเพมขนหรอคงทเทานนไมมการลดลง
Histogram processing จะเปน
)(rTs
Histogram processing จะเปน
function ทมรปแบบดงน
1 เปน Monotonically increasing)( 1. เปน Monotonically increasing function
2. 10for 1)(0 rrT
Probability Density FunctionProbability Density Function
Hi t ใ P b bilit D it F tiHistogram จะมความหมายใกลเคยงกบ Probability Density Function (PDF) ซงแสดงถงคาความหนาแนนของคาของตวแปรคาตางๆ
และใหความสมพนธระหวาง s และ r เปน
ให s และ r เปน Random variables ทม PDF เปน ps(s) และ pr(r ) ตามลาดบ
)(rTs จ ไดวาจะไดวา
dsdrrpsp rs )()(
Histogram EqualizationHistogram Equalization
r
r dwwprTs )()(กาหนดให
0
จะไดวา
1)()()( dsrpdsdrrpsp rrs
drds
11 !1)(
1)()(
1)(
rp
rpdwwpd
rpr
rr
r
r !0
dr
Histogram EqualizationHistogram Equalization
สตรในหนาทแลวใชสาหรบ Continuous PDFสาหรบ Histogram ของ Digital Image จะใชสตรสาหรบ Histogram ของ Digital Image จะใชสตร
k
T )()(
k
jjrkk rprTs
0
)()(
k
j
j
Nn
0
j 0
th b f i l ith i t it jnj = the number of pixels with intensity = jN = the number of total pixels
Histogram Equalization ExampleHistogram Equalization Example
Intensity # pixels Accumulative Sum of Pr
0 20
1 5
20/100 = 0.2
(20+5)/100 = 0.25
2 25
3 10
(20+5+25)/100 = 0.5
(20+5+25+10)/100 = 0.6
4 15
5 5
(20+5+25+10+15)/100 = 0.75
(20+5+25+10+15+5)/100 = 0.8
6 10
7 10
(20+5+25+10+15+5+10)/100 = 0.9
(20+5+25+10+15+5+10+10)/100 = 1.0
Total 100 1.0
Histogram Equalization Example (cont.)Histogram Equalization Example (cont.)
Intensity (r)
No. of Pixels(nj)
Acc Sum of Pr
Output value Quantized Output (s)( ) ( j)
0 20 0.2 0.2x7 = 1.4 1
1 5 0.25 0.25*7 = 1.75 2
2 25 0.5 0.5*7 = 3.5 3
3 10 0 6 0 6*7 = 4 2 43 10 0.6 0.6 7 4.2 4
4 15 0.75 0.75*7 = 5.25 5
5 5 0 8 0 8*7 = 5 6 65 5 0.8 0.8 7 = 5.6 6
6 10 0.9 0.9*7 = 6.3 6
7 10 1 0 1 0 7 7 77 10 1.0 1.0x7 = 7 7
Total 100
Histogram EqualizationHistogram Equalization
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Equalization (cont.)Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Equalization (cont.)Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Equalization (cont.)Histogram Equalization (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Equalization (cont.)Histogram Equalization (cont.)
ภาพตงตน
ภาพหลงทา Histogram Eq.ภาพหลงทา Histogram Eq.ปญหาในขอน: ภาพหลงการทา Histogram equalization กลายเปนภาพ LowContrast ไปContrast ไป
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram MatchingHistogram Matching : Algorithm: Algorithm
เปนการประมวลผลภาพเพอใหได Histogram ของภาพเปนไปตามกราฟทตองการ
หลกการ : จาก Histogram equalization เราม
เปนการประมวลผลภาพเพอใหได Histogram ของภาพเปนไปตามกราฟทตองการ
r
r dwwprTs0
)()(ได ps(s) = 1
0
User ตองการให output image ม PDF เปน pz(z)ใ p ( ) ไ เราสามารถใชสตรเดยวกนนกบ pz(z) จะได
z
z duupzGv )()( ซงจะได ได p (v) = 1 zp0
)()( ซงจะได ได pv(v) 1
เนองจาก p (s) = p (v) = 1 ซงเสมอนวา s กบ v เปนตวแปรเดยวกนเนองจาก ps(s) pv(v) 1 ซงเสมอนวา s กบ v เปนตวแปรเดยวกน
ดงนนเราสามารถแปลง r ไปเปน z ไดจาก r T( ) s G-1( ) z
Histogram Matching : Algorithm (cont.)Histogram Matching : Algorithm (cont.)
T( ) G( )s = T(r) v = G(z)
22
1
z = G-1(v)3
4
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Matching ExampleHistogram Matching Example
Histogram ของ
input image เปนดงนตองการให Histogramของ output image เปนดงนโจทยตวอยาง
Intensity( s )
# pixels Intensity ( z )
# pixels
0 20
1 5
0 5
1 10
U ป 2 25
3 10
2 15
3 20
User เปนผกาหนดขอมลตงตน
4 15
5 5
4 20
5 15
6 10
7 10
6 10
7 5
lTotal 100 Total 100
Histogram Matching Example Histogram Matching Example (cont.)(cont.)
1 Hi t E li ti
r (nj) P s
1. ทา Histogram Equalization ทงสองตาราง
z (nj) P vr (nj) Pr s
0 20 0.2 1
1 5 0 25 2
z (nj) Pz v
0 5 0.05 0
1 10 0 15 11 5 0.25 2
2 25 0.5 3
3 10 0 6 4
1 10 0.15 1
2 15 0.3 2
3 20 0 5 43 10 0.6 4
4 15 0.75 5
5 5 0 8 6
3 20 0.5 4
4 20 0.7 5
5 15 0 85 65 5 0.8 6
6 10 0.9 6
5 15 0.85 6
6 10 0.95 7
7 10 1.0 7 7 5 1.0 7
sk = T(rk) vk = G(zk)k ( k) k ( k)
Histogram Matching Example Histogram Matching Example (cont.)(cont.)2 ไดตาราง Map2. ไดตาราง Map
r s v z ไดเปนActual Output
Histogram
r s
0 1
v z
0 0
s v r z
0 1
z # Pixels
0 0
1 2
2 3
1 1
2 2
1 2
2 2
1 20
2 30
3 4
4 5
4 3
5 4
3 3
4 4
3 10
4 15
5 6
6 6
6 5
7 6
5 5
6 5
5 15
6 106 6
7 7
7 6
7 7 7 6 7 0
sk = T(rk) zk = G-1(vk)
Histogram Matching Example (cont.)Histogram Matching Example (cont.)
Desired histogram
T f f iTransfer function
Actual histogram
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Histogram Matching Example (cont.)Histogram Matching Example (cont.)
After AfterOriginalimage
Afterhistogram
equalization
Afterhistogram matching
Local Enhancement : Local Histogram EqualizationLocal Enhancement : Local Histogram Equalization
Concept: Perform histogram equalization in a small neighborhood
Orignal image After Hist EqAfter Local Hist Eq.I 7 7 i hb h dOrignal image After Hist Eq. In 7x7 neighborhood
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Local Enhancement : Local Enhancement : Histogram Statistic for Image EnhancementHistogram Statistic for Image Enhancement
เราสามารถนาคาทางสถตเชน Mean, Variance ของ Local area มาใชงานได
ภาพไสหลอดไฟถายโดยกลองจลทศนอเลกตรอนภาพไสหลอดไฟถายโดยกลองจลทศนอเลกตรอน
มมขวาลางจะมภาพไสหลอดไฟทอยดานหลง
ซงคอนขางมด
เราตองการเพมความสวางใหใสหลอดดานหลง
ถาปรบความสวางทงภาพ แลวไสหลอดดานหนา
จะสวางเกนไปจะสวางเกนไป
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Local EnhancementLocal Enhancementตวอยางสตร Local enhancement (พเศษเฉพาะงานน) ( )
h i)(
and when),(),( 210
fMkDkMkmyxfE
yxg GsGGs xyxy
otherwise ),(
),(yxf
yg
Original imageLocal Variance
image Multiplication
factor
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Local EnhancementLocal Enhancement
Output image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Logic OperationsLogic Operations
Application:ใชตดพนททสนใจ
ANDใน Image ออกมา
OR
ไ ป ROIkOriginal ไดผลลพธเปน ROI: Region of Interest
Image maskOriginalimage
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Arithmetic Operation: SubtractionArithmetic Operation: Subtraction
Application: Error measurementApplication: Error measurement
ErrorError image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Arithmetic Operation: Subtraction (cont.)Arithmetic Operation: Subtraction (cont.)
Application: Mask mode radiography in angiography workApplication: Mask mode radiography in angiography work
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Arithmetic Operation: Image AveragingArithmetic Operation: Image Averaging
Application : Noise reductionApplication : Noise reduction
Degraded image),(),(),( yxyxfyxg
(noise)Image averagingImage averaging
K
i yxgK
yxg ),(1),(
การทา average จะทาให Variance
iK 1
1
gของ noise ลดลง
),(),( yxyxg K
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Arithmetic Operation: Image Averaging (cont.)Arithmetic Operation: Image Averaging (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Basics of Spatial FilteringBasics of Spatial Filtering
Sometime we need to manipulate values obtained from i hb i i lneighboring pixels
Example: How can we compute an average value of pixelsin a 3x3 region center at a pixel z?
4 1 2 262Pixel z
44 12
2 2643 4
29
676
92
725135
7
54 212735 8222
Image
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
S 1 S l d l d d i lStep 1. Selected only needed pixels
4 1 2 262Pixel z
…
4679
27243 49
74
6793 4
……
6254
5212
1357
6 13
…
35 8222
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
S 2 M l i l i l b 1/9 d h h l
…
Step 2. Multiply every pixel by 1/9 and then sum up the values
4679
3 4
…
676
913
……
…
4914
913
91
y
…
6917
919
91
X1
916
913
91 1 1
1 1111 Mask or
Window or1
11
111
9 Window orTemplate
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
Q ti H t t th 3 3 l t i l ?Question: How to compute the 3x3 average values at every pixels?
4 1 2 262Solution: Imagine that we havea 3x3 window that can be placed
h h i4679
27243 49
7
everywhere on the image
6254
5212
1357
Masking Window
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
Step 1: Move the window to the first location where we want tocompute the average value and then select only pixelsinside the window.
44 12
2 2643 4
29
Step 2: Computethe average value
3 3 1
4 12 3
29
676
92
725135
7
3
1
3
1
),(91
i j
jipy
Sub image p927
6254
5212
1357
Sub image p
Original imageStep 3: Place theresult at the pixel
4.3Original image result at the pixel
in the output imageStep 4: Move the
i d hOutput image
window to the next location and go to Step 2
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
The 3x3 averaging method is one example of the mask operation or Spatial filtering.
The mask operation has the corresponding mask (sometimes p p g (called window or template).
The mask contains coefficients to be multiplied with pixelp pvalues.
Example : moving averagingw(2,1) w(3,1)
w(2,2) w(3,2)
w(1,1)
w(1,2)
1 11 1
111
w(3,3)w(3,2)w(3,1)
k ffi i
1119
Th k f h 3 3 iMask coefficients The mask of the 3x3 moving averagefilter has all coefficients = 1/9
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
The mask operation at each point is performed by:1 Move the reference point (center) of mask to the1. Move the reference point (center) of mask to the
location to be computed 2. Compute sum of products between mask coefficients
and pixels in subimage under the mask.… Mask frame
p(2,1)p(1,1) p(3,1)
…
w(2,1) w(3,1)w(1,1)
p(3,2)p(2,2)
p(2,3)
p(2,1)
p(3,3)p(1,3)
……
w(3,3)
w(2,2)
w(3,2)
w(3,2)w(1,2)
w(3,1)
…Subimage Mask coefficientsN M
N
i
M
j
jipjiwy1 1
),(),(The reference pointof the mask
Basics of Spatial Filtering (cont.)Basics of Spatial Filtering (cont.)
The spatial filtering on the whole image is given by:
1. Move the mask over the image at each location.
2. Compute sum of products between the mask coefficeintsand pixels inside subimage under the mask.
3. Store the results at the corresponding pixels of the output image.
4. Move the mask to the next location and go to step 2until all pixel locations have been used.
Examples of Spatial Filtering Masks
Examples of the masks
Sobel operators
0 1-1 -2 -1-1 1 11
3x3 moving average filter
100
2-2-1 1
02
001 1
11
111
91
101 121
xP compute to
yP compute to
111
x y
3x3 sharpening filter-1 -18 -1
-1-11
-1-1-19
Smoothing Linear Filter : Moving AverageSmoothing Linear Filter : Moving Average
Application : noise reductionand image smoothing
Di d t l h d t ilDisadvantage: lose sharp details
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.g g g
Smoothing Linear Filter (cont.)Smoothing Linear Filter (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
OrderOrder--Statistic FiltersStatistic FiltersOriginal image
subimageOriginal image
Statistic parametersM M di M dMean, Median, Mode, Min, Max, Etc.
Moving windowwindow
Output image
OrderOrder--Statistic Filters: Median FilterStatistic Filters: Median Filter
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Sharpening Spatial FiltersSharpening Spatial Filters
There are intensity discontinuities near object edges in an image
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Laplacian Sharpening : How it worksLaplacian Sharpening : How it works
1Intensity profileEd
0
0.5p(x)Edge
20 40 60 80 100 120 140 160 180 2000.2
1st derivative
0 50 100 150 2000
0.1
dxdp
0 50 100 150 200
0
0.052nd derivative
0 50 100 150 200-0.05
0
2
2
dxpd
0 50 100 150 200
1 5
Laplacian Sharpening : How it works (cont.)Laplacian Sharpening : How it works (cont.)
1
1.5
p(x)
0
0.5p(x)
0 50 100 150 200-0.5
1
1.5
2
)( pd
0
0.5210)(dx
pdxp
0 50 100 150 200-0.5
Laplacian sharpening results in larger intensity discontinuityLaplacian sharpening results in larger intensity discontinuity near the edge.
Laplacian Sharpening : How it works (cont.)Laplacian Sharpening : How it works (cont.)
B f h ip(x)
Before sharpening
2dAfter sharpening
2
2
10)(dx
pdxp
Laplacian MasksLaplacian Masks
Used for estimating image Laplacian2
2
2
22
yP
xPP
-1 -18 1
-11
-1 04 1
01 The center of the mask
-18-1
-1-1-1 0
4-1
-1-10
is positive
1 11 1 00
or
Th t f th k
1-81
111 0
-41
110
The center of the mask is negative
00
Application: Enhance edge, line, pointpp g pDisadvantage: Enhance noise
Laplacian Sharpening ExampleLaplacian Sharpening Example
p P2
P2 PP 2P2 PP 2
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Laplacian Sharpening (cont.)Laplacian Sharpening (cont.)
PP 2Mask for
-1 -19 1
-11
-1 05 1
01 or
-19-1
-1-1-10
5-1
-1-10
orMask for
P2
1 11
P
1-81
111
or1 0-4 1
01
or
041
110
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Unsharp Masking and HighUnsharp Masking and High--Boost FilteringBoost Filtering
-1 -1-1 -1 00
k+8 -1-1 k+4 -1-1
-1-1-1 0-10
Equation:
),(),(
),( 2
2 yxPyxkPyxPhb
The center of the mask is negative
),(),(),( 2 yxPyxkP
yhb The center of the mask is positive
Unsharp Masking and HighUnsharp Masking and High--Boost Filtering (cont.)Boost Filtering (cont.)
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
First Order DerivativeFirst Order Derivative
0.5
1Intensity profile
p(x) Edges
20 40 60 80 100 120 140 160 180 2000
p( ) g
0
0.21st derivativedp
0 50 100 150 200-0.2
2nd deri ati e
dx
0.1
0.22nd derivative
dp
0 50 100 150 2000
dx
First Order Partial Derivative:First Order Partial Derivative:Sobel operatorsSobel operators
0 1-1 -2 -1-1P Ptt
1
0
0
2-2
-1 1
0
2
00
1xPcomputeto y
computeto
PxP
yP
First Order Partial Derivative: Image GradientFirst Order Partial Derivative: Image Gradient
Gradient magnitude22
PPP
Gradient magnitude
yx
A gradient image emphasizes edges(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
First Order Partial Derivative: Image GradientFirst Order Partial Derivative: Image Gradient
PP y
P
xP P
x
Image Enhancement in the Spatial Domain : Image Enhancement in the Spatial Domain : Mix things up !
P2 P2
PDA smoothB D
+ -+
Sharpening EC (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Image Enhancement in the Spatial Domain : Image Enhancement in the Spatial Domain : Mix things up !
G PowerL TEC
G Law Tr.
F
MultiplicationF A
H(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.