Lecture 2 - Image Processing techniques - Useful for high level analysis
KalirajanK2
27 views
56 slides
Oct 15, 2024
Slide 1 of 56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
About This Presentation
Image process techniques
Size: 788.41 KB
Language: en
Added: Oct 15, 2024
Slides: 56 pages
Slide Content
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Digital ImageDigital Image
ProcessingProcessing
Dr. K. Adalarasu
1
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Textbook and MaterialsTextbook and Materials
Rafael C. Gonzalez, Richard E.
Woods, “Digital Image Processing”,
2
nd
Edition, Pearson Education, 2003
Power Point Presentation
2
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
ReferenceReference
William K. Pratt, “Digital Image Processing” ,
John Willey ,2001
Millman Sonka, Vaclav Hlavac, Roger Boyle,
Broos/Colic, Thompson Learniy, Vision,
“Image Processing Analysis and Machine”,
1999.
Jain A.K., “Fundamentals of Digital Image
Processing”, PHI, 1995.
Chanda Dutta Magundar, “Digital Image
Processing and Applications”, PHI, 2000
3
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Digital Image Digital Image
Fundamentals and Fundamentals and
TransformsTransforms
4
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Representing Digital ImagesRepresenting Digital Images
Discrete levels are equally spaced
Integers in interval [0, L-1]
Bits required to store a digitized
image (b)
b=M*N*k
Where k bits
When M=N
b = N
2
k
5
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Representing Digital ImagesRepresenting Digital Images
6
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
7
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Sampling
Principal factor determining spatial resolution
of an image
Construct a chart
Vertical lines of width W
Space between lines also having width W
Line pair
One such line and its adjacent space
8
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Width of a line pair is 2W
1/2W line pairs per unit distance
Smallest number of “discernible line pairs”
per unit distance
Gray-level resolution
Smallest discernible change in gray level
Measuring discernible changes in gray level
is a highly subjective process
9
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Most common number is 8 bits
If enhancement of specific gray-level ranges
is necessary
16 bits being used
Digitize gray levels of an image with 10 or 12
bits of accuracy
Example
512*512 image was obtained by deleting every
other row and column from the 1024*1024
image
10
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
256*256 image was generated by
deleting every other row and column
in 512*512 image
Number of allowed gray levels was
kept at 256
11
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Example
Keep number of samples constant
Reduce number of gray levels from
256 to 2
In integer powers of 2
452*374 CAT projection image
Displayed with k=8(256 gray
levels)
13
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
14
(a) 452*374,
256-level image.
(b)–(d) Image
displayed in 128,
64, and 32 gray
levels, while
keeping the
spatial resolution
constant
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Obtained by reducing number of bits
from k=7to k=1
While keeping spatial resolution
constant at 452*374 pixels
256, 128, and 64-level images are
visually identical for all practical
purposes
15
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
16
(e)–(g)
Image
displayed in
16, 8,
4, and 2
gray
levels
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Spatial and Gray-Level ResolutionSpatial and Gray-Level Resolution
Images of size 256*256 pixels and 64
gray levels are about the smallest
images that can be expected to be
reasonably free of objectionable
sampling checkerboards and false
contouring
17
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
QuestionsQuestions
Define Image?
What is the need for digital Image
processing ?
What do you mean by sampling and
quantization ?
18
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Aliasing and Moiré PatternsAliasing and Moiré Patterns
Function is under-sampled
Then a phenomenon called aliasing corrupts
sampled image
Corruption is in form of “additional frequency
components” being introduced into sampled
function
Sampling rate in images is number of
samples taken (in both spatial directions) per
unit distance
19
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Aliasing and Moiré PatternsAliasing and Moiré Patterns
Principal approach for reducing aliasing
effects on an image
To reduce its high-frequency components
by blurring image prior to sampling
Aliasing is always present in a sampled
image
20
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
21
Aliasing in Digital ImagesAliasing in Digital Images
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and Shrinking Digital Zooming and Shrinking Digital
ImagesImages
Zooming
Viewed as oversampling
Shrinking
Viewed as under-sampling
Zooming and shrinking are applied to a digital
image
Zooming requires two steps
Creation of new pixel locations
Assignment of gray levels to those new locations
22
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and Shrinking Digital Zooming and Shrinking Digital
ImagesImages
Example
Image of size 500*500 pixels
Want to enlarge it 1.5 times to 750*750 pixels
Laying an imaginary 750*750 grid over
original image
Spacing in grid would be less than one pixel
We are fitting it over a smaller image
23
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and Shrinking Digital Zooming and Shrinking Digital
ImagesImages
To perform gray-level assignment for
any point in overlay
Look for closest pixel in original image
Assign its gray level to new pixel in grid
This method of gray-level assignment is
called nearest neighbor interpolation
Pixel neighborhoods
24
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and Shrinking Digital Zooming and Shrinking Digital
ImagesImages
Pixel replication
Applicable when we want to increase size of
an image an integer number of times
Double size of an image
Can duplicate each column
Doubles image size in horizontal direction
25
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
26
Top row: images zoomed from 128*128, 64*64, and 32*32
pixels to 1024*1024 pixels, using nearest neighbor gray-level
interpolation. Bottom row: same sequence, but using bilinear
interpolation
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and Shrinking Digital Zooming and Shrinking Digital
ImagesImages
Duplicate each row of enlarged image to
double the size in vertical direction
Same procedure is used to enlarge image
by any integer number of times (triple,
quadruple, and so on)
Gray-level assignment of each pixel is
predetermined by fact that new locations are
exact duplicates of old locations
27
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Zooming and ShrinkingZooming and Shrinking
Nearest neighbor interpolation is fast
Undesirable feature that it produces a checkerboard
effect
Particularly objectionable at high factors of
magnification
More sophisticated way of accomplishing gray-
level assignments
Bilinear interpolation using four nearest neighbors of
a point
To reduce possible aliasing effects
It is a good idea to blur an image slightly before
shrinking it
28
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Basic Relationships between PixelsBasic Relationships between Pixels
Objective
To study relationships
between pixels in an image
29
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Neighborhood of a PixelNeighborhood of a Pixel
Given a pixel p in center of 9
4-neighbors of p = b, d, e, g;
8-neighbors of p = a, b, c, d, e, f, g, h;
Diagonal neighbors of p = a, c, f, h;
30
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Neighbors of a PixelNeighbors of a Pixel
There are three kinds of neighbors of a pixel
31
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Neighbors of a PixelNeighbors of a Pixel
4-neighbors of p
8-neighbors of p
Diagonal neighbors of p
32
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Adjacency, Connectivity, Regions, Adjacency, Connectivity, Regions,
and Boundariesand Boundaries
Connectivity between pixels is a fundamental
concept
Simplifies definition of numerous digital image
concepts
Such as regions and boundaries
If two pixels are connected it must be
determined
If they are neighbors and their gray levels satisfy
a specified criterion of similarity
33
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
ConnectivityConnectivity
Types
4-connected, 8-connected
4-adjacent, 8-adjacent
Path connected
Connected component (c. c.)
For any pixel p in S , the set of pixels in S that
are connected to p is called Connected
Component
34
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
ConnectivityConnectivity
If it only has one connected component,
then set S is called a connected set
Let R be a subset of pixels in an image.
We call R a region of image if R is a
connected set
Boundary of a region R is set of pixels
in region that have one or more
neighbors that are not in R
35
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
Adjacency
Two pixels that are neighbors and have
same grey-level (or some other
specified similarity criterion) are
adjacent
Three types of adjacency
4-adjacency
8-adjacency
m-adjacency (mixed adjacency)
36
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
4-adjacency
Two pixels p and q with values from V are 4-
adjacent if q is in set N
4(p)
8-adjacency
Two pixels p and q with values from V are 8-
adjacent if q is in the set N
8(p)
m-adjacency (mixed adjacency)
(i).q is in N
4(p), or
(ii).p and q are diagonally adjacent and do not
have any common 4-adjacent neighbors
They cannot be both (i) and (ii)
37
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
Mixed adjacency is a modification of 8-
adjacency
Introduced to eliminate ambiguities that often
arise when 8-adjacency is used
For example, pixel arrangement shown in Fig
38
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
For V={1}
Three pixels at top show multiple (ambiguous) 8-
adjacency, as indicated by dashed lines
39
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
Ambiguity is removed by using m-
adjacency
40
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
AdjacencyAdjacency
41
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Edge Edge
Edge
Found frequently in discussions
dealing with regions and
boundaries
Formed from pixels with derivative
values that exceed a preset
threshold
42
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Labeling of Connected ComponentsLabeling of Connected Components
Given a pixel p with r and t as its upper and
left-hand neighbors as follows
Following algorithm labels all c.c. In an
binary image ( This algorithm is for 4-
connected)
Scan image left to right and from top to bottom
If p = 0 , continue the scan
If p = 1 , exam r and t; if r = t = 0 assign a new
label to p
43
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Region & BoundaryRegion & Boundary
(4- or 8-connected?)
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
For pixels p, q, and z, with coordinates (x, y),
(s, t), and (v, w), respectively
D is a distance function or metric if
D(p, q) ≥= 0
D(p, q)=0 if f p=q,
D (p, q) = D (q, p)
D(p, z) ≤ = D(p, q)+D(q, z)
Euclidean distance between p and q is defined
45
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
Pixels having a distance less than or
equal to some value r from (x, y) are
points contained in a disk of radius r
centered at (x, y)
City-block distance between p and q
Pixels with D
4 =
1 are 4-neighbors of (x, y)
46
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
Pixels with D
4 distance ≤ 2 from (x, y)
(center point) form following contours of
constant distance
47
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
D
8distance (also called chessboard distance)
between p and q
Pixels with D
8
=1 to a pixel p are 8 neighbors
of p
48
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasureDistance Measure
• L
1, City-block, or D
4 distance
• L
, Chessboard, Chebyshev, or D
8 distance
• L
2
, or Euclidean distance
2 1 2
1 0 1
2 1 2
2 1 2
1 0 1
2 1 2
1 1 1
1 0 1
1 1 1
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
D4 and D8 distances between p and q are
independent of any paths that might exist
between points
Because these distances involve only
coordinates of points
D
m distance between two points is defined
as shortest m-path between point
Distance between two pixels will depend on
values of pixels along path
As well as values of their neighbors
50
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
Following arrangement of pixels
Assume that p, p
2 and p
4 have value 1
p
1and p
3 can have a value of 0 or 1
51
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
Suppose that we consider adjacency of
pixels valued 1 (i.e., V={1})
Case 1
If p
1 and p
3 = 0
Length of shortest path between p and p
4 = 2
Case 2
If p
1 = 1 and p
3 = 0
Length of shortest path between p and p
4 = 3
Path p p
1 p
2 p
4
52
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Distance MeasuresDistance Measures
Case 3
If p
1 = 0 and p
3 = 1
Length of shortest path between p and p
4
= 3
Path p p
2 p
3 p
4
Case 4
If p
1
= 1 and p
3
= 1
Length of shortest path between p and p
4 = 4
Path p p
1 p
2 p
3 p
4
53
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Problem Problem
54
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Solution Solution
55
KA – Digital Image Processing – Unit I – Jan, 2013, PSNACET
Problem 2Problem 2
56