IPT Module 3
IPT Module 3
IPT Module 3
TRACE KTU
a basic operation that modifies the pixel values of an image to create a negative representation. The negative
of an image is formed by subtracting the original pixel values from the maximum intensity value supported
by the image representation.
3. Intensity Level Slicing
Intensity level slicing, also known as intensity thresholding or gray-level slicing, is a technique used in
image processing to highlight specific ranges of intensity values within an image. It involves assigning a
specific range of intensity values to a particular output value, while leaving the remaining values unchanged.
This operation allows for emphasizing or isolating particular regions or features of interest based on their
intensity levels.
Output: The output of intensity level slicing is an image where the selected intensity ranges are
enhanced or highlighted, while the remaining intensity values are left unchanged. Typically, the output
values are chosen to be brighter or different from the original image to make the selected ranges more
visually distinct.
Application: Object Detection and Segmentation, Feature Extraction, Image Enhancement,
Visualization and Analysis, Medical Imaging.
4. Bit Extraction:
Bit extraction is a point processing technique used to extract specific bits of information from the pixel
values of an image. It involves selectively extracting the most significant or least significant bits of each
pixel value, which can be used for various applications such as data hiding, watermarking, and image
encryption.
Output: The output of bit extraction is a binary image or a set of binary values representing the
extracted bits from the original image. The extracted bits can represent hidden data or carry other
meaningful information, depending on the specific application.
Application: Bit extraction is commonly used in digital image processing applications where data
hiding, watermarking, or encryption is required. For example, in steganography, bit extraction can be used to
hide secret messages within the least significant bits of an image. In digital forensics, it can be used to
extract hidden information from images for evidence analysis.
5. Range Compression:
Range compression is a point processing technique used in image enhancement to compress the dynamic
range of pixel values in an image. It is often used to enhance images with low contrast or images that have
pixel values concentrated in a narrow range.
Output: The output of range compression is an image with a compressed dynamic range, where the
intensity values are redistributed to cover a wider range of values. The darker pixels are stretched to a higher
intensity level, and the brighter pixels are compressed to a lower intensity level, resulting in an image with
improved contrast and enhanced details.
Application: Range compression is commonly used in medical imaging, remote sensing, and
underwater imaging, where images may suffer from low contrast due to poor lighting conditions or other
environmental factors. It is also used in computer vision applications for enhancing image details and
improving image quality.
Spatial Operations:
Fundamentals Of Spatial Convolution and Correlation
TRACE KTU
Spatial Averaging and Spatial Low Pass Filtering
Spatial averaging, also known as spatial smoothing or spatial filtering, is a technique used in image
processing to reduce noise, blur or smooth images, and enhance image quality.
It involves replacing the pixel value of a specific location with the average value of its neighboring pixels
within a defined spatial neighborhood.
This operation helps to reduce high-frequency noise or sharp transitions in an image, resulting in a smoother
appearance.
Where v(m, n) and y(m, n) are output and input images respectively and W is a suitably chosen window
a(k, l) are the filter weights.
A common class of spatial averaging filter has all equal weights giving:
1
𝑣 (𝑚, 𝑛) = ∑ ∑ 𝑦(𝑚 − 𝑘, 𝑛 − 𝑙)
𝑁𝑊
(𝑘,𝑙)∈𝑊
1
Where a(k, l) = 𝑁 and NW is the number of pixels in window W.
𝑊
1. Spatial Neighborhood: Spatial averaging operates on a local neighborhood around each pixel in the
image. The size of the neighborhood is defined by a square or rectangular window, typically referred to
as a kernel or filter. Common kernel sizes are 3x3, 5x5, or 7x7, but larger or smaller sizes can be used
depending on the desired level of smoothing.
2. Averaging Operation: For each pixel in the image, the spatial averaging operation involves calculating
the average value of all the pixels within the defined neighborhood. This average value replaces the
original pixel value, resulting in a smoothed version of the image.
Applications:
Spatial averaging finds various applications in image processing, including:
a. Noise Reduction: Spatial averaging helps to reduce noise, such as random variations or sensor noise,
resulting in a cleaner image.
b. Image Smoothing: Spatial averaging can be used to smooth or blur images, reducing pixel-level variations
and creating a softer appearance.
TRACE KTU
c. Pre-processing for Further Analysis: Spatial averaging can serve as a pre-processing step before
performing subsequent image processing operations, such as edge detection or feature extraction. It helps to
reduce noise and simplify subsequent computations.
d. Compression: Spatial averaging can be applied as a form of lossy compression by reducing high-
frequency noise or details that are less perceptually important.
Directional Smoothing:
Directional smoothing, also known as anisotropic smoothing or directional filtering, is a technique used in
image processing to selectively smooth an image along specific directions while preserving edge
information in other directions.
Directional smoothing takes into account the local image structure and applies smoothing along the
dominant edges or structures in the image. This operation is particularly useful for preserving important
features while reducing noise or unwanted variations.
Spatial averages are calculated in several directions as:
1
𝑣 (𝑚, 𝑛: 𝜃) = ∑ ∑ 𝑦(𝑚 − 𝑘, 𝑛 − 𝑙)
𝑁𝜃
(𝑘,𝑙)∈𝑊𝜃
And a direction 𝜃 ∗ is found such that | 𝑦(𝑚, 𝑛) − 𝑣 (𝑚, 𝑛: 𝜃 ∗ ) | is minimum. Then 𝑣 (𝑚, 𝑛) = 𝑣(𝑚, 𝑛: 𝜃 ∗ )
gives the desired result.
Median Filtering:
Median filtering is a non-linear spatial filtering technique used in image processing to reduce noise while
preserving edges and fine details in an image. It replaces each pixel value in an image with the median value
of the pixel values within a defined neighborhood. This operation is particularly effective in removing
impulsive or salt-and-pepper noise, which appears as random bright or dark pixels in an image.
Median filtering operates on a local neighborhood around each pixel in the image. The size of the
neighborhood is defined by a square or rectangular window, typically referred to as a kernel or filter.
Common kernel sizes include 3x3, 5x5, or 7x7, but larger or smaller sizes can be used depending on the
level of noise and desired filtering effect.
Properties:
1. It is a non – linear filter.
2. It is useful for removing isolated lines or pixels while preserving spatial resolution.
3. Its performance is poor when the number of noise pixels in the window is greater than or half the
number of pixels in the window.
Unsharp Masking and Crispening:
Unsharp masking is a popular sharpening technique that involves the creation of a high-pass filtered
version of the image to enhance edges and details.
TRACE KTU
The importance of unsharp masking lies in its ability to enhance the edges and fine details of an image,
making them more visually prominent. It can be particularly useful in images that appear slightly blurred
or lack sharpness due to factors like lens imperfections, motion blur, or softening caused by image
compression.
Crispening is another technique used to enhance the perceived sharpness of an image. Unlike unsharp
masking, which involves a subtractive operation, crispening is an additive technique that emphasizes
edges and details.
The importance of crispening lies in its ability to enhance the high-frequency details and edges without
introducing artifacts or halos that can occur with traditional sharpening techniques. It provides a subtle
sharpening effect that can make images appear crisper and more visually appealing.
One of the simplest filters we can construct is a filter H(u, v) that is 0 at the center of the transform and 1
elsewhere.
The filter would reject the dc term and “pass” all other terms of F (u, v). when we form the product.
Low frequencies in the transform are related to slowly varying intensity components in an image, such
as the walls of a room or a cloudless sky in an outdoor scene.
On the other hand, high frequencies are caused by sharp transitions in intensity, such as edges and noise.
Therefore, we would expect that a filter (u, v) that attenuates high frequencies while passing low
frequencies (appropriately called a lowpass filter) would blur an image, while a filter with the opposite
property (called a high pass filter) would enhance sharp detail, but cause a reduction in contrast in the
image
Summary of Steps for Filtering in the Frequency Domain
TRACE KTU
As the filter radius is increases less and less power is removed, resulting in less blurring.
Why there is Ringing?
TRACE KTU
Ideal low-pass filter function is a rectangular function
The inverse Fourier transform of a rectangular function is a sinc function.
Here are some of the advantages of using an ideal low-pass filter in image processing:
It can effectively remove high-frequency noise from an image.
It can preserve the edges of an image.
It is relatively easy to implement.
Here are some of the disadvantages of using an ideal low-pass filter in image processing:
It can blur the edges of an image.
It can introduce ringing artifacts into an image.
It is not always effective at removing all types of noise.
Butter Worth Low pass filters:
The transfer function of Butter worth low pass filter of order n and cut off frequency at a distance D0
1
from origin is defined as: 𝐷(𝑢, 𝑣) = 𝐷(𝑢,𝑣) 2𝑛
1+[ ]
𝐷0
Unlike the ILPF, the BLPF transfer function does not have a sharp discontinuity that gives a clear cut off
between passed and filtered frequencies.
The Butterworth low pass filter has a smooth and gradual transition between the passband and stopband,
which makes it useful for applications that require a more gradual transition.
A BLPF of order 1 has no ringing in the spatial domain. Ringing generally is imperceptible in filters of
order 2, but can become significant in filters of higher order.
The BLPF is a powerful tool for image smoothing and noise removal. It is often used to improve the
quality of images that have been degraded by noise, such as images that have been taken in low-light
conditions or images that have been scanned from paper.
Here are some of the advantages of using a Butterworth low-pass filter in image processing:
TRACE KTU
It can effectively remove high-frequency noise from an image.
It can preserve the edges of an image.
It has a smooth roll-off, which results in a more natural-looking image than an ideal low-pass filter.
Here are some of the disadvantages of using a Butterworth low-pass filter in image processing:
It can be computationally expensive to implement.
It may not be as effective at removing all types of noise as other types of filters.
Gaussian Low pass filters:
The form of these filters in two dimensions is given by where D (u, v) is the
distance from the center of frequency rectangle.
A Gaussian low-pass filter (GLPF) is a type of filter that is used to smooth an image by removing high-
frequency noise.
The GLPF is characterized by its Gaussian distribution, which is a bell-shaped curve that is centered at
the mean value of the data.
This results in an image that is smoother than the original image, with edges that are preserved more
than with an ideal low-pass filter.
Gaussian low-pass filters are commonly used in image processing tasks such as image denoising, edge
detection, and feature extraction.
Image Sharpening using Frequency Domain Filters:
Ideal High Pass filters:
An ideal high-pass filter (IHPF) is a mathematical function that is used to enhance edges in an image by
removing low-frequency components.
The IHPF has a sharp cutoff at a certain frequency, below which all frequencies are attenuated and above
which all frequencies are passed.
This results in an image that is sharper and has more contrast than the original image.
The IHPF is a powerful tool for edge detection and image enhancement.
It is often used to improve the quality of images that have been degraded by blur, such as images that
TRACE KTU
have been taken in low-light conditions or images that have been motion blurred.
Here are some of the advantages of using an ideal high-pass filter in image processing:
It can effectively enhance edges in an image.
It can increase the contrast of an image.
It is relatively easy to implement.
Here are some of the disadvantages of using an ideal high-pass filter in image processing:
It can be computationally expensive to implement.
It can introduce ringing artifacts into an image.
It is not always effective at enhancing all types of edges.
Here are some examples of how ideal high-pass filters are used in image processing:
To enhance edges in images.
To increase the contrast of images.
To remove blur from images.
To sharpen images.
To create a sketch effect in images.
A 2-D ideal highpass filter (IHPF) is defined as
Butterworth High Pass Filters
Butterworth high-pass filter is a type of linear filter used in image processing to attenuate or remove
low-frequency information from an image while preserving high-frequency information.
It is named after the British mathematician and physicist S. Butterworth, who first introduced this filter
in the 1930s.
The Butterworth high-pass filter is designed based on the Butterworth filter function, which is a type of
frequency response function.
The Butterworth function has a flat response in the passband, and its roll-off rate is proportional to the
order of the filter.
The Butterworth filter function is used to design a filter kernel that can be applied to an image to
attenuate low-frequency information.
The Butterworth high-pass filter is characterized by two parameters, the cutoff frequency and the order
of the filter.
The cutoff frequency is the frequency below which the filter starts to attenuate the signal.
TRACE KTU
The order of the filter determines the steepness of the roll-off rate.
The Butterworth high-pass filter has several advantages over other high-pass filters. It is a linear phase
filter, which means it does not introduce phase distortion in the filtered image. It also has a smooth
frequency response, which makes it useful in image processing tasks where sharp frequency transitions
are undesirable.
However, like all linear filters, the Butterworth high-pass filter has some limitations. It may introduce
ringing artifacts around edges and corners in the image. It may also result in overshoot and undershoot in
the filtered image if the filter order is too high.
A 2-D Butterworth highpass filter (BHPF) of order n and cutoff frequency D0 is defined as
Gaussian High Pass Filter
A Gaussian high-pass filter is a type of linear filter used in image processing to attenuate or remove low-
frequency information from an image while preserving high-frequency information.
It works by convolving the image with a Gaussian kernel that is centered at zero frequency in the Fourier
domain.
The Gaussian high-pass filter is designed based on the Gaussian function, which is a bell-shaped
function that has a maximum at the center and decays smoothly as you move away from the center.
The Gaussian function is used to design a filter kernel that can be applied to an image to attenuate low-
frequency information.
The Gaussian high-pass filter is characterized by a standard deviation parameter that determines the
width of the Gaussian curve of the filter kernel. A larger standard deviation value results in a wider
Gaussian curve and a more selective high-pass filtering, while a smaller standard deviation value results
in a narrower Gaussian curve and a less selective high-pass filtering.
The Gaussian high-pass filter is useful in image processing tasks where sharp edges and details need to
be preserved while removing low-frequency information.
Unlike other high-pass filters, the Gaussian high-pass filter does not introduce ringing artifacts around
edges and corners in the image.
TRACE KTU
However, it may result in some blurring of the image due to its inherent low-pass filtering characteristic.
Applying the Laplacian operator in the frequency domain to an image result in the enhancement of high-
frequency edges and details while suppressing low-frequency information.
The Laplacian operator is a band-pass filter in the frequency domain that attenuates low and high spatial
frequencies, while amplifying the mid-range frequencies that correspond to edges and details.
One advantage of applying the Laplacian operator in the frequency domain is that it is computationally
efficient compared to applying it in the spatial domain.
In the frequency domain, the Laplacian operator can be applied to an image using simple multiplication with
the Fourier coefficients. In the spatial domain, the Laplacian operator requires complex spatial
differentiation and convolution operations, which are computationally expensive.
However, applying the Laplacian operator in the frequency domain may introduce unwanted artifacts such
as ringing and aliasing due to the abrupt transitions in the Laplacian filter function.
the Laplacian image is obtained as:
Unsharp Masking
Unsharp masking is a technique used in image processing to enhance the details and edges in an image by
increasing the contrast of the high-frequency components of the image while suppressing the low-frequency
components. In the frequency domain, unsharp masking is achieved by applying a band-pass filter to the
Fourier coefficients of the image.
The basic idea behind unsharp masking is to create a sharpened version of the original image by subtracting
a blurred version of the image from the original image. The blurred version of the image is obtained by
applying a low-pass filter to the image, which suppresses the high-frequency components of the image while
preserving the low-frequency components. The difference between the original image and the blurred image
contains the high-frequency components of the image that correspond to edges and details.
When k = 1, the equation represents unsharp masking.
High Boost Filtering:
High-boost filtering is a technique used in image processing to enhance the sharpness and details of an
image by selectively boosting the high-frequency components of the image while suppressing the low-
TRACE KTU
frequency components. In the frequency domain, high-boost filtering is achieved by applying a high-pass
filter to the Fourier coefficients of the image.
The basic idea behind high-boost filtering is to create a sharpened version of the original image by adding a
scaled version of the high-frequency components of the image to the original image. The high-frequency
components of the image are obtained by applying a high-pass filter to the image, which suppresses the low-
frequency components of the image while preserving the high-frequency components.
When k > 1 the equation represents high boost filtering.
Homomorphic Filtering:
Homomorphic filtering is a technique used in image processing to enhance the contrast and details of an
image by selectively boosting the high-frequency components while attenuating the low-frequency
components.
This technique is particularly useful for improving the visual quality of images that have uneven
illumination or shading, such as images captured under varying lighting conditions.
The basic idea behind homomorphic filtering is to transform the image into a domain where the
illumination and reflectance components can be separated.
The illumination component represents the slow varying variations of the image due to the lighting
conditions, while the reflectance component represents the high-frequency details and textures of the
image.
TRACE KTU
1. Logarithmic Transformation: The first step in homomorphic filtering is to apply a logarithmic
transformation to the input image. This transforms the image from the original linear domain into a
logarithmic domain, which separates the illumination and reflectance components of the image.
2. Frequency Domain Representation: Next, the logarithmic image is transformed into the frequency
domain using the Fourier transform. This allows for the application of frequency domain filters to
separate the illumination and reflectance components.
3. Filter Design: The filter used in homomorphic filtering is typically a high-pass filter, designed to
attenuate the low-frequency components and amplify the high-frequency components. The high-pass
filter should be designed such that it removes the low-frequency components of the image, which
correspond to the illumination component, while preserving the high-frequency components, which
correspond to the reflectance component.
4. Filtering: Once the high-pass filter has been designed, it is applied to the logarithmic image in the
frequency domain. This removes the low-frequency components and amplifies the high-frequency
components of the image.
5. Inverse Fourier Transform: After filtering, the filtered image is transformed back into the spatial domain
using the inverse Fourier transform. This restores the image to the original spatial domain.
1. Enhancement of details: Homomorphic filtering can enhance the details of an image by amplifying the
high-frequency components, such as edges and textures. This can result in an image with sharper edges
and more pronounced details.
2. Improved contrast: Homomorphic filtering can improve the contrast of an image by selectively boosting
the high-frequency components. This can make the image appear more vivid and dynamic, with a greater
range of brightness values.
3. Removal of uneven illumination: Homomorphic filtering can remove uneven illumination or shading in
an image by separating the illumination and reflectance components and removing the low-frequency
components associated with illumination. This can result in an image that appears more evenly lit and
less washed out.
4. Reduction of noise: Homomorphic filtering can also reduce noise in an image by attenuating the low-
frequency components, which are often associated with noise. This can result in an image with reduced
noise and smoother background.
5. Preservation of overall brightness and color balance: One of the key benefits of homomorphic filtering is
TRACE KTU
its ability to preserve the overall brightness and color balance of an image. The filter selectively
enhances the high-frequency components while attenuating the low-frequency components, without
altering the overall brightness or color of the image.
Can introduce artifacts or noise amplification Can suppress high-frequency noise by filtering out
due to localized pixel operations. certain frequency components.
Limited ability to recover lost or degraded Can potentially recover lost or degraded
information. information through frequency analysis.
Commonly used for general image Commonly used for specific applications like
enhancement tasks, such as contrast image compression, feature extraction, and pattern
adjustment and noise reduction. recognition.
Frequency Domain Operation: Low – pass Frequency Domain Operation: High-pass filtering
filtering to suppress high-frequency noise. to attenuate low frequency details.
Effect: Blurs the image, resulting in a softer Effect: Emphasizes edges and fine details, making
appearance. the image appear more detailed and visually sharp.
TRACE KTU
Result: Smoothing reduces noise, but may
also blur important details.