0% found this document useful (0 votes)
14 views138 pages

Sharpening Spatial Filters

The document discusses various techniques for image sharpening and enhancement using spatial and frequency domain methods, including the use of spatial filters, Laplacian, and gradient masks. It covers the process of unsharp masking, highboost filtering, and different types of filters like low-pass and high-pass filters, along with their applications in fields such as medical imaging and electronic printing. Additionally, it touches on noise models and restoration techniques to recover degraded images.
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)
14 views138 pages

Sharpening Spatial Filters

The document discusses various techniques for image sharpening and enhancement using spatial and frequency domain methods, including the use of spatial filters, Laplacian, and gradient masks. It covers the process of unsharp masking, highboost filtering, and different types of filters like low-pass and high-pass filters, along with their applications in fields such as medical imaging and electronic printing. Additionally, it touches on noise models and restoration techniques to recover degraded images.
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/ 138

Sharpening Spatial Filters: used to highlight the transition in intensity.

It
performs reverse operation of smoothing special filters.

Perform spatial differentiation to sharpen the image.

They are used to highlight fine details in the image.

To enhance the blurred image and enhance the edges.

Used in electronic printing, medical imaging, industrial inspection, and


autonoums guidance in military system.

Spatial Differentiation:

1. First order derivative


2. Second order derivative
How to create a mask using this first order derivative and Second order
derivative?

USING THE SECOND DERIVATIVE FOR IMAGE SHARPENING—THE


LAPLACIAN

Suppose we have 2-D f(x, y) Isotropic image

What is Isotropic Image: Rotation Invariant

First rotate the image then apply the mask or


First apply the mask and then rotate the image,
The resultant will be same.
From Laplacian Eq. for electromagnetics:

In the x-direction, we have

and, similarly, in the y-direction, we have

Mask coefficients

Note: in
sharpening
filter sum
of mask
coefficient
= 0 always
Generalized expression of Laplacian Mask:

c = -1 c = -1 c=1 c=1
UNSHARP MASKING AND HIGHBOOST FILTERING:

This process is used in printing and publishing industry to sharpen images.

Step 1: Blur or smoothening the original image

Step 2: Subtract blur image from the original


image

Step 3: we get the unsharp mask

Step 4: add the unsharp mask with original


image

Step 5: Finally, we get the sharpened image at


particular transition point.
(1)

(2)

Where, k = weight (k ≥ 0)
If, k = 1; Unsharp masking
k > 1; Hight boost filtering
k < 1; emphasizes construction of unsharp masking
(a) Original image of size 600 x 259 pixels.
(b) Image blurred using a 31 x 31 Gaussian lowpass filter with s = 5.
(c) Unsharp Mask.
(d) Result of unsharp masking using Eq. (3-56) with k = 1.
(e) Result of highboost filtering with k = 4.5
USING FIRST-ORDER DERIVATIVES (Non-Linear) FOR IMAGE SHARPENING—
THE GRADIENT

First derivatives in image processing are implemented using the magnitude of the
gradient.

(1)

(2)
Using gradient of f (eq. 1) and magnitude of f (eq. 2) we can construct the
mask for sharpening the image:

Image Mask
We know that, Z5 = f(x,y), Using first order derivative

𝜕𝑓
Gradient gx = = f(x+1,y) - f(x,y) => Z8 - Z5
𝜕𝑥
𝜕𝑓
gy = = f(x,y+1) - f(x,y) => Z6 - Z5
𝜕𝑦
Magnitude

= |Z8 – Z5| + |Z6 – Z5|

Now, we can construct two mask using gradient and magnitude equations:

Vertical mask for gx = Z8 – Z5

-1 0

1 0

Horizontal mask for gy = Z6 – Z5

-1 1

0 0
Roberts [1965] proposes cross differences operators (Cross Gradient Mask):

gx = Z9 – Z5; gy = Z8 – Z6

= |Z9 – Z5| + |Z8 – Z6|

Robert cross gradient mask gx = Z9 – Z5

-1 0 Note: There is no
central symmetry
0 1
To achieve this we
have to consider odd
Robert cross gradient mask gy = Z8 – Z6 mask i.e. Sobel Mask
3X 3 mask

0 -1

1 0
Sobel proposes a smallest 3 X 3 odd mask which can have a center of
symmetry:

Sobel Operators

Sobel Mask for gx

-1 -2 -1

0 0 0

1 2 1
Sobel Mask for gy

-1 0 1

-2 0 2

-1 0 1

Sobel Magnitude

=| |+

| |

Note: Sum of mask coefficient is always equal to zero for any case.
Image Enhancement in Frequency Domain:
In Frequency Domain operations are performed on the Fourier transform of an
image rather than on the image itself, then it is converted back to the results in its
spatial domain using inverse Fourier transform.

Spatial FT Spatial
IFT Domain
Domain Domain Domain

f(x,y) D.F.T. F(u,v)

F(u,v) I.D.F.T. f(x,y)


The 2-D discrete Fourier transform (DFT) is given by:

(1)

u,v = frequency domain variable

(2)
Properties of 2-D discrete Fourier transform

(i) RELATIONSHIPS BETWEEN SPATIAL AND FREQUENCY INTERVALS:


t
Let, f(t,z) = Continuous image
f(x,y) = Digital Image
MXN = No. of Samples

The frequency domain variable:

(1) z

(2)

Where, and represents the separation between the samples


(ii) TRANSLATION AND ROTATION:

The F.T. pair satisfies the translation property is given as

In polar coordinates,

The result obtained is,

If f(x,y) is rotated by then F(u,v) is also rotated by the same angle


(iii) PERIODICITY:

the 2-D Fourier transform and its inverse are infinitely periodic in the u and v
directions; that is,

where k1 and k2 are integers.

Let we have a 1-D DFT

Period-1 Period-2
Now, in order to obtain one complete period we have to shift this signal, it is possible
by multiplying

One complete Period


For 2-D DFT
(iv) SYMMETRY:
any real or complex function are the sum of an even and an odd part,
(1)

(2a)

(2b)

Substituting (2a) and (2b) in (1), it results with Identity

(3)

We know that, the even component are symmetry and odd components are
antisymmetric. Therefore,
(4a)

(4b)
The product of even and odd components are

Even components are symmetry


Odd components are antisymmetric
And their product is always zero.
(v) 2-D Convolution:

The circular convolution of 2-D DFT is given as:

The 2-D convolution theorem is given by

Conversely,
STEPS FOR FILTERING IN THE FREQUENCY DOMAIN:
Real Symmetric Filter

Real Symmetric Filter: Remove all the imaginary components which is parasitic
Types of Filters in Frequency domain:

Frequency Domain

Smoothing Filters (Low Pass Filter) Sharpening Filters (High Pass Filter)

Passes the low frequency Passes the high frequency


components and attenuate or block components and attenuate or block
the high frequency components. the low frequency components.

Ideal LPF Ideal HPF

Butterworth LPF Butterworth HPF

Gaussian LPF Gaussian HPF


Smoothing Filters:

Blur the sharp transition of the image like noise.

Noise has high frequency component, we need to remove this.

Low Pass Filter: Passes the low frequency components and attenuate or
block the high frequency components.

Ideal LPF (Sharp cutoff)

Butterworth LPF (Filtering depend on the order


high order- Ideal LPF; Low order- Gaussian LPF)
Gaussian LPF (Smooth Transition)
Filter function for all types of filters:
1. IDEAL LOWPASS FILTERS:

(1)

Where, D0 is the positive constant cut off frequency


D(u,v) is the distance from the center of the frequency rectangle.

(2)
If the frequency lies inside the circle of radius D0 it will pass
Otherwise the frequency lies outside the circle it will block.

(a) Perspective plot of an ILPF transfer function. (b) Radial cross section. (c) frequency
response
To decide the standard cut off frequency D0:

We need to consider the specified power which is enclosed within this circle.

We need to compute the power spectrum, that can be done with the help of padded
image and the power spectrum of each and every point in the padded image is to be
calculated in order to identify the power spectrum.
2. BUTTERWORTH LOWPASS FILTERS:

Filtering operation depend on the order (n) of the filter

High order LPF: Ideal LPF


Low order LPF: Gaussian LPF
3. GAUSSIAN LOWPASS FILTERS:
IMAGE SHARPENING USING HIGHPASS FILTERS:

Image Smoothing: Image can be smoothed by attenuating the high-frequency


components of its Fourier transform. Because edges and other abrupt changes in
intensities are associated with high-frequency components,

Image Sharpening: Image sharpening can be achieved in the frequency domain by


highpass filtering, which attenuates low-frequencies components without disturbing
high-frequencies in the Fourier transform

filter transfer functions of size P X Q


High Pass Filter: Passes the high frequency components and attenuate or block
the low frequency components.

Ideal HPF

Butterworth HPF

Gaussian HPF
1. Ideal highpass filter (IHPF) transfer function is given by

Where, D0 is cut off frequency


D(u,v) is the distance from the center of the frequency rectangle.

Disadv: After processing blurred edges


2. Butterworth highpass filter (BHPF) is used to control the sharpening
factor, depend on order

Where, D0 is cut off frequency


D(u,v) is the distance from the center of the frequency rectangle.
Adv.: useful in defining the edges
3. Gaussian highpass filter (GHPF) transfer function is given
by, provide very high sharpening effect

Adv: it removes high frequency noise


THE LAPLACIAN IN THE FREQUENCY DOMAIN:
the Laplacian can be implemented in the frequency domain using the filter transfer
function:

or, with respect to the center of the frequency rectangle, using the transfer function

Using this transfer function, the Laplacian for an image can be represented as

enhancement in the image can be obtained as


THE LAPLACIAN IN THE FREQUENCY DOMAIN:

in the frequency domain this can be represented as

Processed
image
(a) Original blurry image. (b) Image enhanced using the Laplacian in the
frequency domain.
HOMOMORPHIC FILTERING:

The illumination-reflectance model used here to develop a frequency domain


procedure for improving the appearance of an image by simultaneous intensity
range compression and contrast enhancement.

(1)

or
The filtered image in the spatial domain is then

we can express
Finally, because z(x, y) was formed by taking the natural logarithm of the input
image, we reverse the process by taking the exponential of the filtered result to
form the output image:

where

are the illumination and reflectance components of the output (processed)


image.
a summary of the filtering approach just derived. This method is based on a
special case of a class of systems known as homomorphic systems.

Noted: Here, filter H(u,v) selection is a big challenge. Filter should perform both
operation like, intensity range compression and contrast enhancement.

ϒL < 1 intensity range


compression at low frequency
&
ϒH > 1 contrast enhancement
at high frequency
(a) Full body PET scan. (b) Image enhanced using homomorphic filtering.
A Model of the Image Degradation/Restoration Process:

Restoration attempts to recover an image that has been degraded by using a priori
knowledge of the degradation phenomenon.

Thus, restoration techniques are oriented toward modeling the degradation and
applying the inverse process in order to recover the original image.

Restoration Techniques: 1. Spatial Domain (Additive noise)


2. Frequency Domain (Image blur)
A model image degradation/ Restoration Process:
NOISE MODELS:

SOME IMPORTANT NOISE PROBABILITY DENSITY FUNCTIONS

1. Gaussian Noise

The PDF of a Gaussian random variable, z, is defined by the following familiar


expression
2. Rayleigh Noise

The PDF of Rayleigh noise is given by

Where
3. Erlang (Gamma) Noise
The PDF of Erlang noise is
4. Exponential Noise

The PDF of exponential noise is given by


5. Uniform Noise

The PDF of uniform noise is


6. Impulse/ Salt-and-Pepper Noise
The PDF of salt-and-pepper noise is given by
7. PERIODIC NOISE: Periodic noise in images typically arises from electrical or
electromechanical interference during image acquisition.
For ex. sinusoidal noise of varying frequency.

Estimation of Noises: can be done with mean and variance


Restoration in the Presence of Noise only- Spatial Filtering
MEAN FILTERS: Various technique to remove different types of noise
available in this degraded image or noise-reduction capabilities of the
spatial filters
1. Arithmetic Mean Filter

Smooth the noise, Remove the noise by blurring


2. Geometric Mean Filter

Gives better smoothing than arithmetic filter, but fine can not be retained here.
3. Harmonic Mean Filter: Usually used it to remove salt noise and gaussian noise

4. Contraharmonic Mean Filter: Q= order of the filter

Q = positive; remove pepper noise


Q = negative; remove salt noise
Q = 0; Arithmetic mean filter
Q = -1; Harmonic mean filter
Restoration in the Presence of Noise only- Spatial Filtering

ORDER-STATISTIC FILTERS: Response based on ordering or ranking the pixel


value which is present in the neighbourhood of the image i.e. filter.

1. Median Filter: 50 % percentile filter


2. Max Filters:
100th percentile results in the so-called max filter, given by

This filter is useful for finding the brightest points in an image and reduce pepper
noise.

3. Min Filters:
The 0th percentile filter is the min filter:

This filter is useful for finding the darkest points in an image and reduce salt
noise.
5. Midpoint Filter: The midpoint filter computes the midpoint between the
maximum and minimum values in the area encompassed by the filter:

It works best for randomly distributed noise, like Gaussian or uniform noise

6. Alpha-Trimmed Mean Filter: remove salt and-pepper and Gaussian noise.


Discrete Cosine Transform:

Advantage of DFT: Good computational efficiency

Disadvantage of DFT: complex


It has comparable poor energy compaction, etc.

➢ DCT was developed by Ahmed Nattarajan and Rao in 1974.

➢ It is the member of the family of real valued discrete sinusoidal unitary


transform.

➢ It consists of a set of basic vectors that are sampled cosine functions.

➢ It is a technique for converting a signal in to elementary frequency components


and is widely used in image compression.
2-D DCT using a 1-D DCT pair:
Image Compression: Process of converting an image file into another image file that
occupies less storage space, without sacrificing its visual content.
Useful for saving storage space, and transmission costs.
IMAGE CONTAINS TWO TYPES OF ENTITIES:

1. Information content of the image


2. Redundancy (process the image and try to remove the redundancy present in the
image retain only the information present in the image

Encoder Decoder

Original
Visual Information
Information
Three types of Redundancy:

1. Spatial and temporal redundancy/ InterPixel Redundancy

2. Coding Redundancy

3. Irrelevant information/ Psychovisual Redundancy

Compression attempts to reduce one or more of these redundancy types.

Computer generated 256 x 256 x 8 bit images with (a) coding redundancy, (b)
spatial redundancy, and (c) irrelevant information.
Example: Variable length Coding/ Huffman Coding
Coding Redundancy
Coding Redundancy
A mapping is said to be reversible if the pixels of the original 2-D intensity

array can be reconstructed without error from the transformed data set;

otherwise, the mapping is said to be irreversible.


IMAGE COMPRESSION MODELS
Arithmetic Coding:
Step 1: Range for ‘w’
Step 2: Range for ‘e’

Range of ‘e’ = 0.8: [0.8+0.1(0.3)] = 0.8: 0.83

Range of ‘n’ = 0.83: [0.83+0.1(0.3)] = 0.83: 0.86

Range of ‘t’ = 0.86: [0.86+0.1(0.2)] = 0.86: 0.88

Range of ‘w’ = 0.88: [0.88+0.1(0.1)] = 0.88: 0.89

Range of ‘.’ = 0.89: [0.89+0.1(0.1)] = 0.89: 0.90


Step 3: Range for ‘n’

Range of ‘e’ = 0.8: [0.8+0.03(0.3)] = 0.8: 0.809

Range of ‘n’ = 0.809: [0.809+0.03(0.3)] =

0.809: 0.818

Range of ‘t’ = 0.818: [0.818+0.03(0.2)] =

0.818: 0.824

Range of ‘w’ = 0.824: [0.824+0.03(0.1)] =

0.824: 0.827

Range of ‘.’ = 0.827: [0.827+0.03(0.1)] = 0.827: 0.83


Step 4: Range for ‘t’

Range of ‘e’ = 0.809: [0.809+0.009(0.3)]

= 0.809: 0.8117

Range of ‘n’ = 0.8117: [0.8117+0.009(0.3)]

= 0.8117: 0.8144

Range of ‘t’ = 0.8144: [0.8144+0.009(0.2)]

= 0.8144: 0.8162

Range of ‘w’ = 0.8162: [0.8162+0.009(0.1)]

= 0.8162: 0.8171

Range of ‘.’ = 0.8171: [0.8171+0.009(0.1)] = 0.8171: 0.818

d = upper bound – lower bound = 0.818 – 0.809 => 0.009


Step 5: Range for ‘.’

Arithmetic
code word

0.81494

d = upper bound – lower bound = 0.8162 – 0.8144 => 0.0018


Problems Q1.

Q2.

Q3.

Q4.

You might also like