Хэв танилтын үндэс
(Introduction to Pattern Recognition )
Лекц 2. Дүрс боловсруулалт
Монгол Улсын Их Сургууль, ХШУИС
Д-р, дэд проф. Б.Сувдаа
Contents
Introduction to Digital Image Fundamentals (Chapter
2)
Elements of Visual Perception
Image Sensing and Acquisition
Image Sampling and Quantization
Basic relationships between pixels
Mathematical Tools used in DIP
IntensityTransformations and Spatial Filtering
(Chapter 3)
Elements of Visual Perception
Structure of Human Eye
Average diameter - 20 mm
3 membranes enclose the eye:
• Cornea and sclera outer cover (transparent)
• The choroid (network of blood vessels)-> ciliary body, iris (diameter
varies 2 to 8 mm)
• The retina (inside of the wall’s )
Elements of Visual Perception (con’t)
Distribution of rods and cons in the retina
2 classes of receptors
•Cones (fovea) 6~7 million, high sensitive to color (Cone vision
called photopic or bright-light vision)
•Rods 75~120 million, not color, high sensitive to low levels of
illumination. (it called scotopic or dim-light vision)
Elements of Visual Perception (con’t)
Mach band effect
Ernst Mach first described phenomenon in 1985
Elements of Visual Perception (con’t)
Image Sensing and Acquisition
How to sense
Incoming energy is transformed into a voltage by the combination of input
electrical power and sensor material that is responsive to the particular type
of energy being detected.
The output voltage waveform is the response of the sensor(s) and a digital
quantity is obtained from each sensor by digitizing its response
Image Sensing and Acquisition (con’t)
Simple image formation model
f(x,y)=i(x,y)r(x,y)+n(x,y)
Intensity – proportional to energy
0<f(x,y)<∞ radiated by a physical source
0<i(x,y)<∞ illumination
0<r(x,y)<1 reflectance
n(x,y) noise
l = f(xi,yi) Lmin ≤ l ≤ Lmax
Image Sampling and Quantization
Convert the continuous
sensed data into digital
image
Sampling – to sample the
function in both
coordinates and in
amplitude. (Digitizing the
coordinate values)
Quantization – in order to
form a digital function, the
intensity values also must
be quantized into discrete
quantities.
Image Sampling and Quantization (con’t)
Representing digital image
As a surface
As a visual intensity array
As a 2-D numerical array
The number of intensity levels typically is an integer power of 2:
L=2K
A digital image requires b number of bits:
b=M x N x k
Image Sampling and Quantization (con’t)
Spatial and Intensity Resolution
Image Sampling and Quantization (con’t)
Image interpolation
Zooming :
nearest neighbor
interpolation
pixel replication
bilinear interpolation
to use more neighbors
shrinking :
the reverse of zooming
Basic relationships between pixels
Neighbors, adjacency
neighbors of a pixel p
4-neighbors
four diagonal neighbors
8-neighbors
adjacency of two pixels
4-adjacency
8-adjacency
m (mixed)-adjacency: without confusion
adjacency of two image subsets
path (or curve) from pixel p to pixel q
length of path
closed path
Basic relationships between pixels (con’t)
Distance measures
Euclidean distance D8 distance For pixels p, q, and z , with coordinate s
(2-norm) (checkboard distance)
(x,y), (s,t), and (v,w), respective ly,
2 2 5 2 52 2 2 2 2 2 2
2 1 2 5 1
D is a distance function or metric if
5 2 1 1 2
2 1 0 1 2 2 1 0 1 2 (a) D ( p, q ) 0 ( D ( p, q ) = 0 iff p = q )
5 2 1 2 5 2 1 1 1 2 (b) D ( p,q ) = D (q,p ), and
2 2 5 2 52 2 2 2 2 2 2 (c) D ( p,z ) D ( p,q ) + D (q,z )
D4 distance
(city-block distance)
De ( p, q ) = ( x − s ) 2 + ( y − t ) 2
4 3 2 3 4
3 2 1 2 3 D4 ( p, q ) = x − s + y − t
2 1 0 1 2
1
D8 ( p, q ) = max( x − s , y − t )
3 2 2 3
4 3 2 3 4 Dm = shortest m - path
Mathematical Tools used in DIP
Arithmetic operations carried out between corresponding
pixel pairs
Mathematical Tools used in DIP (con’t)
Logical operations
AND
OR
NOT
XOR
Mathematical Tools used in DIP (con’t)
Spatial Operations
Single-pixel operations
Neighborhood operations
Geometric spatial transformations
Chapter 3. Intensity Transformations and
Spatial Filtering
Contents
The Basics of Intensity Transformation and Spatial
Filtering
Histogram Processing
Fundamentals of Spatial Filtering
Smoothing Spatial Filters
Sharpening Spatial Filters
Combining Spatial Enhancement Methods
Intensity Transformation and Spatial Filtering
Image enhancement seeks
to improve the visual appearance of an image, or
convert it to a form suited for analysis by a human or a
machine.
Image enhancement does not
seek to restore the image
increase its information contents
Intensity Transformation and Spatial
Filtering (con’t)
Intensity transformation
Change the intensity of each pixel in order to enhance the
image:
where f(x, y): input image, g(x, y):
processed image, and T: operator
where r: input pixel, and s: output pixel
Intensity Transformation and Spatial
Filtering (con’t)
3 types of functions for Image Enhancement:
Linear (negative)
Logarithmic (log and inverse-log)
Power-law (nth power and nth root)
Intensity Transformation and Spatial
Filtering (con’t)
Logarithmic transformation:
where
Logarithmic transformations are used for dynamic
range manipulation and are implemented using
This transformation expands the values of dark pixels
in an image while compressing the higher level
values
The opposite is true for the inverse log transform
Intensity Transformation and Spatial
Filtering (con’t)
Power law (gamma) transformation has the basic form
where c and γ are positive constants
The transformation is entirely controlled by γ
The transformation is similar to the log transformation but it
is easier to be tuned
Intensity Transformation and Spatial
Filtering (con’t)
Contrast Stretching
Intensity Transformation and Spatial
Filtering (con’t)
Gray-Level Slicing highlights range [A, B] of gray levels
and reduces all others to a constant level
but preserves all other levels
Intensity Transformation and Spatial
Filtering (con’t)
Bit-plane slicing
Histogram Processing
Histogram:
Normalized Histogram
Histogram Processing (con’t)
Monotonically Increasing Function
Histogram Processing (con’t)
Histogram Equalization
The intensity levels in an image may be viewed as random variables in the
interval [0, L-1].
A fundamental descriptor of a random variable is its probability density
function (PDF)
The transformation (mapping) in this equation is called a histogram
equalization transformation
Histogram Processing (con’t)
Histogram Equalization
Example
Histogram Processing (con’t)
Histogram Equalization
Example
Transformation functions
Histogram Processing (con’t)
Histogram Matching (Specification)
To generate a processed image that has a specified histogram is
called Histogram Matching or Histogram Specification
Histogram Processing (con’t)
Histogram Matching
(Specification)
Example
Histogram Processing (con’t)
Local Enhancement
Previous enhancement methods are global (an entire image)
Global filters are useful for overall enhancement
There are cases in which it is necessary to enhance details over small areas in
an image
To map the intensity of the pixel centered in the neighborhood
To reduce computation is to utilize nonoverlapping regions -> ‘blocky’ effect
Histogram Processing (con’t)
Enhancement by Statistics
Histogram Processing (con’t)
Enhancement using Arithmetic / Logic Operations
Fundamentals of Spatial Filtering
Mechanics of Spatial Filtering
Window sliding
Edge pixels padding
window (kernel, mask)
Fundamentals of Spatial Filtering (con’t)
Mechanics of Spatial Filtering
Fundamentals of Spatial Filtering (con’t)
Spatial Correlation and Convolution
Smoothing Spatial Filters
Smoothing Linear Filters
Smoothing Spatial Filters (con’t)
Smoothing Linear Filters
Example with different mask sizes
Original image
(500 x 500 pixels) 3 x 3 mask
5 x 5 mask
9 x 9 mask
15 x 15 mask 35 x 35 mask
Smoothing Spatial Filters (con’t)
Smoothing Linear Filters
Averaging
Smoothing Spatial Filters (con’t)
First – Order Statistic (Nonlinear) Filters
Median filter
Sharpening Spatial Filters
Sharpening Linear Filters (Low-Pass Filter)
First-Order derivatives
Second-Order derivatives
Sharpening Spatial Filters
Sharpening Linear Filters
Sharpening Spatial Filters (con’t)
Using Second-Derivative for Image Sharpening - The
Laplacian
Isotropic or rotation invariant filters
Linear operator
Sharpening Spatial Filters (con’t)
Using Second-Derivative for Image Sharpening - The Laplacian
Example
Sharpening Spatial Filters (con’t)
Unsharp Masking and Highboost Filtering
Blur the original image
Subtract the blurred image from the original image (the resulting
difference is called the mask)
Add the mask to the original
If k>1, it is called high-boost filtering
Sharpening Spatial Filters (con’t)
Unsharp Masking and High-boost Filtering
Sharpening Spatial Filters (con’t)
Using First –Order Derivatives for (Nonlinear) Image Sharpening -
The Gradient
Sharpening Spatial Filters (con’t)
Using First –Order Derivatives for (Nonlinear) Image Sharpening -
The Gradient
Roberts operators
Sobel operators
Sharpening Spatial Filters (con’t)
Edge Enhancement by Gradient
Combining Spatial Enhancement Methods
Combination of several filters
References
http://www.cs.uregina.ca/Links/class-
info/425/Lab3/index.html
Any questions ?