0% found this document useful (0 votes)
16 views449 pages

Digital Image Processing: Chapter 1: Introduction

The document provides an overview of digital image processing, covering its historical development, various imaging techniques, and the fundamentals of digital images. It discusses the principles behind different imaging methods such as gamma ray, X-ray, ultraviolet, and multispectral imaging, as well as the characteristics of human visual perception. Additionally, it addresses image acquisition, representation, resolution, and interpolation techniques used in digital image processing.

Uploaded by

Ananya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views449 pages

Digital Image Processing: Chapter 1: Introduction

The document provides an overview of digital image processing, covering its historical development, various imaging techniques, and the fundamentals of digital images. It discusses the principles behind different imaging methods such as gamma ray, X-ray, ultraviolet, and multispectral imaging, as well as the characteristics of human visual perception. Additionally, it addresses image acquisition, representation, resolution, and interpolation techniques used in digital image processing.

Uploaded by

Ananya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 449

Digital Image Processing

Chapter 1: Introduction

Dr. Basant Kumar


Motilal Nehru National Institute of Technology Allahabad
Digital Images in Early Era

1921 Telegraphing image

Printing industrial

Textile industrial

1922: image
from
Photographic
reproduction
Using punched
tape

These images are not computerized processed. (Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Digital Images in Early Era

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Digital Image Processing in Early Space Projects

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Energy Sources for Images

Acoustic, Ultrasonic and Electronic (in the form of electron beams)

Images based on radiation from the Electromagnetic Spectrum are


the most familiar

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Gamma Ray Imaging

Applications
Nuclear Medicine and astronomical observations
Principle – Inject a patient with a
radioactive isotope that emits gamma ray as it decays. Images are
produced from the emission collected by gamma ray detector
Positron Emission Tomography
Principle is same as X-ray tomography. Patient is given a radioactive
isotope that emits positrons as it decays. When a positron meets an
electron, both are annihilated and two gamma rays are given off.
These are detected and a tomographic image is created.

Cygnus loop- A star in the constellation of Cygnus exploded about


15000 years ago, generating a superheated stationary gas cloud
known as Cygnus loop.
Gamma Ray Imaging

Bone Scan
Gamma Ray Imaging

PET Image
Gamma Ray Imaging

Cygnus loop
X-Ray Imaging

X-ray are among the oldest sources of EM radiation used for


imaging

Applications- medical diagnostics, astronomy, industry

Principle-
-X-rays are generated using an X-ray tube, which is vacuum tube
with a cathode and anode. Cathode is heated causing release of free
electrons.
-High speed electrons when strike a nucleus, energy is released in
the form of X-ray radiation.
-Energy of X-ray is controlled by a current applied to the filament
in the cathode
Ultraviolet Imaging
Ultraviolet

Normal corn Smut corm

Fluorescence
phenomenon

Cygnus Loop (Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Visible Light and Infrared

Cholesterol

Taxol Microprocessor

Organic
Nickel oxide superconductor
Thin film

? (Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Visible Light and Infrared

Washington
D.C.

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Multispectral Imaging

Image is produced by
sensors that measure
reflected energy from
different sections of the
EM spectrum

Hurricane Andrew
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Night time light of the world

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Nighttime light of the world (cont.)

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Automated Visual Inspection

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Automated Visual Inspection (cont.)

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Microwave

Spaceborne Radar image

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Magnetic

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Multispectral images

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Seismic imaging

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Ultrasound imaging

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Electron Microscope Images

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Synthesis Images

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Contents in the book

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
General Purpose Image Processing System

(Images from Rafael C. Gonzalez and Richard E.


Wood, Digital Image Processing, 2nd Edition.
Chapter- 2
Digital Image Fundamentals
Digital Image Processing, 3rd ed.
Gonzalez & Woods

Motilal Nehru National Institute of Technology


Allahabad

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 1
Chapter 2
Digital Image Fundamentals

Dr.Basant Kumar
2
Motilal Nehru National Institute of Technology, Allahabad
Eye’s Blind Spot

Dr.Basant Kumar
3
Motilal Nehru National Institute of Technology, Allahabad
Distribution of Light Receptors

Dr.Basant Kumar
4
Motilal Nehru National Institute of Technology, Allahabad
Distribution of Light Receptors (Contd.)

Dr.Basant Kumar
5
Motilal Nehru National Institute of Technology, Allahabad
Image Formation in the Eye

Perception takes place by the relative excitation of light receptors, which transform
radiant energy into electrical impulses that ultimately are decoded by the brain
Dr.Basant Kumar
6
Motilal Nehru National Institute of Technology, Allahabad
HVS Characteristics

-Subjective brightness is a
logarithmic function of the light
incident on the eye
-Total range of distinct intensity
levels the eye can discriminate
simultaneously is small compared
to the total adaptation range
-Current sensitivity of a visual
system is called the brightness
adaptation levels
- At Ba adaptation level ,
intersecting curve represents the mL- mili Lambert
range of subjective brightness
that eye can perceive
Dr.Basant Kumar
7
Motilal Nehru National Institute of Technology, Allahabad
Brightness Discrimination

-The ability of the eye to discriminate between changes in light intensity at any
specific adaptation level
- The quantity ∆Ic/I , ∆Ic is the increment of illumination discriminable 50 % of the
time with background illumination I, is called the Weber ratio

Dr.Basant Kumar
8
Motilal Nehru National Institute of Technology, Allahabad
Brightness Discrimination
Small weber ratio --- small percentage
change in intensity is discriminable
--- good brightness discrimination
Large weber ratio----- a large
percentage change in intensity is
required ---- poor brightness
discrimination

➢The curve shows that the brightness discrimination is poor at low level of
illumination and it improves significantly as background illumination increases
➢At low level illumination – vision is carried out by rods
➢At high level illumination – vision is carried out by cones
➢ The number of different intensities a person can see at any point of time in a
monochrome image is 1 to 2 dozens
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 9
Visual Perception
Perceived brightness is not a simple function of intensity

• Mach bands: visual system tends to undershoot or


overshoot around the boundary of regions of different
intensities
• Simultaneous contrast: region’s perceived brightness
does not depend on its intensity
• Optical illusions: eye fills in non-existing information or
wrongly perceives geometrical properties of objects

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 10
Mach Band Effect

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 11
Simultaneous Contrast

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 12
Some Optical Illusions

(a) Outline of a square is (b) Outline of a circle (c) Two horizontal line segments
seen clearly is seen are of the same length, but one
appears shorter than the other

(d) All lines that are oriented at 45 degree are equidistant


and parallel

Optical illusions: Eye fills in non-existing information or


wrongly perceives geometrical properties of objects

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 13
Electromagnetic Spectrum

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 14
Color Lights

Dr.Basant Kumar
15
Motilal Nehru National Institute of Technology, Allahabad
Properties of Light

Dr.Basant Kumar
16
Motilal Nehru National Institute of Technology, Allahabad
Image Sensing
Images are generated by the combination of the illumination
source and the reflection or absorption of energy from that source
by elements of the scene being imaged

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 17
Imaging Sensors

Dr.Basant Kumar
18
Motilal Nehru National Institute of Technology, Allahabad
Image Acquisition

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 19
Image Acquisition

A rotating X-ray source provides


illumination and the sensors
opposite the source collect the X-ray
energy that passes through the
object

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 20
Image Acquisition using Sensor Arrays

Dr.Basant Kumar
21
Motilal Nehru National Institute of Technology, Allahabad
CCD Camera

Dr.Basant Kumar
22
Motilal Nehru National Institute of Technology, Allahabad
CCD Vs CMOS

Dr.Basant Kumar
23
Motilal Nehru National Institute of Technology, Allahabad
Image Formation Model

Dr.Basant Kumar
24
Motilal Nehru National Institute of Technology, Allahabad
Image Formation Model

Dr. Basant Kumar


25
Motilal Nehru National Institute of Technology, Allahabad
Monochromatic Image

Dr.Basant Kumar
26
Motilal Nehru National Institute of Technology, Allahabad
Image Sampling and Quantization
Discretizing coordinate values is called Sampling
Discretizing the amplitude values is called Quantization

(a) Continuous image (b) A scan line from


A to B (c) Sampling (d) Quantization

Dr.Basant Kumar
27
Motilal Nehru National Institute of Technology, Allahabad
Image Sampling and Quantization

Dr.Basant Kumar
28
Motilal Nehru National Institute of Technology, Allahabad
Digital Image

Dr .Basant Kumar
29
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Representation

Dr.Basant Kumar
30
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Representation

Dr.Basant Kumar
31
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Representation

Dr.Basant Kumar
32
Motilal Nehru National Institute of Technology, Allahabad
Representing Digital Images

• Digital image
– M  N array
– L discrete intensities – power of 2
• L = 2k
• Integers in the interval [0, L - 1]
• Dynamic range: ratio of maximum / minimum intensity
– Low: image has a dull, washed-out gray look
• Contrast: difference between highest and lowest
intensity
– High: image have high contrast

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 33
Saturation and Noise

The upper limit intensity is


determined by saturation
and the lower limit by noise
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 34
Storage bits for Various Values of N and K
Digital image
# bits to store : b = M  N  k
When M = N: b = N2k
k-bit image: e.g. an image with 256 possible discrete intensity values is
called an 8-bit image
(Square Image)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 35
Spatial and Intensity Resolution
• Resolution: dots (pixels) per unit distance
• dpi: dots per inch

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 36
Spatial Resolution Example

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 37
Variation of Number of Intensity Levels

• Reducing the number of bits from k=7 to k=1 while


keeping the image size constant
• Insufficient number of intensity levels in smooth
areas of digital image leads to false contouring

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 38
Effects of Varying the Number of Intensity
Levels

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 39
Effects of Varying the Number of Intensity
Levels

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 40
Image Interpolation
• Using known data to estimate values at unknown locations
• Used for zooming, shrinking, rotating, and geometric
corrections
• Nearest Neighbor interpolation
– Use closest pixel to estimate the intensity
– simple but has tendency to produce artifacts
• Bilinear interpolation
– use 4 nearest neighbor to estimate the intensity
– Much better result
– Equation used is
• Bicubic interpolation
– Use 16 nearest neighbors of a point
– Equation used is

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 41
Zooming using Various Interpolation Techniques

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 42
Some Basic Relationships between Pixels
• Neighbors of a pixel
– There are three kinds of neighbors of a pixel:
• N4(p) 4-neighbors: the set of horizontal and vertical neighbors
• ND(p) diagonal neighbors: the set of 4 diagonal neighbors
• N8(p) 8-neighbors: union of 4-neighbors and diagonal neighbors

O O O O O O
O X O X O X O
O O O O O O
Some Basic Relationships between Pixels
• Adjacency:
– Two pixels that are neighbors and have the same grey-
level (or some other specified similarity criterion) are
adjacent
– Pixels can be 4-adjacent, diagonally adjacent, 8-adjacent,
or m-adjacent.
• m-adjacency (mixed adjacency):
– Two pixels p and q of the same value (or specified
similarity) are m-adjacent if either
• (i) q and p are 4-adjacent, or
• (ii) p and q are diagonally adjacent and do not have any common
4-adjacent neighbors.
• They cannot be both (i) and (ii).
• An example of adjacency:
Some Basic Relationships Between Pixels

• Path:
– The length of the path
– Closed path
• Connectivity in a subset S of an image
– Two pixels are connected if there is a path between them that lies
completely within S.
• Connected component of S:
– The set of all pixels in S that are connected to a given pixel in S.
• Region of an image
• Boundary, border or contour of a region
• Edge: a path of one or more pixels that separate two regions
of significantly different gray levels.
Distance Measures

• Distance measures
– Distance function: a function of two points, p and q, in
space that satisfies three criteria
( a ) D ( p, q )  0
(b) D( p, q ) = D(q, p ), and
(c ) D ( p , z )  D ( p , q ) + D ( q , z )
– The Euclidean distance De(p, q)
De ( p, q) = ( x − s ) 2 + ( y − t ) 2
– The city-block (Manhattan) distance D4(p, q)
D4 ( p, q) =| x − s | + | y − t |
– The chessboard distance D8(p, q)
D8 ( p, q) = max(| x − s |, | y − t |)
Distance Measures- Example
Arithmetic Operations
• Array operations between images
• Carried out between corresponding pixel pairs
• Four arithmetic
s(x, y) = f(x, y) + g(x, y)
d(x, y) = f(x, y) – g(x, y)
p(x, y) = f(x, y)  g(x, y)
v(x, y) = f(x, y) ÷ g(x, y)

• e.g. Averaging K different noisy images can


decrease noise
– Used in the field of astronomy
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 49
Averaging of Images

Averaging K different noisy


images can decrease noise.
Used in astronomy

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 50
Image Subtraction

Enhancement of difference between images using image subtraction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 51
Image Subtraction Application

Mask mode radiography

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 52
Shading correction by image multiplication
(and division)
g(x, y) = h(x, y) x f(x, y)

Dr.Basant Kumar
53
Motilal Nehru National Institute of Technology, Allahabad
Masking (RIO) using image multiplication

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 54
Arithmetic Operations
• To guarantee that the full range of an arithmetic operation
between images is captured into a fixed number of bits, the
following approach is performed on image f
fm = f – min(f)
which creates an image whose minimum value is 0. Then the
scaled image is
fs = K [ fm / max(fm)]
whose value is in the range [0, K]
Example- for 8-bit image , setting K=255 gives scaled image
whose intensities span from 0 to 255

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 55
Set and Logical Operations
• Elements of a sets are the coordinates of pixels (ordered pairs
of integers) representing regions (objects) in an image
– Union
– Intersection
– Complement
– Difference
• Logical operations
– OR
– AND
– NOT
– XOR
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 56
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 2
Digital Image Fundamentals

A - B= A∩ Bc

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 57
,b
b
} Set operations involving gray-scale images
}

The union of two gray-scale sets is an array formed from the maximum
intensity between pairs of spatially corresponding elements
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 58
Logical Operations

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 59
Spatial Operations

• Single-pixel operations
– For example, transformation to obtain the
negative of an 8-bit image

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 60
Spatial Operations
Neighborhood operations
For example, compute the average value of the pixels in a
rectangular neighborhood of size m  n centered on (x, y)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 61
Spatial Operations

• Geometric spatial transformations


– Called rubber-sheet transformations
– Consists of two operations
• Spatial transformation of coordinates
e.g. (x, y) = T { ( v, w) } = ( v/2, w/2)
– Affine transform: scale, rotate, transform, or sheer a set of
points
• Intensity interpolation
• Affine transform
[x y 1]= [v w 1] [Affine Matrix, T]
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 62
AFFINE TRANSFORMATION

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 63
Interpolation

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 64
Image Registration
• Used for aligning two or more images of the same scene
• Input and output images available but the specific
transformation that produced output is unknown
• Estimate the transformation function and use it to register the
two images.
• Input image- image that we wish to transform
• Reference image- image against which we want to register
the input
• Principal approach- use tie points ( also called control points)
,which are corresponding points whose locations are known
precisely in the input and reference images

Dr.Basant Kumar
65
Motilal Nehru National Institute of Technology, Allahabad
Image Registration

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 66
Vector and Matrix Operations

• RGB images
• Multispectral images

Dr.Basant Kumar
67
Motilal Nehru National Institute of Technology, Allahabad
Image Transforms

• Image processing tasks are best formulated by


– Transforming the images
– Carrying the specified task un a transform domain
– Applying the inverse transform

Dr.Basant Kumar
68
Motilal Nehru National Institute of Technology, Allahabad
Image Transforms

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 69
Intensity Transformations and
Spatial Filtering

Motilal Nehru National Institute of Technology


Allahabad

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 1
Background
• Image domains
Spatial domain techniques -operate directly on the
pixels of an image
Transform domain- operate on transform coefficients
Two main categories of spatial processing
Intensity transformation
- operation on single pixel of image
Ex- Contrast manipulation, image thresholding etc.
Spatial Filtering
- operation on a group of neighboring pixels
- Ex- image sharpening
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 2
Chapter 3
Intensity Transformations and Spatial
Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 3
Basic Intensity Transformation Functions
• Values of pixels
– before processing: r
– after processing: s
• These value are related by an expression of the form
s=T(r)
• Typically, process starts at the top left of the input
image and proceeds pixel by pixel in horizontal scan,
one row at a time
• Either ignore outside neighbors or pad the image with
a border of 0s or some other specified intensity
values
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 4
Intensity Transformations Functions

Higher contrast than original


T(r) produces two-level ,
by darkening the intensity
binary image
levels below k and
brightening the levels above k

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 5
Image Negatives
• Negative of an image with intensity levels in the range [0, L-1]
is obtained using the expression
s=L–1–r

Suited for enhancing white or gray detail embedded in dark regions


of an image specially when the black areas are dominant in size
Dr.Basant Kumar
6
Motilal Nehru National Institute of Technology, Allahabad
Log Transformations
• General form of the log transformation is
s = c log ( 1 + r ) (Eq. 3.2.2)
where c: constant, r ≥ 0
• Transformation maps a narrow range of low intensity
values in the input into a wider range of output
levels. Opposite is true of higher values of input
levels
• Expands the values of dark pixels in an image while
compressing the higher level values
• Compresses the dynamic range of images with large
variations in pixel values
– Application: Fourier transform
Dr.Basant Kumar
7
Motilal Nehru National Institute of Technology, Allahabad
Intensity Transformation Functions

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 8
Fourier Spectrum

3.5 (a) values in the range 0 to 1.5 x


3.5(b) Range is 0 to 6.2
106. . When displayed by 8-bit system ,
brightest pixels will dominate at the
expanse of lower values
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 9
Power-Law (Gamma) Transformations
• Basic form is s = c r ( Eq. 3.2-3)
where c and  : positive constants
• Transformation maps a narrow range of dark input
values into a wider ranger of output values,
with the opposite being true for higher value of input
levels ( When  is fractional value)
• Opposite is true for  greater than 1
• Family of possible transformation curves obtained
simply by varying 
• Identity transformation when: c =  = 1
• Gamma correction: for displaying an image
accurately on a computer screen
Too dark , Washed out
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 10
Power-Law (Gamma) Transformation Plots

Power –law curve


with fractional
values of  similar to
log transformation

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 11
Gamma correction
• A variety of devices used for image capture, printing,
and display respond according to a power law.
• The process used to correct these power-law
response phenomena is called Gamma Correction
• CRT device have an intensity-to-voltage response
that is a power function with  = 1.8 to 2.5.
• Different monitors / monitor setting require different
gamma correction values
• Current image standards do not contain the value of
gamma with which an image was created

Dr.Basant Kumar
12
Motilal Nehru National Institute of Technology, Allahabad
Gamma correction

Gamma correction – by pre-


processing the input image
before inputting into monitor
by performing transformation

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 13
Contrast Enhancement using Power-law
Transformation

✓For predominantly dark


image, an expansion in
intensity level is desirable
✓Fracture is more visible in
subsequent image with
decrease in fractional gamma
value

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 14
Contrast Enhancement using Power-law
Transformation

•Aerial image to be processed


has a washed-out appearance
Suitable results in (b) and (c)
•In (d) areas are too dark, in
which some detail is lost ( dark
region to the left of the main
road in upper quadrant )

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 15
Piecewise-Linear Transformation Functions
• Contrast Stretching: expands the range of intensity
levels in an image so that it spans the full intensity
range
– Points: (r1, s1) , (r2, s2)
if: r1 = s1 and r2 = s2 linear transformation that produces
no changes in the intensity levels
if: r1 = r2 and s1 = 0 and s2 = L -1 the transformation
becomes a thresholding function that creates a binary
image (Fig. 3.10 (d))
intermediate values of (r1, s1) , (r2, s2) produces various
degrees of spread in the intensity levels of the output
image, thus affecting its contrast
Use: (r1, s1) = (rmin, 0) and (r2, s2) = (rmax, L - 1)
(Fig.3.10 (c))
Dr.Basant Kumar
16
Motilal Nehru National Institute of Technology, Allahabad
Contrast Stretching

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 17
Intensity-level Slicing
Highlighting a specific range of intensities in an image

Applications- enhancing features such as masses in satellite imagery and


enhancing flaws in X-ray images
Dr.Basant Kumar
18
Motilal Nehru National Institute of Technology, Allahabad
Bit-Plane Slicing
❑Intensity of each pixel in a 256-level gray-scale image
is composed of 8 bits
❑ Contribution made to total image appearance by specific
bit is highlighted
❑ Useful for image compression , data hiding,,
watermarking

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 19
Bit-Plane Slicing- Example

Gray border has intensity 194 (11000010)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 20
Image Reconstruction using Bit-Planes

✓Reconstruction is done by multiplying the pixels of the


nth plane by constant 2 n-1
✓Background of the image (b) has perceptible false
contouring. This effect is reduced by adding 5th plane
✓Using more bit planes in the reconstruction would not
contribute significantly to the appearance of the image

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 21
Histogram Processing
• In probabilistic methods of image processing, intensity
values are treated as random quantities
• Histogram of a digital image with intensity levels is a
discrete function
h(rk) = nk
where rk: the kth intensity value and nk: number of pixels in
the image with intensity rk
• Normalized histogram
p(rk) = nk / MN , for k = 0, 1, 2, … , L -1
• Sum of all components of a normalized histogram is equal
to 1
• High contrast image covers a wide range of the intensity
scale and pixels distribution is almost uniform
Dr.Basant Kumar
22
Motilal Nehru National Institute of Technology, Allahabad
Image Histogram

An image with pixel values


occupying the entire range
of possible intensity levels ,
tend to be distributed
uniformly
An appearance of high
contrast exhibit a large
variety of gray tones

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 23
Histogram Equalization
✓ Used to enhance the appearance of an image and to
make certain features more visible
✓ An attempt to equalize the number of pixels with each
particular value
✓ Allocate more gray levels where there are most pixels
and allocate fewer levels where there are few pixels.
✓ Discrete form of the transformation is
( L − 1) k
k
sk = T (rk ) = ( L − 1)  pr (rj ) =  nj
j =0 MN j =0
k = 0, 1, 2,  , L − 1

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 24
Histogram Equalization- Example

A 3-bit image (L=8) of size 64x64


pixels ( MN=4096) has intensity
distribution given in table 3.1,
determine its equalized histogram

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 25
Histogram Equalization- Example

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 26
Histogram Matching ( Specification)

• Method to generate a processed image that


has a specified histogram

Dr. Basant Kumar


Motilal Nehru National Institute of Technology, Allahabad 27
Spatial Filtering
Filter consists of
– Neighborhood: typically a small rectangle
– Predefined operation
– Also called as spatial masks, Kernels, templates, and Windows)
Filtering
• Accepting (passing) or rejecting certain frequency components
e.g. Low-pass filter: blur (smooth) an image
• Creates a new pixel with coordinates equal to the coordinates of
the center of the neighborhood, and whose value is the result of
the filtering operation
• Use odd size filters (smallest being: 3  3)
• If the operation performed on the image pixels is linear, then the
filter is called a linear spatial filter , otherwise filter is nonlinear
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 28
Linear Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 29
Spatial Filtering
• Correlation
– Function of the displacement of the filter
– Used for matching between images
• Convolution
– Rotate filter by 180
• Padding an with (filter size m  n)
– m-1 rows of 0s at the top and bottom and
– n-1 columns 0s at the left and right
• Cropping the result
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 30
Correlation and Convolution of a 2-D filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 31
Correlation and Convolution of a 2-D filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 32
Spatial Filtering

• Generating Spatial Filter Masks


– For example: 3  3 filter (mask)

Dr.Basant Kumar Motilal Nehru National


33
Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 3
Intensity Transformations and Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 34
Smoothing Spatial Filters

• Used for blurring and for noise reduction


• Blurring is used in preprocessing tasks
– Removal of small details prior to large object extraction
– Bridging of small gaps in lines or curves
– Smoothing false contouring
• Using averaging filters (lowpass filters)
• Replacing every pixel by the average intensity in
the neighborhood which results in reduced sharp
transitions in intensities
– Undesirable side effect: blurring edges
Dr.Basant Kumar Motilal Nehru National
35
Institute of Technology, Allahabad
Smoothing Spatial Filters

• Box filter
• Weighted average filter
– Giving some pixels more importance (weight) at the
expenses of others
– Basic strategy: an attempt to reduce blurring in the
smoothing process

Dr.Basant Kumar Motilal Nehru National


36
Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 3
Intensity Transformations and Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 37
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 3
Intensity Transformations and Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 38
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 3
Intensity Transformations and Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 39
Order-Statistics Filters

• Based on ordering (ranking) pixels encompassed


by the filter then replacing the center pixel with
the ranking result
• Median filter
– Provide excellent noise reduction with less blurring
• Median value half of the values less than or equal
to median and half are greater than or equal to
median
– Sort pixels in the neighborhood
– Determine the median
– Assign median to the corresponding pixel

Dr.Basant Kumar Motilal Nehru National


40
Institute of Technology, Allahabad
Order-Statistics Filters

• Median
– In 3  3 neighborhood is the 5th largest value
– In 5  5 neighborhood is the 13th largest value
• Principal function of median filtering is to
force pixels with distinct intensities to be more
like their neighbors
• Other order-statistics filters
– Max filter: find the brightest points in the image
– Min filter

Dr.Basant Kumar Motilal Nehru National


41
Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 3
Intensity Transformations and Spatial Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 42
Sharpening Spatial Filters

• Sharpening Filter: to highlight transitions in


intensity
– Applications
• Medical imaging
• Electronic printing
• Industrial inspection
– Enhances edges and other discontinuities and
deemphasizes areas with slowly varying intensities

Dr.Basant Kumar Motilal Nehru National


43
Institute of Technology, Allahabad
Sharpening Spatial Filters
• Accomplished by Spatial Differentiation
• Derivatives of a digital function are defined in terms of
differences
f
= f ( x + 1) − f ( x )
• First derivative (Conditions) x
- must be zero in the area of constant intensity
- must be nonzero at the onset of an intensity step or ramp
- must be nonzero along ramp
2 f
• Second derivative = f ( x + 1) + f ( x − 1) − 2 f ( x )
x 2

- must be zero in constant intensity areas


- must be nonzero at the onset and end of an of an intensity step
or ramp
-must be zero along ramps of constant slope
Dr. Basant Kumar
44
Motilal Nehru National Institute of Technology, Allahabad
First and Second derivatives of a 1-D digital Function

f
= f ( x + 1) − f ( x )
x

2 f
= f ( x + 1) + f ( x − 1) − 2 f ( x)
x 2

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 45
Sharpening Spatial Filters
• Edges in digital images often are ramp-like transitions in
intensity
- first derivative results in thick edges due to nonzero value
along the ramp
- Second derivative produces double edge one pixel thick
separated by zero

Second derivative enhances fine details much better


than the first derivative

Dr.Basant Kumar Motilal Nehru National


46
Institute of Technology, Allahabad
Second derivative for image sharpening- The Laplacian

▪ Isotropic filter – response is independent of the direction


of the discontinuities in the image ( rotation invariant)
▪ Highlights intensity discontinuity in the image
▪ Laplacian for an image function f(x,y) is defined as

– I n the x-direction

– In the y-direction

-Final Laplacian of two variables is ( eq. 3.6-6)


 2 f ( x, y ) = f ( x + 1, y ) + f ( x − 1, y ) + f ( x, y + 1) + f ( x, y − 1) − 4 f ( x, y )
Dr.Basant Kumar
47
Motilal Nehru National Institute of Technology, Allahabad
Laplacian Filter Masks

-Basic way of image


sharpening is done by
adding the Laplacian image
to the original image
-Resultant image g(x , y) is
given by

g ( x, y ) = f ( x, y ) + c  2 f ( x, y ) 
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 48
Image Sharpening using Laplacian

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 49
Unsharp Masking and Highboost Filtering

• Unsharp Masking - A process to sharpen images by subtracting an


unsharp (smoothed) version of an image from the original image
• Steps-
1. blur the original image
2. Subtract the blur image from the original
3. Add the mask to the original

Dr.Basant Kumar
50
Motilal Nehru National Institute of Technology, Allahabad
1-D illustration of Unsharp Masking

Mask image is given by


Gmask (x, y) = f(x, y) – f *(x, y)

Sharpened image is given by


G (x, y)= f(x, y) + Gmask (x, y)

Dr.Basant Kumar
51
Motilal Nehru National Institute of Technology, Allahabad
First Order derivative for image sharpening- The Gradient
• First derivatives in image processing are magnitude of the
gradient
• For a function f( x, y), the gradient of f at coordinates ( x, y) is
defined as 2-D column vector
 f 
 g x   x 
f  grad ( f ) =  = 

g y   f 
 y 
 

– Gradient vector points in the direction of the greatest rate of


change of f at location (x, y)

Dr.Basant Kumar
52
Motilal Nehru National Institute of Technology, Allahabad
Gradient Operators

In some implementations,
it is more suitable to
approximate square root
operation with absolute
values

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 53
Dr.Basant Kumar Motilal Nehru National
54
Institute of Technology, Allahabad
Gradient for Edge Enhancement

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 55
Combining Sharpening Enhancement Methods

• Frequently, a given task will require application of


several techniques in order to achieve an acceptable
result
• Image enhancement by
– Smoothing
– Sharpening
– and so on

Dr.Basant Kumar
56
Motilal Nehru National Institute of Technology, Allahabad
Combining Sharpening Enhancement Methods

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 57
Combining Sharpening Enhancement Methods

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 58
Filtering in the Frequency Domain

Motilal Nehru National Institute of Technology


Allahabad

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Background
• Image domains
– Spatial domain techniques operate directly on the
pixels of an image
– Transform domain
• Fourier Transform (FT)
• Wavelet Transform
• Discrete Cosine Transform (DCT)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Background

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Review
• Sampling and Fourier Transform of sampled
functions
- Sampling theorem, aliasing, reconstruction
from sampled data
• Discrete Fourier Transform (DFT) of one
variable
• 2-D DFT and its Inverse
• Properties of 2-D DFT
Sampling
FT of Impulse Train

• Intermediate result
− The Fourier transform of the impulse train.
+ +
1  n 

n =−
 (t − nT ) 
T
   −
n =− 

T 

• It is also an impulse train in the frequency


domain.
• Impulses are equally spaced every 1/ΔΤ.
Fourier Transform of Sampled Function

FT of an impulse
train with period ∆T
is also an impulse
train, whose period
is 1/ ∆T
Sampling Theorem
Extraction of F(µ)
Aliasing
Fourier Transform of Sampled Signal
• The Fourier transform of a sampled band-limited (discrete)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)

signal is a continuous periodic function of the frequency,


extending from -∞ to + ∞
1 +  n 
F ( ) =  F  −
T n =− 

T 

• In practice, we work with a finite number of samples


• For a N-length discrete signal, taking N samples of its
Fourier transform at frequencies:
k
k = , k = 0,1, .., N − 1
N T
provides the discrete Fourier transform (DFT) of the
signal.
Discrete Fourier Transform
• DFT pair of signal f [n] of length N.

N −1 2 nk
−j
F [k ] =  f [n]e N
, 0  k  N −1
n =0
N −1 2 nk
1
 F[k ]e
j
f [ n] = N
, 0  n  N −1
N n =0
2D Impulse Train

The 2D impulse train is also separable:


+ +
SX Y ( x, y ) = S X ( x) S Y ( y ) =    ( x − nX , y − nY )
n =− m =−
2-D Fourier Transform
• The Fourier transform of a continuous 2D
signal f (x,y).
+ +
F (  , ) = 
− j 2 (  x + vy )
f ( x, y ) e dydx
− −

+ +

  F ( , )e d d 
j 2 (  x + vy )
f ( x, y ) =
− −
Example- 2-D Function FT
Analogous 1-D function FT
2D continuous signals (cont.)
• 2D sampling is accomplished by
+ +
SX Y ( x, y ) =    ( x − nX , y − nY )
n =− m =−

• The FT of the sampled 2D signal consists of


repetitions of the spectrum of the 1D
continuous signal.
+
1 1  m n 
F (  , ) =
X Y

n =−
F  −
 X
, − 
Y 
2D Sampling Theorem

• The Nyquist theorem involves both the


horizontal and vertical frequencies.
1 1
 2 max ,  2vmax
X Y

Over-sampled Under-sampled
Aliasing in Images
• A continuous function f(x, y) of two continuous
variables, can be band-limited in general only if it
extends infinity in both coordinates.
• Since we cannot sample a function infinitely---Aliasing
is always present in the digital images
Spatial Aliasing – due to under sampling
Temporal Aliasing- related to time intervals between
images in a sequence of images
Ex- “wagon wheel” effect , in which wheels with spokes in a
sequence of images appear to be rotating backward.
Reason- Frame rate is too slow as compared to speed of wheel
rotation in the image sequence
Example-aliasing
Assume a noiseless
imaging system, which
takes fixed no. of
sample 96 x 96 pixels

What happens when the


imaging system is asked
to digitize checkerboard
patterns that have more
than 96 x 96 squares ?
- Size of checkerboard
square is less than one
pixel

Image (d) indicates that


the aliasing can create
results that may be
misleading.
Example-2 (Aliasing)
Aliasing - Moiré Patterns
• Effect of sampling a scene with periodic or
nearly periodic components (e.g. overlapping
grids, TV raster lines and stripped materials).
• In image processing the problem arises when
scanning media prints (e.g. magazines,
newspapers).
• The problem is more general than sampling
artifacts.
Aliasing - Moiré Patterns (cont.)
• Superimposed grid drawings (not digitized) produce
the effect of new frequencies not existing in the
original components.
Aliasing - Moiré Patterns (cont.)
• In printing industry the problem comes
when scanning photographs from the
superposition of:
• The sampling lattice (usually horizontal and
vertical).
• Dot patterns on the newspaper image.
DFT Definitions

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 25
Table.2 ( contd.)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Summary of DFT Pairs
Summary of DFT Pairs
2-D DFT Periodicity
- Transform data in the
interval 0 to M-1
consists of two back-
to-back half periods
meeting at point M/2

- For display and


filtering purpose, it is
more convenient to
have this interval a
complete period of the
transform
Image Spectrum

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 30
Image Spectrum

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 31
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 32
Basics of Filtering in the Frequency
Domain
• Each term of F(u, v) contains all values of f(x, y)

• It usually is impossible to make direct


associations between specific components of an
image and its transform
• Some general statements can be made about the
relationship between the frequency components
of the FT and spatial features of an image
– Associate frequencies in the FT with patterns of
intensity variations in an image

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 33
Basics of Filtering in the Frequency
Domain
• The slowest varying frequency component (u = v
= 0) is proportional to the average intensity of an
image
• As we move away from the origin of the
transform, the low frequency correspond to the
slowly varying intensity components of an image
– e.g. Smooth intensity variations on walls and floor in an image of
room or a cloudless sky in an outdoor scene
• As we move further away from the origin, the
higher frequencies begin to correspond to faster
and faster intensity changes in the image
– e.g. Sharp change in intensity such as edges of objects and other
components of an image and noise

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 34
Basics of Filtering in the Frequency
Domain
• Filtering techniques in the frequency domain
are based on modifying the FT to achieve a
specific objective and then computing the
inverse DFT to get back to the image domain
• Two components of the FT to which we have
access
– Transform magnitude (Spectrum): useful
– Phase angle: generally is not very useful

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 35
Image and its Fourier Spectrum

SEM- Scanning Electron Microscope


-Prominent spectral component at 45 degree correspond to strong edges in
that direction
-Off-axis vertical spectral component caused by edges of oxide protrusions
- Angle of the frequency component w.r.t vertical axis corresponds to the
inclination of the long white element w.r.t horizontal axis
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 36
Basics of Filtering in the Frequency
Domain
• Filtering in the frequency domain consists of
modifying the FT of an image then computing the
inverse transform
• Given an image f(x, y) of size M  N, the basic
filtering equation has the form
g (x, y ) = f -1 [H ( u, v ) F ( u, v )]
• One of the simplest filters:
– H(u, v) that is 0 at the center of the transform and 1
elsewhere
• Reject DC term and Pass all other terms
• Image become much darker

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 37
Response of DC Blocking Filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 38
Basics of Filtering in the Frequency
Domain
• Lowpass filter: Filter H(u, v) that attenuates
high frequencies while passing low
frequencies would blur an image

• Highpass filter: would enhance sharp detail,


but cause a reduction in contrast in the image

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 39
2-D DFT Periodicity
Steps in Frequency Domain Filtering
Frequency Domain Filters

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 42
Image Smoothing using Frequency
Domain Filters
• Lowpass filtering
• High frequency attenuation
• Three types
– Ideal (very sharp)
– Butterworth: transition between two extremes
• Filter Order
– High: approaches ideal filter
– Low: more like Gaussian
– Gaussian (very smooth)
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 43
Image Smoothing using Frequency
Domain Filters
• Ideal Lowpass Filters (ILPF)
– Passes without attenuation all frequencies within
a circle of radius D0 from the origin and cut off all
frequencies outside this circle
– The point of transition between H(u, v) = 1 and
H(u, v) = 0 is called the cutoff frequency

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 44
Ideal Low-pass Filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 45
Image Smoothing using Frequency
Domain Filters
• One way to establish a set of standard cutoff frequency loci is
to compute circles that enclose specified amounts of total
image power PT
• A circle of radius D0 encloses percent of the power
p − Q −
PT =  P( u , v )
u = v =

 
 =   P( u , v ) / PT 
u v 
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 46
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 47
ILPF Filter Performance

48
Image Smoothing using Frequency
Domain Filters
• Butterworth Lowpass Filters (BLPF)
– BLPF of order n, and with cutoff frequency at a distance D0
– Unlike ILPF, the BLPF transfer function does not have a
sharp discontinuity that gives a clear cutoff between
passed and filtered frequencies
– Smooth transaction between low and high frequencies


H ( u ,v ) = n
 + [ D( u , v ) / D ]

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 49
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 50
BLPF Performance

51
Image Smoothing using Frequency
Domain Filters
• Gaussian Lowpass Filters (GLPF)
– BLPF of order n, and with cutoff frequency at a distance D0
– Unlike ILPF, the BLPF transfer function does not have a
sharp discontinuity that gives a clear cutoff between
passed and filtered frequencies
– Smooth transaction between low and high frequencies

− D  ( u ,v ) /  D
H ( u ,v ) = e

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 52
GLPF Response

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 53
GLPF Performance

Dr.Basant Kumar 54
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 55
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 56
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 57
Image Sharpening using Frequency
Domain Filters
• Highpass filtering
• Low frequency attenuation
• Three types
– Ideal
– Butterworth
– Gaussian

H HP ( u ,v ) =  − H LP ( u ,v )

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 58
Image Sharpening using Frequency
Domain Filters
• Ideal Highpass Filters (IHPF)

  if D( u ,v ) D

H ( u ,v ) = 
 if D( u ,v ) D

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 59
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 60
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 61
Image Sharpening using Frequency
Domain Filters
• Butterworth Highpass Filters (BHPF)


H ( u ,v ) = n
 + [ D / D( u , v )]

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 62
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 63
Image Sharpening using Frequency
Domain Filters
• Gaussian Highpass Filters (GHPF)

− D ( u ,v ) /  D
H ( u ,v ) =  − e

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 64
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 65
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 66
The Laplacian in the Frequency Domain
• Laplacian can be implemented in the
frequency domain using the filter
H ( u ,v ) = − ( u  + v  )

 −
 f ( x , y ) =  { H ( u ,v )F ( u ,v )}

g( x , y ) = f ( x , y ) + c f ( x , y )

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 67
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 68
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 69
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain
Homomorphic Filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 70
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 71
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 72
Selective Filtering
• Bandreject and Bandpass Filters
• Notch Filters

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 73
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 74
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 75
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 76
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 77
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 4
Filtering in the frequency domain

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad 78
Image Restoration and
Reconstruction

Motilal Nehru National Institute of Technology


Allahabad

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Preview
• Principal goal of restoration: to improve an
image in some predefined sense
• Attempts to recover an image that has been
degraded by using a priory knowledge of the
degradation phenomenon

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Model of Image Restoration/Degradation
• A degradation function together with an
additive noise operates on an input image
f(x,y) to produce a degraded image g(x,y)
• Given , some knowledge about the
degradation function H and some knowledge
about the additive noise term (x,y), the
objective of restoration is to obtain an
estimate f (x,y) of the original image

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Model of Image Restoration/Degradation

• In the spatial domain


g ( x, y) = h( x, y) • f ( x, y) +  ( x, y)

• In the frequency domain


G(u, v) = H (u, v) F (u, v) + N (u, v)

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Noise Models
• Principal noise sources in digital images arise
during acquisition and/or transmission
– Environmental conditions
– Quality of sensing elements
• Light
• Temperature
– Interference in the transmission channel
• Using wireless network noise due to lightening or other
atmospheric disturbance

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Noise Models
• Some noise models
– White noise: when the Fourier spectrum of noise is
constant
– Gaussian (normal) noise: used frequently in practice
– Rayleigh noise
– Erlang (gamma)
– Exponential
– Uniform
– Impulse (salt-and-pepper)
– Speckle
– Periodic
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Noise Probability Density Functions

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Noise model -Practical Examples

Noise PDF useful for modeling a broad range of noise


corruption situation found in practice

Gaussian noise- electronic circuit , sensor noise due to


poor illumination and /or high temperature
Rayleigh noise- range imaging
Exponential and gamma density– laser imaging
Impulse noise- situation of quick transients such as faulty
switching
Periodic noise- electrical and electromechanical interference
during image acquisition

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Effect of Noise Addition

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Effect of Noise Addition

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Periodic Noise -Example

Periodic noise can be reduced


significantly via frequency domain
filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Noise Models
• Estimation of noise parameters
– May be known partially from sensor specification
but necessary to estimate for a particular imaging
arrangement
• Capture a set of images of “flat” environments
– e.g.in case of optical sensor, imaging a solid gray board that is
illuminated uniformly. The resulting image is good indicators
of system noise

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Estimation of noise parameters

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Performance of Spatial Filters in Noise
Reduction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Performance of Spatial Filters in Noise
Reduction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 5
Image Restoration and Reconstruction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 5
Image Restoration and Reconstruction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 5
Image Restoration and Reconstruction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Digital Image Processing, 3rd ed.
Gonzalez & Woods
Chapter 5
Image Restoration and Reconstruction

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Outline
• A model of the image degradation / restoration process
• Noise models
• Restoration in the presence of noise only – spatial
filtering
• Periodic noise reduction by frequency domain filtering
• Linear, position-invariant degradations
• Estimating the degradation function
• Inverse filtering

Dr. Basant Kumar


Motilal Nehru National Institute of Technology, Allahabad
Additive noise only

g(x,y)=f(x,y)+(x,y)
G(u,v)=F(u,v)+N(u,v)
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Spatial filters for de-noising
additive noise
• Skills similar to image enhancement
• Mean filters
• Order-statistics filters
• Adaptive filters

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Mean filters
• Arithmetic mean
ˆf ( x, y ) = 1
 g ( s, t )
mn ( s ,t )S xy
Window centered at (x,y)

• Geometric mean
1 / mn
ˆf ( x, y ) =   g ( s, t )
( s ,t )S xy 
 

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
original Noisy
Gaussian
m=0
s=20

Arith. Dr.Basant Kumar


Geometric
mean Motilal Nehru National Institute of Technology, Allahabad mean
Mean filters (cont.)
• Harmonic mean filter
mn
fˆ ( x, y ) =
1

( s ,t )S xy g ( s, t )
• Contra-harmonic mean filter
 g ( s ,
( s ,t )S xy
t ) Q +1

fˆ ( x, y ) =
 g ( s ,
( s ,t )S xy
t ) Q
Q=-1, harmonic
Q=0, airth. mean
Q=+, ?
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Pepper Salt
Noise Noise
黑點 白點

Contra- Contra-
harmonic harmonic
Q=1.5 Q=-1.5
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Wrong sign in contra-harmonic filtering

Q=-1.5 Dr.Basant Kumar


Motilal Nehru National Institute of Technology, Allahabad
Q=1.5
Order-statistics filters
• Based on the ordering(ranking) of pixels
– Suitable for unipolar or bipolar noise (salt and
pepper noise)
• Median filters
• Max/min filters
• Midpoint filters
• Alpha-trimmed mean filters

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Order-statistics filters
• Median filter
fˆ ( x, y) = median{g ( s, t )}
( s ,t )S xy

• Max/min filters
fˆ ( x, y ) = max {g ( s, t )}
( s ,t )S xy

fˆ ( x, y) = min {g (s, t )}
( s ,t )S xy

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
bipolar 3x3
Noise Median
Pa = 0.1 Filter
Pb = 0.1 Pass 1

3x3 3x3
Median Median
Filter Dr.Basant Kumar
Filter
Pass 2 Motilal Nehru National Institute of Technology, Allahabad Pass 3
Pepper Salt
noise noise

Max Min
filter filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Order-statistics filters (cont.)
• Midpoint filter
ˆf ( x, y ) = 1  max {g ( s, t )} + min {g ( s, t )}
2 ( s ,t )S xy ( s ,t )S xy 

• Alpha-trimmed mean filter


– Delete the d/2 lowest and d/2 highest gray-level
pixels
1
fˆ ( x, y ) =
mn − d
 g ( s, t )
( s ,t )S xy
r
Middle (mn-d) pixels

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Order-statistics filters (cont.)
◼ Midpoint filter
ˆf ( x, y ) = 1  max {g ( s, t )} + min {g ( s, t )}
2 ( s ,t )S xy ( s ,t )S xy 

◼ Alpha-trimmed mean filter


◼ Delete the d/2 lowest and d/2 highest gray-level
pixels
1
fˆ ( x, y ) =
mn − d
 g ( s, t )
( s ,t )S xy
r
Middle (mn-d) pixels

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Uniform noise Left +
m=0 Bipolar Noise
s2=800 Pa = 0.1
Pb = 0.1

5x5 5x5
Arith. Mean Geometric
filter mean

5x5 5x5
Median Alpha-trim.
filter Filter
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
d=5
Adaptive filters
◼ Adapted to the behavior based on the
statistical characteristics of the image inside
the filter region Sxy
◼ Improved performance v.s increased
complexity
◼ Example: Adaptive local noise reduction filter

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Adaptive local noise reduction
filter
◼ Simplest statistical measurement
◼ Mean and variance
◼ Known parameters on local region Sxy
◼ g(x,y): noisy image pixel value
◼ s2: noise variance (assume known a prior)
◼ mL : local mean
◼ s2L : local variance

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Adaptive local noise reduction
filter (cont.)
◼ Analysis: we want to do
◼ If s2 is zero, return g(x,y)
◼ If s2L> s2 , return value close to g(x,y)
◼ If s2L= s2 , return the arithmetic mean mL
◼ Formula
ˆf ( x, y ) = g ( x, y ) − s  g ( x, y ) − m 
2

sL
2 L

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Gaussian Arith.
noise
m=0 mean
s2=1000 7x7

Geometric
mean
7x7 Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad adaptive
Outline
◼ A model of the image degradation / restoration
process
◼ Noise models
◼ Restoration in the presence of noise only – spatial
filtering
◼ Periodic noise reduction by frequency domain
filtering
◼ Linear, position-invariant degradations
◼ Estimating the degradation function
◼ Inverse filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Periodic noise reduction
◼ Pure sine wave
◼ Appear as a pair of impulse (conjugate) in the
frequency domain

f ( x, y) = A sin( u0 x + v0 y)
A u0 v0 u0 v0 
F (u, v) = − j  (u − , v − ) −  (u + ,v + )
2 2 2 2 2 

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Periodic noise reduction (cont.)
◼ Bandreject filters
◼ Bandpass filters
◼ Notch filters
◼ Optimum notch filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Bandreject filters
* Reject an isotropic frequency

ideal Butterworth Gaussian

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
spectrum

noisy
filtered

bandreject

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Bandpass filters
◼ Hbp(u,v)=1- Hbr(u,v)

 G(u, v) Hbp (u, v)


−1

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Notch filters
◼ Reject(or pass) frequencies in predefined
neighborhoods about a center frequency

ideal

Butterworth Gaussian
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Horizontal
Scan lines

Notch
DFT pass

Notch
Dr.Basant Kumar Motilal Nehru
Notch
National Institute of Technology,
pass
Allahabad reject
Outline
◼ A model of the image degradation / restoration
process
◼ Noise models
◼ Restoration in the presence of noise only – spatial
filtering
◼ Periodic noise reduction by frequency domain
filtering
◼ Linear, position-invariant degradations
◼ Estimating the degradation function
◼ Inverse filtering

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
A model of the image
degradation /restoration process

g(x,y)=f(x,y)*h(x,y)+(x,y)
G(u,v)=F(u,v)H(u,v)+N(u,v)
If linear, position-invariant system
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Linear, position-invariant
degradation
Properties of the degradation function H

◼ Linear system
◼ H[af1(x,y)+bf2(x,y)]=aH[f1(x,y)]+bH[f2(x,y)]
◼ Position(space)-invariant system
◼ H[f(x,y)]=g(x,y)
◼  H[f(x-a, y-b)]=g(x-a, y-b)
◼ c.f. 1-D signal
◼ LTI (linear time-invariant system)
Dr.Basant Kumar Motilal Nehru
National Institute of Technology,
Allahabad
Linear, position-invariant
degradation model
◼ Linear system theory is ready
◼ Non-linear, position-dependent system
◼ May be general and more accurate
◼ Difficult to solve compuatationally
◼ Image restoration: find H(u,v) and apply
inverse process
◼ Image deconvolution

Dr.Basant Kumar Motilal Nehru


National Institute of Technology,
Allahabad
Estimating the degradation
function
◼ Estimation by Image observation
◼ Estimation by experimentation
◼ Estimation by modeling

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Estimation by image
observation
◼ Take a window in the image
◼ Simple structure
◼ Strong signal content
◼ Estimate the original image in the window
known
Gs (u, v)
H s (u, v) =
Fˆs (u, v)
estimate
Dr.Basant Kumar Motilal Nehru
National Institute of Technology,
Allahabad
Estimation by experimentation
◼ If the image acquisition system is ready
◼ Obtain the impulse response

impulse Impulse response


Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Estimation by modeling (1)
− k ( u 2 + v 2 )5 / 6
◼ Ex. Atmospheric model H (u, v) = e

original k=0.0025

k=0.001 k=0.00025

Dr.Basant Kumar Motilal Nehru


National Institute of Technology,
Allahabad
Estimation by modeling (2)
◼ Derive a mathematical model
◼ Ex. Motion of image
T
g ( x, y) =  f ( x − x0 (t ), y − y0 (t ))dt
0

Fourier Planar motion


transform
T
G(u, v) = F (u, v)  e − j 2 [ ux0 ( t ) + vy0 ( t )]
dt
0

Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Estimation by modeling: example

original Apply motion model

Dr.Basant Kumar Motilal Nehru


National Institute of Technology,
Allahabad
Inverse filtering
◼ With the estimated degradation function
H(u,v)
Unknown
G(u,v)=F(u,v)H(u,v)+N(u,v) noise

=> Fˆ (u, v) = G (u, v) = F (u, v) + N (u, v)


H (u, v) H (u, v)
Problem: 0 or small values
Estimate of
Sol: limit the frequency
original image
around the origin
Dr.Basant Kumar
Motilal Nehru National Institute of Technology, Allahabad
Full Cut
inverse Outside
filter 40%
for
k=0.0025

Cut Cut
Outside Outside
70% 85%
Dr.Basant Kumar Motilal Nehru
National Institute of Technology,
Allahabad
DIGITAL IMAGE PROCESSING

Chapter 6: Color Image Processing

Submitted to
Dr. Basant Kumar
(Associate Professor)
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY

ALLAHABAD-211004, INDIA
Spectrum of White Light

Fig 1.1 Color Spectrum seen by passing white light through a prism

1666 Sir Isaac Newton, 24 year old, discovered white light


spectrum
Electromagnetic Spectrum

Fig 1.2 Electromagnetic Spectrum


Visible light wavelength: from around 400 to 700 nm

1. For an achromatic (monochrome) light source,


there is only 1 attribute to describe the quality: intensity

2. For a chromatic light source, there are 3 attributes to describe the


quality:

Radiance = total amount of energy flow from a light source (Watts)


Luminance = amount of energy received by an observer (lumens)
Brightness = intensity
Color of Light
•Perceived color depends on spectral content (wavelength composition)
e.g. 700 nm ~ red.

Fig 1.3 Spectrum of light

•A light with equal energy in all visible bands appears white.


Two Types of Photoreceptors at Retina

•Rods
–Long and thin
–Large quantity (~ 100 million)
–Provide scotopic vision (i.e., dim light vision or at low
illumination)
–Only extract luminance information and provide a general overall
picture
• Cones
–Short and thick, densely packed in fovea (center of retina)
–Much fewer (~ 6.5 million) and less sensitive to light than rods
–Provide photopic vision (i.e., bright light vision or at high illumination)
–Help resolve fine details as each cone is connected to its own nerve end
–Responsible for color vision

❑ Mesopic vision

--provided at intermediate illumination by both rods and cones


Sensitivity of Cones in the Human Eye
7 millions cones in a human
eye
-65% sensitive to Red light
-33% sensitive to Green
light
-2 % sensitive to Blue light

Primary Colors:
Defined CIE in 1931
Red = 700 nm
Green = 546.1 nm
Fig 1.4 Sensivity Curve
Blue = 435.8nm
Primary and Secondary Colors
Additive primary colors: RGB use
in the case of light sources such as
color monitors

RGB add together to get white

Subtractive primary colors: CMY


used in the case of pigments in
printing devices

White subtracted by CMY to get


Fig 1.5 Set of RGB and CMY colors Black
Seeing Yellow without Yellow

Mix green and red light to obtain


perception of yellow, without
shining a single yellow photon.
Fig 1.6 Absorption of light in the human eye as a function
of wavelength
Color Characterization
Hue: dominant color corresponding to a dominant
wavelength of mixture light wave
Saturation: Relative purity or amount of white light mixed
with a hue (inversely proportional to amount of white light
added)
Brightness: Intensity

Hue Chromaticity
Saturation

Amount of red (X), green (Y) and blue (Z) to form any particular color is called tristimulus.
Perceptual Attributes of Color
❑ Value of Brightness i.e. perceived luminance.
❑ Chrominance
• Hue
o specify color tone (redness, greenness, etc.)
o depend on peak wavelength

• Saturation
o describe how pure the color is
o depend on the spread (bandwidth) of light spectrum
o reflect how much white light is added
RGB Color Model
Purpose of color models: to facilitate
the specification of colors in some
standard.

RGB color models:


Based on cartesian coordinate system.

Fig 1.7 RGB Color Model


RGB Color Cube
Color depth 24 bits
R = 8 bits
= 16777216 colors
G = 8 bits
B = 8 bits

Hidden faces
of the cube
Safe RGB Colors
Safe RGB colors: a subset of
RGB colors.
There are 216 colors common in
most operating systems.

Fig 1.8 The 216 safe RGB Colors


and All the grays in the 256 RGB
system
RGB Safe-color Cube
The RGB Cube is divided
Table 1.1 Valid
into 6 intervals on each axis
values of each RGB to achieve the total 6 =
3
component in a safe
color. 216 common colors.
However, for 8 bit color
representation, there are the
total 256 colors. Therefore,
the remaining 40 colors are
left to OS.
CIE Chromaticity Diagram

Trichromatic coefficients:

x
Fig 1.9 Chromaticity Diagram Points on the boundary are fully saturated colors.
C= Cyan
CMY and CMYK Color Models M = Magenta Y = Yellow
K = Black
•Primary colors for pigment
–Defined as one that subtracts/absorbs a primary color
of light & reflects the other two
•CMY – Cyan, Magenta, Yellow
–Complementary to RGB
–Proper mix of them produces black
HSI Color Model
RGB, CMY models are not good for human interpreting
HSI Color model:
Hue: Dominant color
Color
carrying
Saturation: Relative purity (inversely proportional to amount of information
white light added)

Intensity: Brightness
Hue and Saturation on Color Planes

1.A dot is the plane is


an arbitrary color
2.Hue is an angle from
a red axis.
3.Saturation is a
distance to the point

Fig 1.10 Hue and Saturation on Color Planes


HSI Color Model (contd.)

Intensity is given by a position on the vertical axis.


HSI Color Model (contd.)

Intensity is given by a position on the vertical axis.


Converting Colors from RGB to HSI
Converting Colors from HSI to RGB
Example: HSI Components of RGB Colors

RGB
HUE
IMAGE

SATURATION INTENSITY

Fig 1.11 RGB Image and the components of the


corresponding HIS Image.
Color Image Processing

There are 2 types of color image processes

1. Pseudocolor image process: Assigning colors to gray values based on a


specific criterion. Gray scale images to be processed may be a single
image or multiple images such as multispectral images
2. Full color image process: The process to manipulate real color images
such as color photographs.
Pseudocolor Image Processing
Pseudo color = false color : In some case there is no “color” concept for a gray scale
image but we can assign “false” colors to an image. We need to assign colors to gray
scale image, because humans can distinguish different colors better than different
shades of gray.
Intensity Slicing or Density Slicing
Formula:

C1 = Color No. 1
C2 = Color No. 2

A gray scale image viewed as a 3D surface


Intensity Slicing Example

An X-ray image of a weld with cracks

After assigning a yellow color to pixels with


value 255 and a blue color to all other pixels.
Multi Level Intensity Slicing
Ck = Color No. k
lk = Threshold level k
Multi Level Intensity Slicing Example

An X-ray image of the Picker After density slicing into 8 colors


Thyroid Phantom.
Color Coding Example

Color coded image South America region


Gray Level To Color Transformation
Assigning colors to gray levels based on specific mapping functions
Gray Level to Color Transformation Example
Gray Level to Color Transformation Example
Pseudo Color Coding
Used in the case where there are many monochrome images such as multispectral
satellite images.
Pseudo Color Coding Example
Pseudo Color Coding Example
Visible blue Visible green
λ= 0.45-0.52 μm λ= 0.52-0.60 μm
Max water penetration Measuring plant Color composite images

Better visualization 🡪 Show quite


clearly the difference between
biomass (red) and human-made
features.
Visible red Near infrared
λ= 0.63-0.69 μm λ= 0.76-0.90 μm
Plant discrimination Biomass and shoreline mapping
Pseudo Color Coding Example

Psuedocolor rendition
of Jupiter’s moon Io

Yellow areas = older sulfur deposits.


Red areas = material ejected from
active volcanoes.

A close-up
Basics of Full Color Image Processing
Methods:
1. Per-color-component processing: process each component separately.
2. Vector processing: treat each pixel as a vector to be processed.
Example of per-color-component processing: smoothing an image by smoothing each
RGB component separately (shown below)
Example: Full Color Image and Various Color Space
Components
Color image

CMYK components

RGB components

HSI components
Color Transformation
Used to transform colors to colors.
Formula:

f(x,y) = input color image, g(x,y) = output color image


T = operation on f over a spatial neighborhood of (x,y)
When only data at one pixel is used in the transformation, we can express the transformation as:

i=1,2,…,n

where ri = color component of f(x,y)


si = color component of g(x,y)
For RGB images, n = 3
Example: Color Transformation
Formula for RGB:

Formula for HSI:


k = 0.7

Formula for HSI:

These 3 transformations give the same results.


Color Components

Color complement replaces each color with its opposite color in the color circle of
the Hue component. This operation is analogous to image negative in a gray scale
image.
Color Transformation Example
Color Slicing Transformation
We can perform “slicing” in color space: if the color of each pixel is far from a
desired color more than threshold distance, we set that color to some specific color
such as gray, otherwise we keep the original color unchanged.
Color Slicing Transformation Example

After color slicing

Original image
Tonal Correction Examples
Color Balancing Correction Examples
Histogram Equalization of a Full Color Image
Histogram equalization of a color image can be performed by adjusting color
intensity uniformly while leaving color unchanged.

The HSI model is suitable for histogram equalization where only Intensity (I)
component is equalized.

where r and s are intensity components of input and output color image.
Histogram Equalization of a Full Color Image
Color Image Smoothing

Let Sxy denote the set of coordinates defining a neighborhood centered at (x, y) in an RGB
color image. The average of the RGB component vectors in this neighborhood is

It follows from eq(6.4.2) and the properties of vector addition that


We recognize the components of this vector as the scalar images that would be obtained by
independently smoothing each plane of the RGB image using conventional gray-scale
neighborhood processing.

Thus, we conclude that smoothing by neighborhood averaging can be carried out on a per-
color-plane basis.
Fig 6.39(a) through (c) show the HSI components of the image. Fig 6.40(a) shows smoothed, full-color RGB image.
Color Image Sharpening

From vector analysis, we know that the Laplacian of a vector is defined as a vector whose
components are equal to the Laplacian of the individual scalar components of the input
vector. In the RGB color system, the Laplacian of vector c in Eq.(6.4-2) is

which tells us that we can compute the Laplacian of a full-color image by computing the
Laplacian of each component image separately.
Figure 6.41(b) shows a similarly sharpened image based on the HSI components in Fig.6.39. This result was
generated by combining the Laplacian of the intensity component with the unchanged hue and saturation
components.
There are 2 methods for color segmentation:
1. Segmented in HSI color space:
A thresholding function based on color information in H and S Components. We
rarely use I component for color image segmentation.
If we want to segment a image based on color we naturally think first of the HSI color
space because color is conveniently represented in hue image.

1. Segmented in RGB vector space:


A thresholding function based on distance in a color vector space.
Example of Color Segmentation in HSI color space (From colored image to segmentation
of red pixels):
Color segmentation in RGB vector space:
● Each point with (R,G,B) coordinate in the vector space represents one color.
● There are 3 approaches for enclosing data regions in RGB vector space these are
1)Spherical 2) Circular 3) Cubic
region
● Segmentation is based on distance thresholding in a vector space.
Example of color segmentation in RGB vector space:
Color Edge Detection
We are interested in the issue of computing edges on an individual-image basis versus
computing edges directly in color vector space.
Edge detection by gradient operators is define only for a scalar image, there is no concept
of gradient for a color image. We can’t compute gradient of each color component and
combine the results to get the gradient of a color image.

Fig:(a)–(c) R,G, and B component


images and (d) resulting RGB color
image. (e)–(g) R,G, and B
component images and (h) resulting
RGB color image.
Color Edge Detection using Gradient formula
One way to compute the maximum
rate of change of a color image
which is close to the meaning of
gradient is to use the gradient
formula.

Fig:(a) RGB image.(b) Gradient computed in


RGB color vector space.
(c) Gradients computed on a per-image basis
and then added.(d) Difference
between (b)and (c).
Noise in Color images

Noise can abrupt each color


component independently.
(a),(b)
(c),(d)
Fig:(a)-(c)-Red , green and blue components
of the image corrypted by additive white
gaussian noise of mean 0 and variance 800.
(d) Resulting RGB image.
HSI components of noisy image

(a),(b),(c)
Fig: HSI components of noisy color image in fig . (a)Hue, (b) Saturation , (c) Intensity
Color Image Compression

After lossy compression with ratio 230:1


Image Segmentation
Subject: Advanced Digital Signal & Image Processing
(EC18101 )

BASANT KUMAR
ECED, MNNIT ALLAHABAD
Image Segmentation
 Image segmentation divides an image into regions that are
connected and have some similarity within the region and
some difference between adjacent regions.
 The goal is usually to find individual objects inan image.

 There are fundamentally two kinds of approaches to


segmentation: discontinuity andsimilarity.
– Similarity may be due topixel intensity, color or texture.

– Differences are sudden changes (discontinuities) in any of these, but


especially sudden changes in intensity along a boundary line, which is called
an edge.
Detection of Discontinuities

• There are three kinds of discontinuities of intensity: points,


lines and edges.
• The most common way to look for discontinuities is to scan a
small mask over the image. The mask determines which kind
of discontinuity to look for.
9
R  w1z1  w2 z2  ... w9 z9   wi zi
i1
Point Detection

RT
where T : a nonnegative threshold
Line Detection

• Only slightly more common than point detection is to find a


one pixel wide line in an image.
• For digital images , only three point straight lines are
horizontal, vertical, or diagonal (+ or –45).
Line Detection
Edge Detection
Edge Detection approach is most frequently used for
segmenting images based on abrupt changes in intensity
Edge model classification:
1. Step edge 2. Ramp edge
Edge Detection

Step edge- Ex- In computer generated images , for representing areas


such as solid modeling and animation
- Ideal edges can occur over the distance of 1 pixel
- Canny edge detection algorithm , derived from step edge

Ramp edge- In practice, digital images have edges that are blurred and
noisy--- more closely modeled as ramp edge

Roof Edge- roof edges appear in range imaging, when the thin objects
(such as pipes) are closer to sensor than the equidistant background
Edge Detection

Observations
- Magnitude of the first derivative can be used to
detect the presence of an edge at a point in an image
-Sign of second derivative can be used to determine
whether an edge pixel lies on dark or light side of an
edge ( +ive at the beginning of ramp and –ive at the
end of the ramp)
- Zero crossings can be used for locating centers of
thick edges
Edge Detection in Presence of Noise

-Graph below each image


is intensity profile passing
through center of the
image
- Sensitivity of derivatives
to noise is shown here
- Second derivative is
more sensitive to noise
Edge Detection in Presence of Noise
The fact that little visual
noise can have such a
significant impact on the
two key derivatives used for
detecting edges.
important issue to keep in
mind

Image smoothing should be a


serious consideration prior to
the use of derivatives in noisy
images
Gradient Operators

• First-order derivatives:
– The gradient of an image f(x,y) at location (x,y)is
defined as the vector:
G x   f
x

f      f 
G y  y 
x
– The magnitude of this vector: f  mag(f)  G 2  G 2
y 
1
2

 Gx 
– The direction of this vector:  (x, y)  tan  
1
G 
 y
– It points in the direction of the greatest rate of change
of f at location (x,y)
Properties of the Gradient
Direction of an edge at any arbitrary point (x, y) is orthogonal to the direction α(x, y) , of
the gradient vector at the point
Ex- Zoomed section of an image containing a straight edge segment. Each square
corresponds to a pixel
Gradient Operator Masks
Masks of 2X2 are simple , but they are not as useful for computing edge direction
as ---not symmetric about the center point

Roberts cross-gradient operators

Prewitt operators

Sobel operators
Preferable
Better noise-suppression characteristics
( smoothing )
Prewitt Sobel

Simpler to implement Better noise suppression


(smoothing)
Give isotropic results only for Give isotropic results only for
vertical and horizontal edges vertical and horizontal edges
Preferred because noise
suppression is an important issue
when dealing with derivatives .

The coefficients of all mask sum to zero. That


gives a response of zero to an areas of constant
intensity.

15
Gradient Operator Masks

Prewitt masks for


detecting diagonal edges

Sobel masks for


detecting diagonal edges
Requires that gx and gy be combined. However, it
is hard to compute thus we will use approximate
value.

M (x, y)  g x  g y

17
Sobel Operator Results : Example

f  Gx  G y

Fine details
act as noise,
hence,
enhanced by
derivative
operator
Gradient Angle: Example
In general, angle images as not as useful as gradient magnitude images for edge
detection, but they do complement the information extracted from an image using the
magnitude of the gradient
Gradient Operator after smooth filtering
sometimes we would use threshold on the gradient
image to achieve the same results.
Pixels with values greater than threshold are shown
white and the other are shown black.

Threshold
Smooth a n
d
the gradient
threshold
image

21
Gradient Diagonal Operators: Example
Second-order derivatives

• Second-order derivatives: (The Laplacian)


– The Laplacian of an 2D function f(x,y) is defined as
2 f 2 f
 f  2  2
2
x y

– Two forms in practice:


Advanced Edge detection
 The basic edge detection method is based on
simple filtering without taking note of image
characteristics and other information.
 More advanced techniques make attempt to
improve the simple detection by taking into
account factors such as noise, scaling etc.
 We introduce 2 techniques:
 Marr-Hildreth [1980]

 Canny [1986]

24
Marr-Hildreth edge detector (1980)
Marr and Hildreth
argued -
1)Intensity changes are dependent of image scale and so their
detection requires the use of operators different sizes
2)That a sudden intensity change will give rise to a peak or
trough in the first derivative or, equivalently, to zero crossing in
the second derivative.
Two salient feature:
1)It should be differential operator capable of computing first or
second order derivatives at every point in an image
2)It should be capable of being tuned to act at any desired
scale, so that large operator can be used to detect blurry edges
and small operators to detect sharply focused fine detail
Marr-Hildreth edge detector

• Consider the function: A Gaussian function


 r2
h(r)  e 2 2
where r 2  x 2  y 2
and  : the standard deviation
• The Laplacian of h is
 r2
r   2 2
 The Laplacian of a
 h(r)   2 2
e
2
Gaussian (LoG)
  4

• The Laplacian of a Gaussian sometimes is called the Mexican
hat function. Italso can be computed by smoothing the image
with the Gaussian smoothing mask, followed by applicationof
the Laplacian mask.
Laplacian of a Gaussian ( LoG)
What does it do?
 The Gaussian blurs the image by reducing the
intensity of structures (such as noise) at scales
much lower than σ.
 The Laplacian part is responsible for detecting
the edges due to the sensitivity of second
derivative.
 Since filter is linear action these two filters can
be applied separately, thus allowing us to use
different sized filters for each of the actions.

28
The algorithm

 The algorithm is:


 Filter image with nxn Gaussian filter

 Compute the Laplacian using for example a


3x3 mask.
 Find the zero crossings

 To find a zero crossing it is possible to use 3x3


mask that checks sign changes around a pixel.
 Sometimes it is suggested to use the algorithm
with different σ and then to combine the results.

29
Edge Detection
 The Laplacian of Gaussian (LoG)
Canny edge detector

 Basic objectives:

 Low error rate – Edge detected must be as


close as possible to the true edge.
 Single edge point response – The detector
should return only one point for each true
edge point.

51
Step 1 – Smooth image
 Create a smoothed image from the original one
using Gaussian function.
𝑥2+𝑦2
𝐺 𝑥,𝑦 = 𝑒− 2𝜎2

𝑓
𝑠 𝑥,𝑦 = 𝐺(𝑥,𝑦) 𝑓(𝑥, 𝑦)

52
Step 2 – Compute Gradient
 We located the edges using direction of the point
with the same method as basic edge detection –
gradient:
𝜕𝑓
𝑠 𝜕𝑓𝑠
𝑔𝑥= 𝑔𝑦=
𝜕𝑥 𝜕𝑦

𝑔𝑦
𝑀 𝑥,𝑦 = 𝑔2 𝑥
+ 𝑔2 𝑦
∝ 𝑥,𝑦 = tan−1
𝑔𝑥

53
Step 3 – Nonmaxima suppression
 Edges generated using gradient typically contain wide
ridges around local maxima.
 We will locate the local maxima using non-
maxima suppression method.
 We will define a number of discrete orientations. For
example in a 3x3 region 4 directions can be defined.
 We have to quantize all possible edge directions into
four
 Define a range of angles for the four possible directions

54
Step 3 – Nonmaxima suppression

-two possible orientations of a horizontal edge

55
Step 3 – Nonmaxima suppression

 We will now generate a local maxima function


For each point:

1. Find the direction 𝑑𝑘that is closest to ∝ 𝑥,𝑦


2. If the value of 𝑀𝑥,𝑦 is less than at least one of
two neighbors along 𝑑𝑘, 𝑔𝑁 𝑥,𝑦 = 0 otherwise 𝑔𝑁 𝑥,𝑦
=
𝑀𝑥,𝑦.

In the figure in the previous slide we would compare 𝑝5to 𝑝2


and 𝑝8.

56
Step 4 – Double Thresholding
 The received image may still contain false edge
points.
 We will reduce them using hysteresis (or double)
thresholding.
Let 𝑇𝐿, 𝑇𝐻be low and high thresholds. The suggested ratio is 1:3
or 2:3. We will define 𝑔𝑁𝐻 𝑥, 𝑦 and 𝑔𝑁𝐿 𝑥, 𝑦 to be 𝑔𝑁 𝑥, 𝑦 after
threshloding it with 𝑇𝐿, 𝑇𝐻.
It is clear that 𝑔𝑁𝐿 𝑥, 𝑦 contains all the point located in 𝑔𝑁𝐻 𝑥, 𝑦. We
will separate them by substruction:
𝑔𝑁𝐿 𝑥,𝑦 = 𝑔𝑁𝐻 𝑥,𝑦 − 𝑔𝑁𝐿 𝑥,𝑦
Now 𝑔𝑁𝐿 𝑥,𝑦 and 𝑔𝑁𝐻 𝑥,𝑦 are the “weak” and the “strong” edge
pixels.

57
Step 4 – Double Thresholding
 The algorithm for building the edges is:
1. Locate the next unvisited pixel 𝑝in 𝑔𝑁𝐻 𝑥,𝑦.
2. Mark as valid pixels all the weak pixels in 𝑔𝑁𝐿 𝑥,𝑦 that are
connected to 𝑝
3. If not all non-zero pixels in 𝑔𝑁𝐻 𝑥,𝑦 have been visited return to
step 1.
4.Set all the non-marked pixels in 𝑔𝑁𝐿 𝑥,𝑦 to 0. 5.
Return 𝑔𝑁𝐻 𝑥,𝑦 + 𝑔𝑁𝐿 𝑥,𝑦.

58
Example 1
Example 2
Edge Linking introduction

Ideally, edge detection should yield sets of pixels


lying only on edges. In practice, these pixels seldom
characterize edges completely because of noise or
breaks in the edges.
Therefore, edge detection typically is followed by
linking algorithms designed to assemble edge pixels
into meaningful edges and/or region boundaries.
We will introduce two linking techniques.

62
Local processing

All points that are similar according to predefined


criteria are linked, forming an edge of pixels that
share common properties.
Similarity according to:
1. Strength (magnitude)
2. Direction of the gradient vector

63
Local processing
1. Compute the gradient magnitude and angle arrays, M(x,y)
and α(x,y), of the input image, f(x,y) .
2. Form a binary image, g, whose value at any pair of
coordinates (x,y) is given by:

1 if M (x, y)  TM AND (x, y)  A  TA 


g(x, y)   
0 otherwise 
where TM is a threshold, A is a specified angle direction, and ±TA
defines a “band” of acceptable directions about A

3. Scan the rows of g and fill (set to 1) all gaps (sets of 0s) in each row
that do not exceed a specified length, K. Note that, by definition, a
gap is bounded at both ends by one or more 1s. The rows are
processed individually with no memory between them.
4. To detect gaps in any other direction, θ, rotate g by this angle and
apply the horizontal scanning procedure in step 3. Rotate the result
back by -θ.
64
Example –Edge linking using local processing

65
Global processing
 Good for unstructured environments.
 All pixels are candidate for linking.
 Need for predefined global properties.

What we are looking for?


 Decide whether sets of pixels lie on curves
of a specified shape.

66
Trivial application
 Given n points.
 We want to find subset of n that lie on straight
lines:
 Find all lines determined by every pair of points
 Find all subset of points that are close to particular

lines.
n*(n-1)/2 + n*(n*(n-1))/2 ~ n^2+ n^3.

Too hard to compute.

67
Hough transform

 The xy-plane:
 Consider a point (xi,yi). The general equation
of a straight line : yi = axi +b.
 Many lines pass through (xi,yi). They all
satisfy : yi = axi +b for varying values of a and
b.

68
Hough transform

 The ab-plane: (Parameter space)


 Consider a point (xi,yi). The general equation
of a straight line : b=-xia+yi.
 Single line for a fixed pair (xi,yi). –line 1
y
b
(xi,yi) b=-xia+yi

x a

69
Hough transform
 (xj, yj) also has a line in parameter space
associated with it. – line 2.
 Unless line1 and line 2 are parallel they
intersects at some point (a’, b’) where a’ is the
slope and b’ the intercept of the line containing
both (xj, yj) and (xi,yi).
y b’ b
(xi,yi) b=-xia+yi

a’
(xj,yj)

b=-xja+yj
x a

70
Edge Linking and Boundary Detection
Global Processing via the Hough Transform

• Hough transform: a way of finding edge points in animage


that lie along a straight line.
• Example: xy-plane v.s. ab-plane (parameter space)
yi  axi  b
Hough transform

 Parameter – space lines corresponding to all


points (xk,yk) in the xy-plane could be plotted
and the principal lines in that plane could be
found by identifying points in parameter
space where large numbers of lines intersect.

71
Hough transform
 Using yi=axi+b , slope approaches infinity
when lines approach the vertical direction.

Solution?

x cos  ysin  
Normal representation of a line.

72
Hough transform
 Each line is transformed into a sinusoidal in the
ρθ-plane, where
 ρ – The distance between the line and the origin .
 θ – The angle between the distance vector and the
positive x-axis .

 eventually all sinusoidals that intersect at a specific point


(ρ’,θ’) transform back to specific points on the same line
in the xy-plane
73
Hough transform
 We divide the ρθ-plane into accumulator cells between
the minimum and maximum values of ρ and θ.
 Each cell has a value of zero .
 For every point (xk,yk) in the xy-plane we calculate ρ’s for
all allowed values of θ.
 For every result (ρp,θq) we raise the value of the
corresponding cell (p,q) by 1.

74
Hough transform

 At the end of the process, the value P of the


cell A(i,j) represents a number of P points in
the xy-plane that lie on the x cosj  y sin j  i
line.
 The number of sub-divisions determines the
accuracy of the co-linearity of the points.

75
Edge Linking and Boundary Detection
Hough Transform Example
The intersection of the
curves corresponding
to points 1,3,5

2,3,4

1,4
Hough transform – Edge
linking
Algorithm :
1. Obtain a binary edge image using any of the
techniques discussed earlier in this section
2. Specify subdivisions in the ρθ –plane.

3. Examine the counts of the accumulator cells for


high pixel concentrations .
4. Examine the relationships (principally for
continuity) between pixels in a chosen cell .

78
Edge Linking and Boundary Detection
Hough Transform Example
Thresholding
Finding histogram of gray level intensity.
Basic Global Thresholding
Optimum Global Thresholding (Otsu’s Method)
Multiple Threshold
Variable Thresholding

59
Thresholding

• Assumption: the range of intensity levels covered by objects of


interest is different from the background.
1 if f (x, y)  T
g(x, y)  
0 if f (x, y)  T

Single threshold Multiple threshold


Role of Noise in Image Thresholding
Role of Illumination and Reflectance

Similar results would be obtained if the illumination was uniform, but


reflectance of the image was not uniform
Role of Illumination and Reflectance
Illumination and reflectance play a central role in the
success of image segmentation using Thresholding or
other techniques
- If possible, control these parameters
- Three basic approaches when controlling of these
parameters not possible
1. Correct the shading pattern directly. Ex- multiply the
image by the inverse of the pattern
2. Attempt to correct the global shading pattern . Ex –
apply top-hat transformation
3. Apply variable Thresholding methods
Basic Global Thresholding
• Basic global thresholding:
• The success of this technique very strongly depends on how well the
histogram can be partitioned
Basic global Thresholding Algorithm

• The Basic global Thresholding Steps


1. Select an initial estimate for T (typically the average grey level
in the image)
2. Segment the image using T to produce two groups of pixels: G1
consisting of pixels with grey levels >T and G2 consisting pixels
with grey levels ≤ T
3. Compute the average grey levels of pixels in G1 to give μ1 and
G2 to give μ2
4. Compute a new threshold value:
  2
T 1
2
5. Repeat steps 2 – 4 until the difference in T in successive iterations
is less than a predefined limit T∞

This algorithm works very well for finding thresholds when the histogram
is suitable.
Example – Multiple Thresholding

69
Variable Thresholding – Example
Region-Based Segmentation

• Edges and thresholds sometimes do not give good


results for segmentation.
• Region-based segmentation is based on the
connectivity of similar pixels in a region.
– Each region must be uniform.
– Connectivity of the pixels within the region is very
important.
• There are two main approaches to region-based
segmentation: region growing and region splitting.
Region-Based Segmentation Basic Formulation

• Let R represent the entire image region.


• Segmentation is a process that partitions R into subregions,
R1,R2,…,Rn, such that
n
()  Ri  R
i1
(b) Ri is a connected region, i  1,2,..., n
(c) Ri  R j   for all i and j, i  j
(d) P(Ri )  TRUE for i  1,2,...,n
(e) P(Ri  R j )  FALSE for any adjacent regions Ri and R j
where P(Rk): a logical predicate defined over the points inset Rk
For example: P(Rk)=TRUE if all pixels in Rkhave the same gray
level.
Region Growing
• Thresholding still produces isolated image

• Region growing algorithms works on principle of similarity

•It states that a region is coherent if all the pixels of that region are
homogeneous with respect to some characteristics such as colour,
intensity, texture, or other statistical properties

•Thus idea is to pick a pixel inside a region of interest as a starting point


(also known as a seed point) and allowing it to grow

•Seed point is compared with its neighbours, and if the properties


match , they are merged together

•This process is repeated till the regions converge to an extent that no


further merging is possible
Region Growing Algorithm
•It is a process of grouping the pixels or subregions to get a bigger
region present in an image

•Selection of the initial seed: Initial seed that represent the ROI
should be given typically by the user. Can be chosen automatically.
The seeds can be either single or multiple

•Seed growing criteria: Similarity criterion denotes the minimum


difference in the grey levels or the average of the set of pixels. Thus,
the initial seed ‘grows’ by adding the neighbours if they share the
same properties as the initial seed

•Terminate process: If further growing is not possible then


terminate region growing process
Region Growing Algorithm

• Consider image shown in figure:

•Assume seed point indicated by underlines. Let the seed pixels 1 and 9
represent the regions C and D, respectively

•Subtract pixel from seed value

•If the difference is less than or equal to 4 (i.e. T=4), merge the pixel
with that region. Otherwise, merge the pixel with the other region.
Region Growing-Example
Split and Merge Algorithm
• Region growing algorithm is slow

• So seed point can be extended to a seed region

• Instead of a single pixel, a node of a Regional adjacency graph (RAG)


a region itself is now considered as a starting point.

• The split process can be stated as follows:


1) Segment the image into regions R1, R2,….Rn using a set of
thresholds
2)Create RAG. Use a similarity measure and formulate a homogeneity
test
3) The homogeneity test is designed based on the similarity criteria
such as intensity or any image statistics
4) Repeat step 3 until no further region exits that requires merging
Split and Merge Algorithm

8 8 8
8 8 8
Region-Based Segmentation
Region Splitting

• The main problem with region splitting is determining whereto


split a region.
• One method to divide a region is to use a quadtree structure.
• Quadtree: a tree in which nodes have exactly four descendants.
Split and Merge using Quadtree

•Entire image is assumed as a single region. Then the homogeneity


test is applied. If the conditions are not met, then the regions are split
into four quadrants.

•This process is repeated for each quadrant until all the regions meet
the required homogeneity criteria. If the regions are too small, then
the division process is stopped.

1) Split and continue the subdivision process until some stopping


criteria is fulfilled. The stopping criteria often occur at a stage where
no further splitting is possible.
2) Merge adjacent regions if the regions share any common criteria.
Stop the process when no further merging is possible
Region Splitting and Merging
The split and merge procedure:
–Split into four disjoint quadrants any regionRifor
which P(Ri) = FALSE.
–Merge any adjacent regions Rjand Rkfor which
P(RjURk) = TRUE. (the quadtree structure may not
be preserved)
– Stop when no further merging orsplitting is
possible.
Region Splitting and Merging- Example

You might also like