SlideShare une entreprise Scribd logo
1  sur  78
 
Prof. Duong Anh Duc
 To process an image so that output is “visually better” than the
input, for a specific application.
 Enhancement is therefore, very much dependent on the particular
problem/image at hand.
 Enhancement can be done in either:
o Spatial domain: operate on the original image
g (m, n) = T [f (m, n)]
o Frequency domain: operate on the DFT of the original image
G (u, v) = T [F (u, v)]
where F(u, v) = F [f(m, n)], and G(u, v) = F [g(m, n)]
2
3
Image Enhancement Techniques
Point Operations Mask Operations Transform Operations Coloring Operations
• Image Negative
• Contrast
Stretching
• Compression of
dynamic range
• Graylevel slicing
• Image
Subtraction
• Image Averaging
• Histogram
operations
• Smoothing
operations
• Median Filtering
• Sharpening
operations
• Derivative
operations
• Histogram
operations
• Low pass
Filtering
• Hi pass Filtering
• Band pass
Filtering
• Homomorphic
Filtering
• Histogram
operations
• False Coloring
• Full color
Processing
4
 Output pixel value g(m, n) at pixel (m, n) depends only on the input
pixel value at f(m, n) at (m, n) (and not on the neighboring pixel
values).
 We normally write s = T(r), where s is the output pixel value and r is
the input pixel value.
 T is any increasing function that maps [0,1] into [0,1].
5
T(r) = s = L – 1 – r, L: max grayvalue
6
 Increase the dynamic range of grayvalues in the input image.
 Suppose you are interested in stretching the input intensity values
in the interval [r1, r2]:
 Note that (r1 – r2) < (s1 – s2). The grayvalues in the range [r1, r2] is
stretched into the range [s1, s2]. 7
8
 Special cases:
o Thresholding or binarization
 r1 = r2 , s1 = 0 and s2 = 1
o Useful when we are only
interested in the shape of the
objects and on their actual
grayvalues.
9
 Special cases (cont.):
o Gamma correction:
s1 = 0, s2 = 1 and
10
2
21
12
1
1
,1
,
,0
rr
rrr
rr
rr
rr
rT
g
11
Gamma correction
 When the dynamic range of the input grayvalues is large
compared to that of the display, we need to “compress” the
grayvalue range --- example: Fourier transform magnitude.
 Typically we use a log scale.
s = T(r) = c log(1+ r )
12
13
Saturn Image Mag. Spectrum Mag. Spectrum
in log scale
 Graylevel Slicing: Highlight a specific range of grayvalues.
14
 Example:
15
Original Image
Highlighted Image (no background)
Highlighted Image (with background)
 Bitplane Slicing: Display the different bits as individual binary
images.
16
17
 In this case, the difference between two “similar” images is
computed to highlight or enhance the differences between them:
g(m, n) = f1(m, n) – f2(m, n)
 It has applications in image segmentation and enhancement
18
19
f1(m, n): Image before dye injection
f2(m, n): Image after dye injection
g(m, n): Image after dye injection,
followed by subtraction
 Noise is any random (unpredictable) phenomenon that
contaminates an image.
 Noise is inherent in most practical systems:
o Image acquisition
o Image transmission
o Image recording
 Noise is typically modeled as an additive process:
g (m,n) = f (m, n) + (m, n)
20
Noisy
Image
Noise-free
Image
Noise
 The noise h(m, n) at each pixel (m, n) is modeled as a random
variable.
 Usually, h(m, n) has zero-mean and the noise values at different
pixels are uncorrelated.
 Suppose we have M observations {gi (m, n)}, i =1, 2, …, M, we
can (partially) mitigate the effect of noise by “averaging”
21
M
i
i nmg
M
nmg
1
,
1
,
 In this case, we can show that:
 Therefore, as the number of observations increases (M ), the
effect of noise tends to zero.
22
nm
M
nmg
nmfnmgE
,Var
1
,Var
,,
23
Noise-free Image Noisy Image
Noise Variance = 0.05
24
M =2 M =5
25
M =10 M =25
26
M =50 M =100
27
 The histogram of a digital image with grayvalues r0, r1, …, rL – 1 is
the discrete function
 The function p(rk) represents the fraction of the total number of
pixels with grayvalue rk.
 Histogram provides a global description of the appearance of the
image.
28
imageinpixels#total
ewith valupixels#
where,
n
rn
n
n
rp kkk
k
 If we consider the grayvalues in the image as realizations of a random
variable R, with some probability density, histogram provides an
approximation to this probability density. In other words,
Pr[R = rk] p(rk)
29
 The shape of a histogram provides useful information for contrast
enhancement.
30
 The shape of a histogram provides useful information for contrast
enhancement.
31
The original image displayed
The stretched image
0 0.5 1
0
5000
10000
The histogram of the original image
0 0.5 1
0
5000
10000
The stretched histogram
32
 Idea: find a non-linear transformation
g = T (f )
to be applied to each pixel of the input image f(x, y), such that a
uniform distribution of gray levels in the entire range results for the
output image g(x, y).
33
 Let us assume for the moment that the input image to be
enhanced has continuous grayvalues, with r = 0 representing black
and r = 1 representing white.
 We need to design a grayvalue transformation s = T(r), based on the
histogram of the input image, which will enhance the image.
 As before, we assume that:
o T(r) is a monotonically increasing function for 0 r 1 (preserves
order from black to white)
o T(r) maps [0,1] into [0,1] (preserves the range of allowed
grayvalues).
34
35
 Let us denote the inverse transformation by r = T – 1(s). We assume
that the inverse transformation also satisfies the above two conditions.
 We consider the grayvalues in the input image and output image
as random variables in the interval [0, 1].
 Let pin(r) and pout(s) denote the probability density of the grayvalues in
the input and output images.
36
 If pin(r) and T(r) are known, and T– 1(s) satisfies condition 1, we can
write (result from probability theory):
 One way to enhance the image is to design a transformation T(.)
such that the grayvalues in the output is uniformly distributed in
[0, 1], i.e.
pout(s)=1, 0 s 1
37
sTr
inout
ds
dr
rpsp
1
 In terms of histograms, the output image will have all grayvalues
in “equal proportion.”
 This technique is called histogram equalization.
 Consider the transformation
38
r
o
rdwwprTs 10,in
 Note that this is the cumulative distribution function (CDF) of pin(r) and
satisfies the previous two conditions.
 From the previous equation and using the fundamental theorem of
calculus,
39
rp
dr
ds
in
 Therefore, the output histogram is given by
 The output probability density function is uniform, regardless of the
input.
40
10for,11
1
1
1
s
rp
rpsp
sTr
sTrin
inout
 Thus, using a transformation function equal to the CDF of input
grayvalues r, we can obtain an image with uniform grayvalues.
 This usually results in an enhanced image, with an increase in the
dynamic range of pixel values.
41
42
Original image pout
after histogram equalization
43
 For images with discrete grayvalues, we have
o L: Total number of graylevels
o nk: Number of pixels with grayvalue rk
o n: Total number of pixels in the image
44
10and,10for,in Lkr
n
n
rp k
k
 The discrete version of the previous transformation based on CDF is
given by:
45
10for,
0
in
0
Lkrp
n
n
rTs
k
i
i
k
i
i
kk
 Consider an 8-level 64 x 64
image with grayvalues
(0, 1, …, 7).
 The normalized grayvalues
are (0, 1/7, 2/7, …, 1). The
normalized histogram is given in
the table:
k rk nk
p(rk)=
nk / n
0 0 790 0.19
1 1/7 1023 0.25
2 2/7 850 0.21
3 3/7 656 0.16
4 4/7 329 0.08
5 5/7 245 0.06
6 6/7 122 0.03
7 1 81 0.02
46
47
 Applying the previous
transformation, we have
(after rounding off to nearest
graylevel):
 Notice that there are only five
distinct graylevels ---
(1/7, 3/7, 5/7, 6/7, 1) in the
output image. We will relabel
them as (s0, s1, …, s4).
48
100.1
198.0
195.0
7
689.0
7
681.0
7
565.0
7
344.0
7
119.0
7in1in0in
7
0
in77
6in1in0in
6
0
in66
5in1in0in
5
0
in55
4in1in0in
4
0
in44
3in1in0in
3
0
in33
2in1in0in
2
0
in22
1in0in
1
0
in11
0in
0
0
in00
rprprprprTs
rprprprprTs
rprprprprTs
rprprprprTs
rprprprprTs
rprprprprTs
rprprprTs
rprprTs
i
i
i
i
i
i
i
i
i
i
i
i
i
i
i
i





 With this transformation, the output image will have histogram
49
k sk nk p(sk)=nk / n
0 1/7 790 0.19
1 3/7 1023 0.25
2 5/7 850 0.21
3 6/7 985 0.24
4 1 448 0.11
50
 Note that the histogram of output image is only approximately, and not
exactly, uniform. This should not be surprising, since there is no result
that claims uniformity in the discrete case.
51
Original image Equalized image
52
Histogram of original image Histogram of equalized image
53
Original image Equalized image
54
Histogram of original image Histogram of equalized image
55
Original image Equalized image
56
Histogram of original image Histogram of equalized image
57
Original image Equalized image
58
Histogram of original image Histogram of equalized image
 Histogram equalization may not always produce desirable results,
particularly if the given histogram is very narrow. It can produce false
edges and regions. It can also increase image “graininess” and
“patchiness.”
59
 Histogram equalization yields an image whose pixels are (in theory)
uniformly distributed among all graylevels.
 Sometimes, this may not be desirable. Instead, we may want a
transformation that yields an output image with a prespecified
histogram. This technique is called histogram specification.
 Again, we will assume, for the moment, continuous grayvalues.
60
 Suppose, the input image has probability density pin(r). We want to
find a transformation z = H(r), such that the probability density of the
new image obtained by this transformation is pout(z), which is not
necessarily uniform.
 First apply the transformation
This gives an image with a uniform probability density.
61
*10,in
r
o
rdwwprTs
 If the desired output image were available, then the following
transformation would generate an image with uniform density:
 From the grayvalues we can obtain the grayvalues z by using the
inverse transformation, z = G– 1( ).
62
**10,out
z
o
zdwwpzG
 If instead of using the grayvalues n obtained from (**), we use the
grayvalues s obtained from (*) above (both are uniformly distributed!),
then the point transformation
z = H(r) = G– 1[T(r)]
will generate an image with the specified density pout(z), from an input
image with density pin(r)
 For discrete graylevels, we have
63
10for,
and10for,
0
out
0
LkzpzG
Lk
n
n
rTs
k
i
ikk
k
i
i
kk
 If the transformation zk G(zk) is one-to-one, the inverse
transformation sk G– 1(sk), can be easily determined, since we are
dealing with a small set of discrete grayvalues.
 In practice, this is not usually the case (i.e., zk G(zk) is not one-to-
one) and we assign grayvalues to match the given histogram, as
closely as possible.
64
 Consider the previous 8-graylevel 64 x 64 image histogram:
65
k rk nk p(rk)=nk/n
0 0 790 0.19
1 1/7 1023 0.25
2 2/7 850 0.21
3 3/7 656 0.16
4 4/7 329 0.08
5 5/7 245 0.06
6 6/7 122 0.03
7 1 81 0.02
 It is desired to transform this image into a new image, using a
transformation z=H(r)= G– 1[T(r)], with histogram as specified below:
66
k zk pout(zk)
0 0 0.00
1 1/7 0.00
2 2/7 0.00
3 3/7 0.15
4 4/7 0.20
5 5/7 0.30
6 6/7 0.20
7 1 0.15
 The transformation T(r) was obtained earlier (reproduced below):
67
ri sk nk p(sk)
r0 s0 = 1/7 790 0.19
r1 s1 = 3/7 1023 0.25
r2 s2 = 5/7 850 0.21
r3,r4 s3 = 6/7 985 0.24
r5, r6,r7 s4=1 448 0.11
 Next we compute the transformation G as before
100.1
7
685.0
7
565.0
7
235.0
7
115.0
000.0
000.0
000.0
7out1out0out
7
0
out77
6out1out0out
6
0
out66
5out1out0out
5
0
out55
4out1out0out
4
0
out44
3out1out0out
3
0
out33
2out1out0out
2
0
out22
1out0out
1
0
out11
0out
0
0
out00
zpzpzpzpzG
zpzpzpzpzG
zpzpzpzpzG
zpzpzpzpzG
zpzpzpzpzG
zpzpzpzpzG
zpzpzpzG
zpzpzG
i
i
i
i
i
i
i
i
i
i
i
i
i
i
i
i





68
 Notice that G is not invertible. But we will do the best possible by
setting
o G– 1 (0) = ? (This does not matter since s 0)
o G– 1 (1/7) = 3/7
o G– 1 (2/7) = 4/7 (This does not matter since s 2/7)
o G– 1 (3/7) = 4/7 (This is not defined, but we use a close match)
o G– 1 (4/7) = ? (This does not matter since s 4/7)
o G– 1 (5/7) = 5/7
o G– 1 (6/7) = 6/7
o G– 1 (1) = 1
69
 Combining the two transformation T and G– 1, we get our required
transformation H
70
r T(r)=s s G–1(s)=z
r G–1
[T(r)]=H(r)=z
r0 = 0 1/7 0 ? r0 = 0 z3= 3/7
r1 = 1/7 3/7 1/7 3/7 r1 = 1/7 z4= 4/7
r2 = 2/7 5/7 2/7 4/7 r2 = 2/7 z5= 5/7
r3 = 3/7 6/7 3/7 4/7 r3 = 3/7 z6= 6/7
r4 = 4/7 6/7 4/7 ? r4 = 4/7 z6= 6/7
r5 = 5/7 1 5/7 5/7 r5 = 5/7 z7= 1
r6 = 6/7 1 6/7 6/7 r6 = 6/7 z7= 1
r7 = 1 1 1 1 r7 = 1 z7= 1
 Applying the transformation H to the original image yields an image
with histogram as below:
71
k zk nk
nk/n
(actual hist.)
pout(zk)
(spec. hist.)
0 0 0 0.00 0.00
1 1/7 0 0.00 0.00
2 2/7 0 0.00 0.00
3 3/7 790 0.19 0.15
4 4/7 1023 0.25 0.20
5 5/7 850 0.21 0.30
6 6/7 985 0.24 0.20
7 1 448 0.11 0.15
72
 Again, the actual histogram of the output image does not exactly but
only approximately matches with the specified histogram. This is
because we are dealing with discrete histograms.
73
74
Original image and its histogram
75
Histogram equalized image Actual histogram of output
76Histogram specified image, Actual Histogram, and Specified Histogram
 Used to enhance details over small portions of the image.
 Define a square or rectangular neighborhood, whose center moves
from pixel to pixel.
 Compute local histogram based on the chosen neighborhood for
each point and apply a histogram equalization or histogram
specification transformation to the center pixel.
 Non-overlapping neighborhoods can also be used to reduce
computations. But this usually results in some artifacts
(checkerboard like pattern).
77
 Another use of histogram information in image enhancement is the
statistical moments associated with the histogram (recall that the
histogram can be thought of as a probability density function).
 For example, we can use the local mean and variance to
determine the local brightness/contrast of a pixel. This information
can then be used to determine what, if any transformation to apply
to that pixel.
 Note that local histogram based operations are non-uniform in the
sense that a different transformation is applied to each pixel.
78

Contenu connexe

Tendances

Log Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleLog Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleMustak Ahmmed
 
Introduction to Image Processing
Introduction to Image ProcessingIntroduction to Image Processing
Introduction to Image ProcessingIsrael Gbati
 
6 spatial filtering p2
6 spatial filtering p26 spatial filtering p2
6 spatial filtering p2Gichelle Amon
 
Digital signal processing on arm new
Digital signal processing on arm newDigital signal processing on arm new
Digital signal processing on arm newIsrael Gbati
 
CS 354 Pixel Updating
CS 354 Pixel UpdatingCS 354 Pixel Updating
CS 354 Pixel UpdatingMark Kilgard
 
Frequency Domain Filtering of Digital Images
Frequency Domain Filtering of Digital ImagesFrequency Domain Filtering of Digital Images
Frequency Domain Filtering of Digital ImagesUpendra Pratap Singh
 
Chapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image TransformationChapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image TransformationVarun Ojha
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationVarun Ojha
 
CS 354 Graphics Math
CS 354 Graphics MathCS 354 Graphics Math
CS 354 Graphics MathMark Kilgard
 
Simple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commandsSimple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commandsLakshmi Sarvani Videla
 
Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)Yan Xu
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingMark Kilgard
 
Image formation
Image formationImage formation
Image formationpotaters
 
Computer vision 3 4
Computer vision 3 4Computer vision 3 4
Computer vision 3 4sachinmore76
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysislalitxp
 

Tendances (20)

Log Transformation in Image Processing with Example
Log Transformation in Image Processing with ExampleLog Transformation in Image Processing with Example
Log Transformation in Image Processing with Example
 
Introduction to Image Processing
Introduction to Image ProcessingIntroduction to Image Processing
Introduction to Image Processing
 
6 spatial filtering p2
6 spatial filtering p26 spatial filtering p2
6 spatial filtering p2
 
Digital signal processing on arm new
Digital signal processing on arm newDigital signal processing on arm new
Digital signal processing on arm new
 
CS 354 Pixel Updating
CS 354 Pixel UpdatingCS 354 Pixel Updating
CS 354 Pixel Updating
 
Lect5 v2
Lect5 v2Lect5 v2
Lect5 v2
 
Frequency Domain Filtering of Digital Images
Frequency Domain Filtering of Digital ImagesFrequency Domain Filtering of Digital Images
Frequency Domain Filtering of Digital Images
 
Chapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image TransformationChapter 4 Image Processing: Image Transformation
Chapter 4 Image Processing: Image Transformation
 
CS 354 Lighting
CS 354 LightingCS 354 Lighting
CS 354 Lighting
 
Chapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel RelationChapter 2 Image Processing: Pixel Relation
Chapter 2 Image Processing: Pixel Relation
 
CS 354 Graphics Math
CS 354 Graphics MathCS 354 Graphics Math
CS 354 Graphics Math
 
Simple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commandsSimple Matlab tutorial using matlab inbuilt commands
Simple Matlab tutorial using matlab inbuilt commands
 
Dip Morphological
Dip MorphologicalDip Morphological
Dip Morphological
 
Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)Snakes in Images (Active contour tutorial)
Snakes in Images (Active contour tutorial)
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Image formation
Image formationImage formation
Image formation
 
Computer vision 3 4
Computer vision 3 4Computer vision 3 4
Computer vision 3 4
 
Before quiz 2
Before quiz 2Before quiz 2
Before quiz 2
 
Image Texture Analysis
Image Texture AnalysisImage Texture Analysis
Image Texture Analysis
 
Nabaa
NabaaNabaa
Nabaa
 

Similaire à Dip3

Image_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxImage_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxMayuri Narkhede
 
Histogram based enhancement
Histogram based enhancementHistogram based enhancement
Histogram based enhancementliba manopriya.J
 
Histogram based Enhancement
Histogram based Enhancement Histogram based Enhancement
Histogram based Enhancement Vivek V
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfnagwaAboElenein
 
Chapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementChapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementVarun Ojha
 
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 processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit NotesAAKANKSHA JAIN
 
Lec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfLec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfnagwaAboElenein
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slidesBHAGYAPRASADBUGGE
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portionMoe Moe Myint
 
Intensity Transformation and Spatial filtering
Intensity Transformation and Spatial filteringIntensity Transformation and Spatial filtering
Intensity Transformation and Spatial filteringShajun Nisha
 
Image-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdfImage-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdfASMZahidKausar
 
Image processing
Image processingImage processing
Image processingmaheshpene
 

Similaire à Dip3 (20)

Image_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptxImage_processing_unit2_SPPU_Syllabus.pptx
Image_processing_unit2_SPPU_Syllabus.pptx
 
Histogram based enhancement
Histogram based enhancementHistogram based enhancement
Histogram based enhancement
 
Histogram based Enhancement
Histogram based Enhancement Histogram based Enhancement
Histogram based Enhancement
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
3rd unit.pptx
3rd unit.pptx3rd unit.pptx
3rd unit.pptx
 
Module 2
Module 2Module 2
Module 2
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdf
 
Chapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementChapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image Enhancement
 
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
 
Lec-04 Image Enhancement II.ppt
Lec-04 Image Enhancement II.pptLec-04 Image Enhancement II.ppt
Lec-04 Image Enhancement II.ppt
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit Notes
 
Lec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdfLec_3_Image Enhancement_spatial Domain.pdf
Lec_3_Image Enhancement_spatial Domain.pdf
 
3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides3 intensity transformations and spatial filtering slides
3 intensity transformations and spatial filtering slides
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Lect 03 - first portion
Lect 03 - first portionLect 03 - first portion
Lect 03 - first portion
 
DIP Lecture 7-9.pdf
DIP Lecture 7-9.pdfDIP Lecture 7-9.pdf
DIP Lecture 7-9.pdf
 
Intensity Transformation and Spatial filtering
Intensity Transformation and Spatial filteringIntensity Transformation and Spatial filtering
Intensity Transformation and Spatial filtering
 
Image-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdfImage-Processing-ch3-part-3.pdf
Image-Processing-ch3-part-3.pdf
 
Image processing
Image processingImage processing
Image processing
 

Dernier

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Dernier (20)

HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

Dip3

  • 2.  To process an image so that output is “visually better” than the input, for a specific application.  Enhancement is therefore, very much dependent on the particular problem/image at hand.  Enhancement can be done in either: o Spatial domain: operate on the original image g (m, n) = T [f (m, n)] o Frequency domain: operate on the DFT of the original image G (u, v) = T [F (u, v)] where F(u, v) = F [f(m, n)], and G(u, v) = F [g(m, n)] 2
  • 3. 3 Image Enhancement Techniques Point Operations Mask Operations Transform Operations Coloring Operations • Image Negative • Contrast Stretching • Compression of dynamic range • Graylevel slicing • Image Subtraction • Image Averaging • Histogram operations • Smoothing operations • Median Filtering • Sharpening operations • Derivative operations • Histogram operations • Low pass Filtering • Hi pass Filtering • Band pass Filtering • Homomorphic Filtering • Histogram operations • False Coloring • Full color Processing
  • 4. 4  Output pixel value g(m, n) at pixel (m, n) depends only on the input pixel value at f(m, n) at (m, n) (and not on the neighboring pixel values).  We normally write s = T(r), where s is the output pixel value and r is the input pixel value.  T is any increasing function that maps [0,1] into [0,1].
  • 5. 5 T(r) = s = L – 1 – r, L: max grayvalue
  • 6. 6
  • 7.  Increase the dynamic range of grayvalues in the input image.  Suppose you are interested in stretching the input intensity values in the interval [r1, r2]:  Note that (r1 – r2) < (s1 – s2). The grayvalues in the range [r1, r2] is stretched into the range [s1, s2]. 7
  • 8. 8  Special cases: o Thresholding or binarization  r1 = r2 , s1 = 0 and s2 = 1 o Useful when we are only interested in the shape of the objects and on their actual grayvalues.
  • 9. 9
  • 10.  Special cases (cont.): o Gamma correction: s1 = 0, s2 = 1 and 10 2 21 12 1 1 ,1 , ,0 rr rrr rr rr rr rT g
  • 12.  When the dynamic range of the input grayvalues is large compared to that of the display, we need to “compress” the grayvalue range --- example: Fourier transform magnitude.  Typically we use a log scale. s = T(r) = c log(1+ r ) 12
  • 13. 13 Saturn Image Mag. Spectrum Mag. Spectrum in log scale
  • 14.  Graylevel Slicing: Highlight a specific range of grayvalues. 14
  • 15.  Example: 15 Original Image Highlighted Image (no background) Highlighted Image (with background)
  • 16.  Bitplane Slicing: Display the different bits as individual binary images. 16
  • 17. 17
  • 18.  In this case, the difference between two “similar” images is computed to highlight or enhance the differences between them: g(m, n) = f1(m, n) – f2(m, n)  It has applications in image segmentation and enhancement 18
  • 19. 19 f1(m, n): Image before dye injection f2(m, n): Image after dye injection g(m, n): Image after dye injection, followed by subtraction
  • 20.  Noise is any random (unpredictable) phenomenon that contaminates an image.  Noise is inherent in most practical systems: o Image acquisition o Image transmission o Image recording  Noise is typically modeled as an additive process: g (m,n) = f (m, n) + (m, n) 20 Noisy Image Noise-free Image Noise
  • 21.  The noise h(m, n) at each pixel (m, n) is modeled as a random variable.  Usually, h(m, n) has zero-mean and the noise values at different pixels are uncorrelated.  Suppose we have M observations {gi (m, n)}, i =1, 2, …, M, we can (partially) mitigate the effect of noise by “averaging” 21 M i i nmg M nmg 1 , 1 ,
  • 22.  In this case, we can show that:  Therefore, as the number of observations increases (M ), the effect of noise tends to zero. 22 nm M nmg nmfnmgE ,Var 1 ,Var ,,
  • 23. 23 Noise-free Image Noisy Image Noise Variance = 0.05
  • 24. 24 M =2 M =5
  • 25. 25 M =10 M =25
  • 26. 26 M =50 M =100
  • 27. 27
  • 28.  The histogram of a digital image with grayvalues r0, r1, …, rL – 1 is the discrete function  The function p(rk) represents the fraction of the total number of pixels with grayvalue rk.  Histogram provides a global description of the appearance of the image. 28 imageinpixels#total ewith valupixels# where, n rn n n rp kkk k
  • 29.  If we consider the grayvalues in the image as realizations of a random variable R, with some probability density, histogram provides an approximation to this probability density. In other words, Pr[R = rk] p(rk) 29
  • 30.  The shape of a histogram provides useful information for contrast enhancement. 30
  • 31.  The shape of a histogram provides useful information for contrast enhancement. 31
  • 32. The original image displayed The stretched image 0 0.5 1 0 5000 10000 The histogram of the original image 0 0.5 1 0 5000 10000 The stretched histogram 32
  • 33.  Idea: find a non-linear transformation g = T (f ) to be applied to each pixel of the input image f(x, y), such that a uniform distribution of gray levels in the entire range results for the output image g(x, y). 33
  • 34.  Let us assume for the moment that the input image to be enhanced has continuous grayvalues, with r = 0 representing black and r = 1 representing white.  We need to design a grayvalue transformation s = T(r), based on the histogram of the input image, which will enhance the image.  As before, we assume that: o T(r) is a monotonically increasing function for 0 r 1 (preserves order from black to white) o T(r) maps [0,1] into [0,1] (preserves the range of allowed grayvalues). 34
  • 35. 35
  • 36.  Let us denote the inverse transformation by r = T – 1(s). We assume that the inverse transformation also satisfies the above two conditions.  We consider the grayvalues in the input image and output image as random variables in the interval [0, 1].  Let pin(r) and pout(s) denote the probability density of the grayvalues in the input and output images. 36
  • 37.  If pin(r) and T(r) are known, and T– 1(s) satisfies condition 1, we can write (result from probability theory):  One way to enhance the image is to design a transformation T(.) such that the grayvalues in the output is uniformly distributed in [0, 1], i.e. pout(s)=1, 0 s 1 37 sTr inout ds dr rpsp 1
  • 38.  In terms of histograms, the output image will have all grayvalues in “equal proportion.”  This technique is called histogram equalization.  Consider the transformation 38 r o rdwwprTs 10,in
  • 39.  Note that this is the cumulative distribution function (CDF) of pin(r) and satisfies the previous two conditions.  From the previous equation and using the fundamental theorem of calculus, 39 rp dr ds in
  • 40.  Therefore, the output histogram is given by  The output probability density function is uniform, regardless of the input. 40 10for,11 1 1 1 s rp rpsp sTr sTrin inout
  • 41.  Thus, using a transformation function equal to the CDF of input grayvalues r, we can obtain an image with uniform grayvalues.  This usually results in an enhanced image, with an increase in the dynamic range of pixel values. 41
  • 42. 42 Original image pout after histogram equalization
  • 43. 43
  • 44.  For images with discrete grayvalues, we have o L: Total number of graylevels o nk: Number of pixels with grayvalue rk o n: Total number of pixels in the image 44 10and,10for,in Lkr n n rp k k
  • 45.  The discrete version of the previous transformation based on CDF is given by: 45 10for, 0 in 0 Lkrp n n rTs k i i k i i kk
  • 46.  Consider an 8-level 64 x 64 image with grayvalues (0, 1, …, 7).  The normalized grayvalues are (0, 1/7, 2/7, …, 1). The normalized histogram is given in the table: k rk nk p(rk)= nk / n 0 0 790 0.19 1 1/7 1023 0.25 2 2/7 850 0.21 3 3/7 656 0.16 4 4/7 329 0.08 5 5/7 245 0.06 6 6/7 122 0.03 7 1 81 0.02 46
  • 47. 47
  • 48.  Applying the previous transformation, we have (after rounding off to nearest graylevel):  Notice that there are only five distinct graylevels --- (1/7, 3/7, 5/7, 6/7, 1) in the output image. We will relabel them as (s0, s1, …, s4). 48 100.1 198.0 195.0 7 689.0 7 681.0 7 565.0 7 344.0 7 119.0 7in1in0in 7 0 in77 6in1in0in 6 0 in66 5in1in0in 5 0 in55 4in1in0in 4 0 in44 3in1in0in 3 0 in33 2in1in0in 2 0 in22 1in0in 1 0 in11 0in 0 0 in00 rprprprprTs rprprprprTs rprprprprTs rprprprprTs rprprprprTs rprprprprTs rprprprTs rprprTs i i i i i i i i i i i i i i i i     
  • 49.  With this transformation, the output image will have histogram 49 k sk nk p(sk)=nk / n 0 1/7 790 0.19 1 3/7 1023 0.25 2 5/7 850 0.21 3 6/7 985 0.24 4 1 448 0.11
  • 50. 50  Note that the histogram of output image is only approximately, and not exactly, uniform. This should not be surprising, since there is no result that claims uniformity in the discrete case.
  • 52. 52 Histogram of original image Histogram of equalized image
  • 54. 54 Histogram of original image Histogram of equalized image
  • 56. 56 Histogram of original image Histogram of equalized image
  • 58. 58 Histogram of original image Histogram of equalized image
  • 59.  Histogram equalization may not always produce desirable results, particularly if the given histogram is very narrow. It can produce false edges and regions. It can also increase image “graininess” and “patchiness.” 59
  • 60.  Histogram equalization yields an image whose pixels are (in theory) uniformly distributed among all graylevels.  Sometimes, this may not be desirable. Instead, we may want a transformation that yields an output image with a prespecified histogram. This technique is called histogram specification.  Again, we will assume, for the moment, continuous grayvalues. 60
  • 61.  Suppose, the input image has probability density pin(r). We want to find a transformation z = H(r), such that the probability density of the new image obtained by this transformation is pout(z), which is not necessarily uniform.  First apply the transformation This gives an image with a uniform probability density. 61 *10,in r o rdwwprTs
  • 62.  If the desired output image were available, then the following transformation would generate an image with uniform density:  From the grayvalues we can obtain the grayvalues z by using the inverse transformation, z = G– 1( ). 62 **10,out z o zdwwpzG
  • 63.  If instead of using the grayvalues n obtained from (**), we use the grayvalues s obtained from (*) above (both are uniformly distributed!), then the point transformation z = H(r) = G– 1[T(r)] will generate an image with the specified density pout(z), from an input image with density pin(r)  For discrete graylevels, we have 63 10for, and10for, 0 out 0 LkzpzG Lk n n rTs k i ikk k i i kk
  • 64.  If the transformation zk G(zk) is one-to-one, the inverse transformation sk G– 1(sk), can be easily determined, since we are dealing with a small set of discrete grayvalues.  In practice, this is not usually the case (i.e., zk G(zk) is not one-to- one) and we assign grayvalues to match the given histogram, as closely as possible. 64
  • 65.  Consider the previous 8-graylevel 64 x 64 image histogram: 65 k rk nk p(rk)=nk/n 0 0 790 0.19 1 1/7 1023 0.25 2 2/7 850 0.21 3 3/7 656 0.16 4 4/7 329 0.08 5 5/7 245 0.06 6 6/7 122 0.03 7 1 81 0.02
  • 66.  It is desired to transform this image into a new image, using a transformation z=H(r)= G– 1[T(r)], with histogram as specified below: 66 k zk pout(zk) 0 0 0.00 1 1/7 0.00 2 2/7 0.00 3 3/7 0.15 4 4/7 0.20 5 5/7 0.30 6 6/7 0.20 7 1 0.15
  • 67.  The transformation T(r) was obtained earlier (reproduced below): 67 ri sk nk p(sk) r0 s0 = 1/7 790 0.19 r1 s1 = 3/7 1023 0.25 r2 s2 = 5/7 850 0.21 r3,r4 s3 = 6/7 985 0.24 r5, r6,r7 s4=1 448 0.11
  • 68.  Next we compute the transformation G as before 100.1 7 685.0 7 565.0 7 235.0 7 115.0 000.0 000.0 000.0 7out1out0out 7 0 out77 6out1out0out 6 0 out66 5out1out0out 5 0 out55 4out1out0out 4 0 out44 3out1out0out 3 0 out33 2out1out0out 2 0 out22 1out0out 1 0 out11 0out 0 0 out00 zpzpzpzpzG zpzpzpzpzG zpzpzpzpzG zpzpzpzpzG zpzpzpzpzG zpzpzpzpzG zpzpzpzG zpzpzG i i i i i i i i i i i i i i i i      68
  • 69.  Notice that G is not invertible. But we will do the best possible by setting o G– 1 (0) = ? (This does not matter since s 0) o G– 1 (1/7) = 3/7 o G– 1 (2/7) = 4/7 (This does not matter since s 2/7) o G– 1 (3/7) = 4/7 (This is not defined, but we use a close match) o G– 1 (4/7) = ? (This does not matter since s 4/7) o G– 1 (5/7) = 5/7 o G– 1 (6/7) = 6/7 o G– 1 (1) = 1 69
  • 70.  Combining the two transformation T and G– 1, we get our required transformation H 70 r T(r)=s s G–1(s)=z r G–1 [T(r)]=H(r)=z r0 = 0 1/7 0 ? r0 = 0 z3= 3/7 r1 = 1/7 3/7 1/7 3/7 r1 = 1/7 z4= 4/7 r2 = 2/7 5/7 2/7 4/7 r2 = 2/7 z5= 5/7 r3 = 3/7 6/7 3/7 4/7 r3 = 3/7 z6= 6/7 r4 = 4/7 6/7 4/7 ? r4 = 4/7 z6= 6/7 r5 = 5/7 1 5/7 5/7 r5 = 5/7 z7= 1 r6 = 6/7 1 6/7 6/7 r6 = 6/7 z7= 1 r7 = 1 1 1 1 r7 = 1 z7= 1
  • 71.  Applying the transformation H to the original image yields an image with histogram as below: 71 k zk nk nk/n (actual hist.) pout(zk) (spec. hist.) 0 0 0 0.00 0.00 1 1/7 0 0.00 0.00 2 2/7 0 0.00 0.00 3 3/7 790 0.19 0.15 4 4/7 1023 0.25 0.20 5 5/7 850 0.21 0.30 6 6/7 985 0.24 0.20 7 1 448 0.11 0.15
  • 72. 72
  • 73.  Again, the actual histogram of the output image does not exactly but only approximately matches with the specified histogram. This is because we are dealing with discrete histograms. 73
  • 74. 74 Original image and its histogram
  • 75. 75 Histogram equalized image Actual histogram of output
  • 76. 76Histogram specified image, Actual Histogram, and Specified Histogram
  • 77.  Used to enhance details over small portions of the image.  Define a square or rectangular neighborhood, whose center moves from pixel to pixel.  Compute local histogram based on the chosen neighborhood for each point and apply a histogram equalization or histogram specification transformation to the center pixel.  Non-overlapping neighborhoods can also be used to reduce computations. But this usually results in some artifacts (checkerboard like pattern). 77
  • 78.  Another use of histogram information in image enhancement is the statistical moments associated with the histogram (recall that the histogram can be thought of as a probability density function).  For example, we can use the local mean and variance to determine the local brightness/contrast of a pixel. This information can then be used to determine what, if any transformation to apply to that pixel.  Note that local histogram based operations are non-uniform in the sense that a different transformation is applied to each pixel. 78