0% found this document useful (0 votes)
32 views13 pages

Image Transforms

Image Transformattion in Computer Vision

Uploaded by

ashishk1616
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)
32 views13 pages

Image Transforms

Image Transformattion in Computer Vision

Uploaded by

ashishk1616
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/ 13

Image Transforms:

Image transforms are mathematical operations that convert an image from one
domain to another, typically from the spatial domain (where pixel values are
directly manipulated) to a frequency or another domain. These transforms are
fundamental in image processing and computer vision, allowing for various
operations like filtering, compression, enhancement, and feature extractionKey
steps
• Transform the image
• Carry the task(s) in the transformed domain.
• Apply inverse transform to return to the spatial domain.

Transformation Kernels:
A. Inverse Fourier Transform (IFT):
• Purpose: Converts the frequency domain representation of an image back
to the spatial domain.
• Description: The inverse Fourier transform reconstructs the original image
from its frequency components. This is crucial for applying filters in the
frequency domain and then converting the filtered image back to its
original form.
• Applications: Reconstruction of images after frequency domain
processing, image restoration.
M −1 N −1
f ( x, y ) =  T (u, v)s( x, y, u, v)
u =0 v =0
x = 0,1,..., M − 1, y = 0,1,..., N − 1

B. Forward Transformation
In the context of image processing generally refers to the process of converting
an image from the spatial domain (where the image is represented by pixel
intensities) to another domain, such as the frequency domain or a different feature
space. This is usually the first step in various image processing tasks, like
filtering, compression, or analysis.
M −1 N −1
f ( x, y ) =  T (u, v)s( x, y, u, v)
u =0 v =0
x = 0,1,..., M − 1, y = 0,1,..., N − 1

C. Fourier Transform (FT):


• Purpose: To convert an image from the spatial domain to the frequency
domain.
• Process: The Fourier transform decomposes an image into its frequency
components, representing the image as a sum of sinusoidal functions.
This is useful for analyzing the frequency content of an image, applying
frequency-based filters, or compressing the image.
• Mathematical Representation:

• where f(x,y) is the original image, and F(u,v) is the frequency domain
representation.
Kernel Properties:

• A kernel is said to be separable if:


r ( x, y, u, v) = r1 ( x, u )r2 ( y, v)

• A kernel is said to be symmetric if:


r ( x, y, u, v) = r1 ( x, u )r1 ( y, v)

D. Trigonometric Fourier Series:


The trigonometric Fourier series is a mathematical tool used to represent a
periodic function as a sum of sine and cosine functions. This series is particularly
powerful because it allows complex, periodic signals to be decomposed into
simpler, oscillating components. The trigonometric Fourier series is widely used
in various fields, including signal processing, electrical engineering, and physics.
Given a periodic function f(x) with period T, the trigonometric Fourier series is
expressed as:

Here:
• a0 is the average value (or the DC component) of the function over one
period.
• an and bn are the Fourier coefficients for the cosine and sine terms,
respectively.
• n is an integer representing the harmonic number.
E. Exponential Fourier Series
The exponential Fourier series is an alternative form of the Fourier series that
uses complex exponentials (Euler's formula) to represent a periodic function. This
formulation is particularly elegant and compact, and it is widely used in signal
processing and electrical engineering because of its ability to handle complex
signals and its symmetry properties.
Given a periodic function f(x) with period T, the exponential Fourier series is
expressed as:

• Cn are the complex Fourier coefficients.


• n is an integer representing the harmonic number.
• j is the imaginary unit, where j^2=−1.
• ej2πnx/T represents a complex exponential function.
F. Continuous Fourier Transform (FT):
The Continuous Fourier Transform (FT) is a mathematical tool used to
transform a continuous, aperiodic signal (or function) from the time domain into
the frequency domain. This transform allows us to analyze the frequency content
of signals that do not repeat periodically, unlike the Fourier series, which is used
for periodic functions.

• F(ω) is the Fourier transform of the signal f(t)f(t)f(t).


• ω is the angular frequency in radians per second.
• j is the imaginary unit, where j^2=−1.
G. Discrete Cosine Transform (DCT):
• Purpose: To represent an image in terms of its frequency content using
only cosine functions.
• Process: The DCT is commonly used in image compression (e.g., JPEG
compression) because it packs most of the image's significant information
into a small number of low-frequency components, making it easier to
discard less important high-frequency components.
• Mathematical Representation:

• where C(u),C(v) are normalization factors


H. Hough Transform:
The Hough Transform is a technique used in image analysis to detect geometric
shapes such as lines, circles, and ellipses. It is particularly effective for identifying
shapes in noisy or cluttered images. The Hough Transform is widely used in
computer vision and image processing for tasks such as feature extraction and
object recognition.
Parameter Space Representation:Instead of working directly with the pixel
space (image space), the Hough Transform maps points from the image space into
a parameter space. Each geometric shape is represented as a curve in this
parameter space.
Line Detection: For line detection, the Hough Transform uses the polar
coordinate representation of lines. A line can be represented by the equation:
ρ=xcos(θ)+ysin(θ) where ρ is the distance from the origin to the line, and θ is the
angle of the line's normal with respect to the x-axis. Points in the image space are
mapped to curves in the (ρ,θ) space.
Circle Detection: For circle detection, the Hough Transform uses a parameter
space with three dimensions: two for the circle's center coordinates (a,b) and one
for the radius r. A circle in the image can be represented as: (x−a)^2+(y−b)^2=r^2
Steps in Hough Transform
• Edge Detection: First, apply an edge detection algorithm (like Canny or
Sobel) to identify edges in the image. This reduces the problem to detecting
shapes based on edge points.
• Parameter Space Mapping: For each edge point, compute the possible
parameters of the shapes (e.g., different ρ\rhoρ and θ\thetaθ values for
lines) and update the accumulator array.
• Find Peaks: Identify peaks in the accumulator array, which represent the
most probable shapes in the image. Each peak corresponds to a detected
shape.
• Draw Shapes: Map the detected shapes back to the image space and draw
them to visualize the results.
Applications of Hough Transform
• Line Detection: Detecting road lanes in autonomous driving systems or
detecting edges in document scanning.
• Circle Detection: Detecting circular objects like coins, traffic signs, or
biological cells in images.
• Shape Detection: Identifying geometric shapes in industrial inspection,
where specific shapes are required for quality control.
• Image Registration: Aligning images in medical imaging or satellite
imagery by detecting and matching geometric features.
• Object Recognition: Recognizing and localizing specific objects in a
scene based on their geometric properties.
Advantages of Hough Transform
• Robustness to Noise: The Hough Transform is effective in detecting
shapes in noisy images.
• Flexibility: It can be adapted to detect various shapes by changing the
parameter space.
Limitations of Hough Transform
• Computational Complexity: The Hough Transform can be
computationally intensive, especially for detecting shapes with many
parameters or in high-resolution images.
• Memory Usage: The accumulator array can be large, requiring significant
memory for storing and processing.
Why Fourier Transform (FT) use for:
• Signal Analysis: Decomposes complex signals into their frequency
components for easier analysis.
• Filtering and Noise Reduction: Identifies and removes unwanted frequency
components to clean up signals.
• Compression: Reduces data size by removing less important frequency
components, used in JPEG and MP3 formats.
• Pattern Recognition and Feature Extraction: Helps in identifying patterns
and extracting features from signals and images.
• Signal Modulation and Demodulation: Analyzes and designs modulation
schemes for communication systems.
• Solving Differential Equations: Simplifies solving differential equations by
converting them into algebraic equations.
• Image Processing: Facilitates operations like filtering, edge detection, and
image enhancement in the frequency domain.
• Time-Frequency Analysis: Analyzes how frequency components of signals
evolve over time, useful in speech and audio analysis.
• Quantum Mechanics: Relates position and momentum representations of
quantum states, critical for understanding wave-particle duality.

Jean Baptiste Joseph Fourier: Jean Baptiste Joseph Fourier was a French
mathematician and physicist best known for initiating the study of Fourier series
and their applications to problems of heat transfer and vibrations. His work laid
the groundwork for Fourier analysis, which is fundamental to many areas of
mathematics, physics, and engineering.
Fourier Series & Fourier Transform
• Fourier Series: A Fourier series is a way to represent a function as the sum
of simple sine waves. Fourier developed this concept to solve the heat
equation. The idea is that any periodic function can be broken down into a
series of sine and cosine functions, each with specific amplitudes and
frequencies.
• Fourier Transform: The Fourier transform is a generalization of the
Fourier series. It transforms a function from its original domain (often time
or space) into the frequency domain. This tool is crucial in signal
processing, image analysis, and solving partial differential equations.
Image Processing in the Frequency Domain
Image processing in the frequency domain involves transforming an image into
its frequency components using the Fourier transform. This method can reveal
patterns and details not easily visible in the spatial domain. It is useful for
filtering, enhancing, and analyzing images.
• Image Smoothing: This process involves reducing noise and details in an
image to produce a smoother appearance. In the frequency domain, this is
done by attenuating high-frequency components, which often represent
noise and fine details, while preserving low-frequency components, which
represent the broader, smoother regions of the image.
• Image Sharpening: Conversely, image sharpening involves enhancing the
edges and fine details in an image. This is done by amplifying the high-
frequency components in the frequency domain.
The Discrete Fourier Transform (DFT):
The Discrete Fourier Transform of f(x, y), for x = 0, 1, 2…M-1 and y = 0,1,2…N-
1, denoted by F(u, v), is given by the equation:

for u = 0, 1, 2…M-1 and v


= 0, 1, 2…N-1.
• The DFT of a two dimensional image can be visualised by showing the
spectrum of the images component frequencies
The Inverse DFT:
It is really important to note that the Fourier transform is completely reversible
The inverse DFT is given by:

for x = 0, 1, 2…M-1 and y = 0, 1, 2…N-1


The DFT and Image Processing
To filter an image in the frequency domain:
1. Compute F(u,v) the DFT of the image
2. Multiply F(u,v) by a filter function H(u,v)
3. Compute the inverse DFT of the result
Smoothing Frequency Domain Filters
• Smoothing is achieved in the frequency domain by dropping out the high
frequency components
• The basic model for filtering is: G(u,v) = H(u,v)F(u,v), where F(u,v) is the
Fourier transform of the image being filtered and H(u,v) is the filter
transform function
• Low pass filters – only pass the low frequencies, drop the high ones
Ideal Low Pass Filter: Simply cut off all high frequency components that are a
specified distance D0 from the origin of the transform

The transfer function for the ideal low pass filter can be given as:

where D(u,v) is given as:

D(u , v) = [(u − M / 2) 2 + (v − N / 2) 2 ]1/ 2


Butterworth Lowpass Filters:
The transfer function of a Butterworth lowpass filter of order n with cutoff
frequency at distance D0 from the origin is defined as:
1
H (u , v) =
1 + [ D(u , v) / D0 ]2 n
Gaussian Lowpass Filters:
Gaussian Lowpass Filters are commonly used in image processing to perform
smoothing, reducing noise, and blurring an image. The "lowpass" aspect refers to
the filter's ability to allow low-frequency components (which correspond to
smooth variations in the image) to pass through while attenuating high-frequency
components (which often correspond to noise or sharp edges).

− D 2 ( u ,v ) / 2 D0 2
H (u , v) = e
Sharpening in the Frequency Domain:
Sharpening in the frequency domain is a technique used to enhance the edges and
fine details of an image by amplifying its high-frequency components. This
process is the opposite of smoothing (or blurring), which reduces high-frequency
components to soften an image. In the frequency domain, sharpening is achieved
by emphasizing these high-frequency components, which correspond to rapid
changes in intensity, such as edges.
• Edges and fine detail in images are associated with high frequency
components
• High pass filters – only pass the high frequencies, drop the low ones
• High pass frequencies are precisely the reverse of low pass filters, so:
o Hhp(u, v) = 1 – Hlp(u, v)

Fast Fourier Transform (FFT)


The Fast Fourier Transform is an algorithm that efficiently computes the Fourier
transform. The FFT is widely used in digital signal processing, including image
processing, due to its speed and computational efficiency. It allows for real-time
processing of signals and images, making it a vital tool in various applications.
These concepts are fundamental in understanding how images can be
manipulated and analyzed in the frequency domain, leading to practical
applications such as filtering, edge detection, and noise reduction.
Image restoration is the process of recovering an image that has been degraded
by various factors, such as noise, blurring, or distortion. The goal of image
restoration is to improve the quality of the image and make it as close to the
original, undistorted image as possible. This process involves identifying and
correcting the distortions or degradations that have affected the image.
Noise and Images: Noise in images refers to unwanted random variations in
pixel values that obscure or degrade the quality of the image. Noise can originate
from various sources, including sensor imperfections, transmission errors, or
environmental factors. It generally appears as random variations in pixel
intensities, which can affect the clarity and accuracy of the image.
Noise Model:
• We can consider a noisy image to be modelled as follows:


g ( x, y ) = f ( x, y ) +  ( x, y )
• where f(x, y) is the original image pixel, η(x, y) is the noise term and g(x,
y) is the resulting noisy pixel
• If we can estimate the noise model we can figure out how to restore the
image
A. Gaussian Noise:
• Gaussian noise follows a normal distribution and is characterized by its
mean (usually zero) and standard deviation. It causes pixel values to vary
randomly around the true value, with variations more likely to be smaller
than larger.
• Mathematical Model: If I(x,y) is the true pixel value and N(x,y) is the
noise, then the observed pixel value O(x,y) is given by:
• O(x,y)=I(x,y)+N(x,y), where N(x,y)∼N(0,σ^2) is Gaussian noise with
mean 0 and variance σ^2
B. Salt-and-Pepper Noise:
• This type of noise appears as randomly scattered black and white pixels
(salt and pepper). It typically occurs due to sudden disturbances in the
image capturing process.
• Mathematical Model: Pixel values are either set to 0 (pepper) or 255 (salt)
with certain probabilities.
C. Poisson Noise:
• Poisson noise is associated with the statistical variation in the number of
photons detected by the image sensor. It is often encountered in low-light
conditions and follows a Poisson distribution.
• Mathematical Model: The observed pixel value O(x,y) follows a Poisson
distribution with a mean I(x,y): O(x,y)∼Poisson(I(x,y))
D. Speckle Noise:
• Speckle noise is caused by interference or random variations in the image
sensor. It appears as granular noise and is often modeled as multiplicative
noise.
• Mathematical Model: The observed pixel value O(x,y) can be modeled
as: O(x,y)=I(x,y)⋅(1+N(x,y)) where N(x,y) is additive noise with zero
mean and variance.
I. Noise Removal Using Spatial Domain Filtering
Spatial domain filtering involves processing the image directly in the pixel
domain to reduce noise. Common spatial domain filters include:
A. Mean Filter: Averages the pixel values in a neighborhood to reduce noise. It
is simple but may blur edges. Implementation: Convolve the image with a kernel
(e.g., a box filter) where each pixel is replaced by the average of its neighboring
pixels.
B. Median Filter: Replaces each pixel value with the median value of its
neighborhood. Effective at removing salt-and-pepper noise while preserving
edges. Implementation: Sort the pixel values in a neighborhood and replace the
central pixel with the median value.
C. Gaussian Filter: A weighted average filter where pixel values are averaged
with weights following a Gaussian distribution. Reduces noise while preserving
image details better than a mean filter. Implementation: Convolve the image
with a Gaussian kernel, which assigns more weight to pixels closer to the center
of the kernel.
D. Wiener Filter: An adaptive filter that takes into account local image variance
to reduce noise while preserving edges. It adjusts based on local statistics.
Implementation: Uses local mean and variance to compute the filter response
for each pixel, aiming to minimize mean squared error.
II. Noise Removal Using Frequency Domain Filtering
Frequency domain filtering involves transforming the image into the frequency
domain, applying filters, and then transforming it back to the spatial domain. This
approach is useful for removing periodic noise and can be more effective than
spatial domain filtering for certain types of noise.
A. Low-Pass Filtering: Removes high-frequency components, which are often
associated with noise, while preserving low-frequency components, which
represent the main features of the image. Implementation: Apply a low-pass
filter (e.g., Gaussian filter) in the frequency domain. Transform the image to the
frequency domain using the Fourier Transform, multiply by the low-pass filter,
and transform back to the spatial domain.
B. High-Pass Filtering: Enhances high-frequency components to sharpen the
image and reduce blurring caused by noise or distortions. Implementation:
Apply a high-pass filter in the frequency domain to enhance edges and details,
followed by an inverse Fourier Transform to return to the spatial domain.
C. Band-Pass Filtering: Filters out both low and high-frequency components,
allowing only a specific range of frequencies to pass. Useful for removing noise
in a particular frequency range. Implementation: Apply a band-pass filter in the
frequency domain, which allows only frequencies within a certain range to pass
through while attenuating others.
D. Notch Filtering: Specifically targets and removes periodic noise or
interference at certain frequencies. Implementation: Apply a notch filter in the
frequency domain to remove specific frequency components associated with the
noise, such as periodic interference.

You might also like