Lect 02 second portion
-
Upload
moe-moe-myint -
Category
Engineering
-
view
19 -
download
0
Transcript of Lect 02 second portion
DIGITAL IMAGE PROCESSING (2ND EDITION)
RAFAEL C. GONZALEZRICHARD E.WOODS
Dr Moe Moe Myint(Assistant Lecturer)Technological University (Kyaukse)
2
MISCELLANEA Lectures: A
Monday 1:00 – 3:00 Tuesday 2:00 – 4:00
Lectures: B Monday 8:00 – 10:00 Wednesday 1:00 – 3:00
Slideshare: www.slideshare.net/MoeMoeMyint E-mail: [email protected] Blog: drmoemoemyint.blogspot.com
3
CONTENTS FOR CHAPTER 2
2.1 Elements of Visual Perception2.2 Light and the Electromagnetic Spectrum2.3 Image Sensing and Acquisition2.4 Image Sampling and Quantization2.5 Some Basic Relationships Between Pixels2.6 Linear and Nonlinear Operations
4
Digital Image
Digital image = a multidimensionalarray of numbers (such as intensity image) or vectors (such as color image)
Each component in the imagecalled pixel associates withthe pixel value (a single number in the case of intensity images or a vector in the case of color images).
398715322213251537266928161010
39656554424754216796543243567065
99876532924385856796906078567099
5
2.3 IMAGE SENSING AND ACQUISITION
Image Sensingo Scene
o Moleculeso Human Brainso …
o Illuminationo Radaro Infraredo X-rayo Sun o …
o Reflection
6
CONT’D
Single imaging Sensor
Line Sensor
Array Sensor
7
IMAGE ACQUISITION USING A SINGLE SENSOR
The most familiar sensor of this type is the photodiodeIt is constructed of silicon materials and whose output voltage waveform is proportional to light. The use of a filter in front of a sensor improves selectivity. For example, a green (pass) filter in front of a light sensor favors light in the green band of the color spectrum.As a consequence, the sensor output will be stronger for green light than for other components in the visible spectrum.
8
IMAGE ACQUISITION USING SENSOR STRIPS
9
Image Acquisition Using Sensor Strip
10
IMAGE ACQUISITION USING SENSOR ARRAYS
11
CCD KAF-3200E from Kodak.(2184 x 1472 pixels,
Pixel size 6.8 microns2)
Charge-Coupled Device (CCD)
w Used for convert a continuous image into a digital image
w Contains an array of light sensors
w Converts photon into electric chargesaccumulated in each sensor unit
Image Sensors : Array Sensor
12
A SIMPLE IMAGE FORMATION MODEL
f(x,y) = i(x,y) r(x,y)0 < i(x,y) < 0 < r(x,y) < 1(from total absorption to total reflectance)
Sample values of r(x,y):
0.01: black velvet0.93: snow
Intensity of a monochrome image f at (x0,y0): gray level l of the image at that pointl=f(x0, y0)Lmin ≤ l ≤ Lmax
Where:Lmin: PositiveLmax: Finite
In practice:Lmin = Imin rmin Lmax = Imax rmax
e.g. for indoor image processing:Lmin ≈ 10Lmax ≈ 1000
[Lmin, Lmax] : gray scaleOften shifted to [0,L-1] l=0: black
l=L-1: whiteAll intermediate values are shades of gray
13
CONT’D
14
2.4 Image Sampling and Quantization
• The output of most sensors is continuous in amplitude and spatial coordinates.
• Converting an analog image to a digital image require sampling and quantization
• Sampling: is digitizing the coordinate values
• Quantization: is digitizing the amplitude values
15
SAMPLING & QUANTIZATION The spatial and amplitude digitization of
f(x,y) is called:
image sampling when it refers to spatial coordinates (x,y) and
gray-level quantization when it refers to the amplitude.
16
Image Sampling and Quantization
Spatial sampling is accomplished by sensorarrangement and mechanical movement.
17
IMAGE SAMPLING AND QUANTISATIONA digital sensor can only measure a limited number of samples at a discrete set of energy levelsQuantisation is the process of converting a continuous analogue signal into a digital representation of this signal
18
IMAGE SAMPLING AND QUANTISATION
19
IMAGE SAMPLING AND QUANTISATION
20
IMAGE SAMPLING AND QUANTISATION (CONT…)Remember that a digital image is always only an approximation of a real world scene
21
original Sampled by 2 Sampled by 4
Sampled by 8 Sampled by 16
22
UNIFORM QUANTIZATION Digitized in amplitude (or pixel value) PGM – 256 levels 4 levels
0
255
64
128
192
0
3
1
2
23
original 128 levels (7 bits) 16 levels (4 bits)
4 levels (2 bits) 2 levels (1 bit)
24
Representing Digital Images
25
Image “After snow storm”
Fundamentals of Digital Images
f(x,y)
x
y
w An image: a multidimensional function of spatial coordinates.w Spatial coordinate: (x,y) for 2D case such as photograph,
(x,y,z) for 3D case such as CT scan images (x,y,t) for movies
w The function f may represent intensity (for monochrome images) or color (for color images) or other associated values.
Origin
26
REPRESENTING DIGITAL IMAGES
0 ai,j L-1 Where L = 2k
The dynamic range of an image is the range of values spanned by the gray scale.
The number, b, of bits required to store a digitized image of size M by N is
b = M N k
The pixel intensity levels (gray scale levels) are in the interval of [0, L-1].
27
77 66 68 67 98 93 79 8179 61 61 71 61 78 88 9479 93 84 64 72 76 95 9497 65 71 75 75 72 95 111120 81 82 76 72 77 78 83150 146 112 83 78 62 91 85156 145 158 125 107 121 95 86158 166 147 146 153 149 129 107
Elaine image of size 512 by 512 pixels (5 by 5 inches), The dynamic range is [0, 255].
Find the following:• The number of bits required to represent a pixel• The size of the image in bits?
Representing Digital Images
28
Representing Digital Images
29
Digital Image Types : Intensity Image
Intensity image or monochrome image each pixel corresponds to light intensitynormally represented in gray scale (gray level).
398715322213251537266928161010
Gray scale values
30
398715322213251537266928161010
39656554424754216796543243567065
99876532924385856796906078567099
Digital Image Types : RGB Image
Color image or RGB image:each pixel contains a vectorrepresenting red, green andblue components.
RGB components
31
Image Types : Binary Image
Binary image or black and white imageEach pixel contains one bit :
1 represent white0 represents black
1111111100000000
Binary data
32
Image Types : Index Image
Index imageEach pixel contains index numberpointing to a color in a color table
256746941
Index value
Index No.
Redcomponent
Greencomponent
Bluecomponent
1 0.1 0.5 0.32 1.0 0.0 0.03 0.0 1.0 0.04 0.5 0.5 0.55 0.2 0.8 0.9
… … … …
Color Table
33
Effect of Spatial Resolution
256x256 pixels
64x64 pixels
128x128 pixels
32x32 pixels
34
SPATIAL RESOLUTIONThe spatial resolution of an image is determined by how sampling was carried outSpatial resolution simply refers to the smallest discernable detail in an image
Vision specialists will often talk about pixel size
Graphic designers will talk about dots per inch (DPI)
5.1
Megapixels
35
Effect of Spatial Resolution
36
SPATIAL RESOLUTION (CONT…)
37
SPATIAL RESOLUTION (CONT…)
38
SPATIAL RESOLUTION (CONT…)
39
SPATIAL RESOLUTION (CONT…)
40
SPATIAL RESOLUTION (CONT…)
41
SPATIAL RESOLUTION (CONT…)
42
INTENSITY LEVEL RESOLUTIONIntensity level resolution refers to the number of intensity levels used to represent the image
The more intensity levels used, the finer the level of detail discernable in an image
Intensity level resolution is usually given in terms of the number of bits used to store each intensity level
Number of Bits Number of Intensity Levels Examples
1 2 0, 12 4 00, 01, 10, 114 16 0000, 0101, 11118 256 00110011,
0101010116 65,536 1010101010101010
43
INTENSITY LEVEL RESOLUTION (CONT…)
128 grey levels (7 bpp) 64 grey levels (6 bpp) 32 grey levels (5 bpp)
16 grey levels (4 bpp) 8 grey levels (3 bpp) 4 grey levels (2 bpp) 2 grey levels (1 bpp)
256 grey levels (8 bits per pixel)
44
INTENSITY LEVEL RESOLUTION (CONT…)
45
INTENSITY LEVEL RESOLUTION (CONT…)
46
INTENSITY LEVEL RESOLUTION (CONT…)
47
INTENSITY LEVEL RESOLUTION (CONT…)
48
INTENSITY LEVEL RESOLUTION (CONT…)
49
INTENSITY LEVEL RESOLUTION (CONT…)
50
INTENSITY LEVEL RESOLUTION (CONT…)
51
INTENSITY LEVEL RESOLUTION (CONT…)
52
SATURATION & NOISE
53
RESOLUTION: HOW MUCH IS ENOUGH?The big question with resolution is always how much is enough?
This all depends on what is in the image and what you would like to do with it
Key questions include Does the image look aesthetically pleasing? Can you see what you need to see within the image?
54
RESOLUTION: HOW MUCH IS ENOUGH? (CONT…)
The picture on the right is fine for counting the number of cars, but not for reading the number plate
55
INTENSITY LEVEL RESOLUTION (CONT…)
Low Detail Medium Detail High Detail
56
INTENSITY LEVEL RESOLUTION (CONT…)
57
INTENSITY LEVEL RESOLUTION (CONT…)
58
INTENSITY LEVEL RESOLUTION (CONT…)
59
Basic Relationship of Pixels
x
y
(0,0)
Conventional indexing method
(x,y) (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
60
Neighbors of a Pixel
p (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
4-neighbors of p:
N4(p) =
(x-1,y)(x+1,y)(x,y-1)(x,y+1)
Neighborhood relation is used to tell adjacent pixels. It is useful for analyzing regions.
Note: q Î N4(p) implies p Î N4(q)
4-neighborhood relation considers only vertical and horizontal neighbors.
61
p (x+1,y)(x-1,y)
(x,y-1)
(x,y+1)
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
CONT’D
8-neighbors of p:
(x-1,y-1)(x,y-1)
(x+1,y-1)(x-1,y)(x+1,y)
(x-1,y+1)(x,y+1)
(x+1,y+1)
N8(p) =
8-neighborhood relation considers all neighbor pixels.
62
p
(x+1,y-1)(x-1,y-1)
(x-1,y+1) (x+1,y+1)
Diagonal neighbors of p:
ND(p) =
(x-1,y-1)(x+1,y-1)(x-1,y+1)
(x+1,y+1)
Diagonal -neighborhood relation considers only diagonalneighbor pixels.
CONT’D
63
If pixel p at location (x,y) then its neighbors are: • 4-neighbors N4(p) (x-1 , y), (x+1 , y), (x , y-1), (x , y+1)
• 4-diagonal neighbors ND(p)(x-1 , y-1), (x-1 , y+1), (x+1 , y+1), (x+1 , y-1)
• 8-neighbors N8(p)All pixels in N4(p) and in ND(p)
2.5 Some Basic Relationship Between Pixels
64
Three type of adjacency:(a) 4-adjacency. Two pixels p and q with values from V are 4-adjacent if q is in the set N4(p).
(b) 8-adjacency. Two pixels p and q with values from V are 8-adjacent if q is in the set N8(p).
( c) m-adjacency (mixed adjacency). Two pixels p and q with values from V are m-adjacent if (i) q is in N4(p), or (ii) q is in ND(p) and the set N4(p) N4(q) has no pixels whose values are from VV: The set of gray-level values used to define adjacency
Adjacency
65
Adjacency
A pixel p is adjacent to pixel q is they are connected.Two image subsets S1 and S2 are adjacent if some pixelin S1 is adjacent to some pixel in S2
S1
S2
We can define type of adjacency: 4-adjacency, 8-adjacencyor m-adjacency depending on type of connectivity.
66
0 1 0
0 1 0
0 0 1
4-adjacency
q
p
8-adjacency
0 0 1
0 1 0
0 0 1
q
m-adjacency
0 1 1
0 1 0
0 0 1
q
0 1 1
0 1 0
0 0 1
q
8-adjacency !?
Adjacency
67
CONT’D Subset adjacency
S1 and S2 are adjacent if some pixel in S1 is adjacent to some pixel in S2
A path (curve) from pixel p with coordinates (x,y) to pixel q with coordinates (s,t) is a sequence of distinct pixels:
(x0,y0), (x1,y1), …, (xn,yn)
where (x0,y0)=(x,y), (xn,yn)=(s,t), and (xi,yi) is adjacent to (xi-1,yi-1), for 1≤i ≤n ; n is the length of the path.
If (x0, y0) = (xn, yn): A closed path.
68
Region We call R a region of the image if R is a
connected set Boundary
The boundary of a region R is the set of pixels in the region that have one or more neighbors that are not in R
Edge Pixels with derivative values that exceed a
preset threshold
CONT’D
69
Distance measures Euclidean distance
City-block distance
Chessboard distance
21
22 ])()[(),( tysxqpDe -+-
|)(||)(|),(4 tysxqpD -+-
|))(||,)(max(|),(8 tysxqpD --
CONT’D
70
mD distance: The shortest m-path between the points
CONT’D
71
For pixels p, q, and z, with coordinates (x,y), (s,t), and (v,w), respectively, D is a distance function or metric if
(a) D(p,q) 0 ,(b) D(p,q) = D(q,p), (symmetry)(c) D(p,z) D(p,q) + D(q,z) (triangular
inequality)Euclidean distance between p and q is
De(p,q) = [ (x - s)2 + (y - t)2 ]1/2For this distance measure, the pixels having a distance less than or equal to some value r from (x,y) are the points contained in a disk of radius r centered at (x,y).
Distance Measure (Euclidean)
72
The D4 distance (city-block) between p and q is D4(p,q) = |x – s | + |y – t |
Diamond shape
The D8 distance (chessboard) between p and q is D8(p,q) = max ( |x – s | , |y – t | )
22 1 2
2 1 0 1 22 1 2
2
2 2 2 2 22 1 1 1 22 1 0 1 22 1 1 1 22 2 2 2 2
Distance Measure (City block, Chessboard)
73
If distance depend on the path between two pixels such as m-adjacency then the Dm distance between two pixelsis defined as the shortest m-path between the pixels.
0 0 1
0 1 0
1 0 0
q
Dm( p , q ) = 2
0 0 1
1 1 0
1 0 0p
Dm( p , q ) = 3
0 1 1
1 1 0
1 0 0
Dm( p , q ) = 4
Distance Measure of Path
74
Distance
For pixel p, q, and z with coordinates (x,y), (s,t) and (u,v),D is a distance function or metric if
w D(p,q) 0 (D(p,q) = 0 if and only if p = q)
w D(p,q) = D(q,p)
w D(p,z) D(p,q) + D(q,z)
Example: Euclidean distance22 )()(),( tysxqpDe -+-
75
D4-distance (city-block distance) is defined as
tysxqpD -+-),(4
1 210
1 212
2
2
2
2
2
Pixels with D4(p) = 1 is 4-neighbors of p.
76
D8-distance (chessboard distance) is defined as
),max(),(8 tysxqpD --
12
101
2
12
2
2
2
2
2
Pixels with D8(p) = 1 is 8-neighbors of p.
22
2
2
2222
1
1
1
1
77
Path A path from pixel p at (x,y) to pixel q at (s,t) is a sequenceof distinct pixels:
(x0,y0), (x1,y1), (x2,y2),…, (xn,yn)such that
(x0,y0) = (x,y) and (xn,yn) = (s,t)and (xi,yi) is adjacent to (xi-1,yi-1), i = 1,…,n
pq
We can define type of path: 4-path, 8-path or m-pathdepending on type of adjacency.
78
p
q
p
q
p
q
8-path from p to qresults in some ambiguity
m-path from p to qsolves this ambiguity
8-path m-path
79
3 1 2 1
2 2 0 2
1 2 1 1
1 0 1 2(p)
(q)Find the shortest 4-, 8-, m-pathbetween p and q for V= {0, 1} and V={1, 2}
Path Length
80
Images are represented by Matrices, and matrix division is not defined. The following image division C = A/Bmeans that the division is carried out between corresponding pixels in the two images A and B to form image C.
Image Operation on a Pixel Basis
81
H(af + bg) = a H( f ) + b H( g )
Linear and Nonlinear OperationLinear operation
H is said to be a linear operator if, for any two images f and g and any two scalars a and b,
82
IMAGE ADDITION(AVERAGING)IMAGE ADDITION (AVERAGING)
83
IMAGE SUBTRACTION
84
IMAGE SUBTRACTION
85
IMAGE MULTIPLICATION (DIVISION)
86
IMAGE MULTIPLICATION (DIVISION)
87
REFERENCES “Digital Image Processing”, 2/ E, Rafael C. Gonzalez & Richard
E. Woods, www.prenhall.com/gonzalezwoods.
Only Original Owner has full rights reserved for copied images.
This PPT is only for fair academic use.
88
Questions?
Think Smarter,Work Harder