Extracted Merged Ch03_Spatial Domain Image Processing
Extracted Merged Ch03_Spatial Domain Image Processing
1
3.1. Spatial Processing of Digital
Images
The term spatial domain refers to the image
plane itself, and image processing methods in
this category are based on direct
manipulation of pixels in an image.
Two principal categories of spatial processing
are intensity transformations and spatial
filtering.
Intensity transformations operate on single
pixels of an image for tasks such as contrast
manipulation and image thresholding.
2
…cont’d
3
The Basics of Intensity Transformations
and Spatial Filtering
4
…cont’d
5
…cont’d
7
…cont’d
9
3.2. Basic Intensity Transformation
Functions
There are three basic types of intensity
transformation functions:
Linear (negative and identity transformations),
Logarithmic (log and inverse-log
transformations), and
Power-law (nth power and nth root
transformations).
The identity function is the trivial case in which
the input and output intensities are identical.
10
…cont’d
11
Image Negatives
12
…cont’d
13
Log Transformations
14
…cont’d
16
Power-law (Gamma)
Transformations
Power-law transformations have the form
17
…cont’d
18
Piecewise Linear Transformation
Functions
Complementary approach to Linear,
Logarithmic, and Power-law transformations.
The advantage of these functions is that the
form of piecewise functions can be arbitrarily
complex.
The main disadvantage of these functions is
that their specification requires considerable
user input.
Example: Contrast Stretching, Intensity-Level
Slicing, Bit-Plane Slicing
19
Contrast Stretching
Low-contrast images can result from poor
illumination, lack of dynamic range in the
imaging sensor, or even the wrong setting of a
lens aperture during image acquisition.
Contrast stretching expands the range of
intensity levels in an image so that it spans the
ideal full intensity range of the recording
medium or display device.
20
…cont’d
24
Bit-planes of an 8-bit image.
…cont’d
25
3.3 Histogram Processing
Image Histogram
An image histogram is a type of histogram that
acts as a graphical representation of the tonal
distribution in a digital image.
It plots the number of pixels for each tonal
value
The horizontal axis of the graph represents the
tonal variations, while the vertical axis
represents the total number of pixels in that
particular tone.
26
…cont’d
Image
27
Image Histogram
…cont’d
29
Histogram Equalization
30
…cont’d
33
3.4 Spatial Filtering
37
Spatial Correlation and
Convolution
Correlation consists of moving the center of a
kernel over an image, and computing the sum
of products at each location.
Spatial convolution are the same, except that
the correlation kernel is rotated by 180°.
The correlation of a kernel w of size m x n
with an image f(x,y), is given by
38
…cont’d
39
Types of Spatial Filter
40
Smoothing spatial filters
Image averaging 43
Lowpass Gaussian Filter Kernels
44
…cont’d
45
Order-statistic (Nonlinear) Filters
Min filter
Replaces the value of the center pixel by the
minimum of the of the intensity values in the
neighborhood of that pixel
Useful for finding the darkest points in an
image
48
Sharpening Spatial Filters
49
Foundations
Second Derivatives:
Must be zero in areas of constant intensity.
Must be nonzero at the onset and end of an
intensity step or ramp.
Must be zero along intensity ramps.
We define the second-order derivative of f(x )
as the difference
51
…cont’d
52
Image Sharpening – the Laplacian
Laplacian Kernels
54
…cont’d
56
Image Sharpening – the Gradient
57
…cont’d
1
4.1 Introduction to Frequency
Domain
In spatial domain, we deal with images as it
is. The value of the pixels of the image
change with respect to scene.
Whereas in frequency domain, we deal with
the rate at which the pixel values are
changing in spatial domain.
We use the Fourier transform to go from the
spatial to the frequency domain; to return to
the spatial domain we use the inverse Fourier
transform.
2
4.2 Fourier series
where
4
Fourier Transform
6
4.3 Frequency Spectrum
7
(a) A box function, (b) its Fourier transform, and (c) its spectrum.
4.4 Continuous 2-D Fourier
Transform and Its Inverse
Let f(t,z) be a continuous function of two
continuous variables, t and z. The two
dimensional, continuous Fourier transform is
given by the expressions
9
4.5 Discrete 2-D Fourier
Transform And Its Inverse
The 2-D discrete Fourier transform (DFT) is
given by:
10
…cont’d
11
Fourier Spectrum And Phase
Angle
Because the 2-D DFT is complex in general,
it can be expressed in polar form:
15
…cont’d
16
4.7 Image Enhancement in
Frequency Domain
Image enhancement is the process of making
images more useful.
The reason for doing this include:
Highlighting
Remove nose from images interesting detail in
images
Making images more visually appealing
17
Types of enhancement Techniques
18
Frequency Domain Filtering
Fundamentals
Filtering in the frequency domain consists of
modifying the Fourier transform of an image,
then computing the inverse transform to
obtain the spatial domain representation of
the processed result.
Thus, given (a padded) digital image, f(x,y),
of size PxQ pixels, the basic filtering equation
in which we are interested has the form:
20
Filtering steps in Frequency
Domain
The process of filtering in the frequency
domain can:
1. Given an input image f(x,y) of size MxN,
obtain the padding sizes P and Q using
P=2M and Q=2N.
2. Form a padded image fp (x,y) of size PxQ
using zero-, mirror-, or replicate padding
3. Multiply fp (x,y) by (-1)x+y to center the Fourier
transform on the PxQ frequency rectangle.
4. Compute the DFT, , of the image from
Step 3. 21
…cont’d
22
…cont’d
23
Example
Step 7 Step 8
24
Frequency Domain Filtering
25
Lowpass Frequency domain
Filtering
Edges and other sharp intensity transitions
(such as noise) in an image contribute
significantly to the high frequency content of
its Fourier transform.
Hence, smoothing (blurring) is achieved in
the frequency domain by high-frequency
attenuation.
Attenuating high frequency and passing low
frequency is know as lawpass filtering.
Three types of lowpass filters: ideal,
Butterworth, and Gaussian. 26
Ideal Lowpass Filters
a b c
d e f
(a) Original image. (b)–(f) Results of filtering using ILPFs with cutoff
frequencies set at radii values 10, 30, 60, 160, and 460
29
Gaussian Lowpass Filters
31
…cont’d
33
…cont’d
34
…cont’d
37
…cont’d
38
Ideal Highpass Filters
39
…cont’d
40
…cont’d
41
Gaussian Highpass Filters
42
…cont’d
43
Butterworth Highpass Filters
44
…cont’d
45
…cont’d
46
Chapter Five
1
5.1 Introduction
4
…cont’d
5
5.3 Noise Models
6
Spatial & Frequency Properties Of
Noise
Spatial properties define the spatial
characteristics of noise, and whether the
noise is correlated with the image.
Frequency properties refer to the frequency
content of noise in the Fourier (frequency)
domain.
7
Noise Probability Density
Functions (PDF)
Gaussian noise model
The PDF of a Gaussian random variable, z, is
defined by the following expression:
8
…cont’d
and
9
…cont’d
and
where a>0
10
…cont’d
and
11
…cont’d
and
13
Some important PDF
14
…cont’d
and
19
Mean Filters
In other words,
25
Example …
(a) Original image
(b) Image corrupted
by additive
Gaussian noise.
(c) Result of
filtering with
an arithmetic
mean filter of size
3x3 . (a) (b)
(d) Result
of filtering with a
geometric mean
filter of the same
size.
(c) (d)
26
Order Statistic Filters
28
…cont’d
Midpoint Filter
The midpoint filter computes the midpoint
between the maximum and minimum values in
the area encompassed by the filter:
30
…cont’d
32
Adaptive Filters
34
…cont’d
35
Adaptive Median Filter
36
…cont’d
where
37
Chapter Six
Image Compression
1
6.1 Basic Definition of Image
Compression
Data compression refers to the process of
reducing the amount of data required to
represent a given quantity of information.
Data are the means by which information is
conveyed.
Various amounts of data can be used to
represent the same amount of information
Representations that contain irrelevant or
repeated information are said to contain
redundant data.
2
…cont’d
3
…cont’d
5
Coding Redundancy
8
…cont’d
Example
12
…cont’d
13
6.3 Elements of Information
Theory
A key question in image compression is: “
what is a minimum amount of data that is
sufficient to describe an image without losing
information?”
How do we measure the information content
of an image?
Average information content of an image (the
intensity source’s entropy) is given by:
units/pixel
14
Example
17
…cont’d
18
6.4 General Mechanism of Data
Compression
An image compression system is composed
of two distinct functional components: an
encoder and a decoder.
The encoder performs compression, and the
decoder performs the complementary
operation of decompression.
A codec is a device or program that is
capable of both encoding and decoding.
19
…cont’d
20
The Encoding or Compression
Process
The encoder is designed to remove the data
redundancies through a series of three
independent operations.
In the first stage of the encoding process, a
mapper transforms f(x,y) into a format
designed to reduce spatial and temporal
redundancy. This operation generally is
reversible, and may or may not directly
reduce the amount of data required to
represent the image.
Example, Run-Length Coding 21
…cont’d
23
The Decoding or Decompression
Process
The decoder contains only two components:
a symbol decoder and an inverse mapper.
They perform, in reverse order, the inverse
operations of the encoder’s symbol encoder
and mapper.
Because quantization results in irreversible
information loss, an inverse quantizer block is
not included in the general decoder model.
24
6.5 Types of Data Compression
25
Huffman Coding
27
…cont’d
28
…cont’d
30
…cont’d
32
Arithmetic coding example
33
…cont’d
36
…cont’d
39
…cont’d
The four most significant binary and Gray-coded bit planes of the image
41
…cont’d
The four least significant binary and Gray-coded bit planes of the image
42
Chapter Seven
1
Color Fundamentals
4
…cont’d
5
…cont’d
7
…cont’d
9
7.2 Color Models (color space or
color system)
The color model aims to facilitate the
specification of colors in some standard way.
In digital image processing, commonly used
color models are:
RGB (Red, Green, Blue)
CMY (Cyan, Magenta, Yellow)
CMYK (Cyan, Magenta, Yellow, Black)
HSI (Hue, Saturation, Intensity)
10
The RGB Model
12
CMY Model
13
CMYK Model
14
HSI Model
15
…cont’d
16
7.3 Basics of Full-Color Image
Processing
Full-color image processing approaches fall
into two major categories:
Processing each grayscale component image
individually, then form a composite color
image from the individually processed
components.
Processing color pixels directly.
Full-color images have at least three
components, and hence color pixels are
vectors.
17
…cont’d
21
…cont’d
(a) (b) 22
…cont’d
In (a), averaging would be done by summing
the intensities of all the pixels in the 2-D
neighborhood, then dividing the result by the
total number of pixels in the neighborhood.
In (b), averaging would be done by summing
all the voxels in the 3-D neighborhood, then
dividing the result by the total number of
voxels in the neighborhood.
Each of the three component of the average
voxel is the sum of the pixels in the single
image neighborhood centered on that
location. 23
…cont’d
24
7.4 Morphological image
processing
Mathematical morphology a tool used for
extracting image components that are useful
in the representation and description of
region shape, such as boundaries, skeletons,
and the convex hull.
In image processing, we use morphology with
two types of sets of pixels: objects and
structuring elements (SE’s).
Objects are defined as sets of foreground
pixels.
25
…cont’d
26
…cont’d
27
…cont’d
29
…cont’d
30
…cont’d
31
For morphological image processing, we
need a structuring element.
It is similar to a mask used in spatial
convolution.
Morphological operations are defined for two
images.
The image being processed is the active
image, and the second image is called
(kernel) or (structuring element)
32
…cont’d
Dilation operation:
Given a set A and the structuring element B,
the dilation of A with B is defined as:
35
…cont’d
Erosion operation:
Erosion of A with B is given by:
Closing operation:
The closing of set A by structuring element B,
is defined as
39
…cont’d
Opening Operation
The opening of set A by structuring element B,
is defined as
41
…