0% found this document useful (0 votes)
8 views49 pages

Dip Internals

Digital Image Processing (DIP) involves manipulating digital images through various techniques such as enhancement, restoration, and feature extraction. It has applications across multiple fields including medical imaging, weather forecasting, and security, each with its own advantages and disadvantages. The document also covers the structure of the human eye, 2D signal classification, convolution and correlation processes, and the Fourier Transform, highlighting their importance in image analysis and processing.

Uploaded by

drew18866
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)
8 views49 pages

Dip Internals

Digital Image Processing (DIP) involves manipulating digital images through various techniques such as enhancement, restoration, and feature extraction. It has applications across multiple fields including medical imaging, weather forecasting, and security, each with its own advantages and disadvantages. The document also covers the structure of the human eye, 2D signal classification, convolution and correlation processes, and the Fourier Transform, highlighting their importance in image analysis and processing.

Uploaded by

drew18866
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/ 49

Unit 1: Digital Image Processing

(DIP)

1. DIP: What , How it works and Advantages and


Disadvantages
Digital Image Processing (DIP) is a technique used to
manipulate digital images through mathematical
algorithms. It involves processes like enhancement,
restoration, compression, and feature extraction.

How it Works?

1.​Image Acquisition – Capturing an image using a


camera or scanner.
2.​Preprocessing – Removing noise and improving image
quality.
3.​Image Enhancement – Adjusting contrast, brightness,
sharpness, etc.
4.​Segmentation – Dividing an image into regions for
analysis.
5.​Feature Extraction – Identifying objects and
patterns.
6.​Post-Processing – Improving image appearance or
compressing it for storage.

Advantages

●​ Better image quality through enhancement


techniques.
●​ Allows automated image analysis.
●​ Efficient image storage and compression.
●​ Useful in fields like medical imaging, satellite
imaging, and biometric recognition.

Disadvantages

●​ High computational power needed.


●​ Processing can be slow for large images.
●​ Requires expertise to implement complex algorithms.

2. Application of Image Processing Application


along with introduction, advantages and
disadvantages
Image processing is the technique of analyzing,
enhancing, modifying, and manipulating images using
computer algorithms.

Applications of Image Processing

1. Medical

Image processing is widely used in medical imaging


techniques like MRI, CT scans, and X-rays to enhance
image quality, detect diseases, and assist in
diagnosis.

Advantages:

●​ Helps in early detection of diseases like cancer


and tumors.
●​ Enhances image clarity for better diagnosis.
●​ Reduces the need for invasive procedures.

Disadvantages:

●​ High cost of equipment and software.


●​ Requires skilled professionals for accurate
interpretation.
●​ Privacy concerns due to patient data storage.

2. Weather Forecasting (Satellite Imaging)

Satellite images are processed to analyze weather


patterns, detect cyclones, and monitor climate changes.

Advantages:

●​ Helps predict natural disasters like hurricanes and


floods.
●​ Assists in climate change studies and environmental
monitoring.
●​ Provides real-time updates on weather conditions.

Disadvantages:

●​ Requires complex algorithms for accurate


predictions.
●​ High cost of satellite maintenance.
●​ Errors in image processing can lead to incorrect
forecasts.

3. Industrial Inspection

Image processing is used in manufacturing to inspect


products for defects and ensure quality control.

Advantages:

●​ Reduces human errors in quality checks.


●​ Increases production efficiency and consistency.
●​ Allows non-contact inspection, preventing product
damage.

Disadvantages:

●​ High initial setup cost for automated inspection


systems.
●​ Requires regular maintenance and updates.
●​ Limited adaptability to highly complex products.

4. Entertainment

Image processing is used in movie editing, animation,


and visual effects (VFX) to enhance visual quality.

Advantages:

●​ Creates realistic special effects and animations.


●​ Improves image and video resolution.
●​ Enables high-quality digital restoration of old
films.

Disadvantages:

●​ High processing power and storage requirements.


●​ Can be time-consuming and expensive for complex
projects.
●​ Overuse of CGI can reduce realism in movies.

5. Security

Facial recognition, biometrics, and surveillance


systems use image processing to enhance security
measures.
Advantages:

●​ Enhances public safety with CCTV surveillance.


●​ Aids in criminal identification and threat
detection.
●​ Improves security in access control systems.

Disadvantages:

●​ Raises privacy concerns due to surveillance.


●​ Can be fooled by spoofing techniques (e.g.,
deepfakes).
●​ Errors in facial recognition may lead to false
identifications.

6. Advertising

Image processing is used in digital marketing to create


visually appealing advertisements and enhance product
images.

Advantages:

●​ Increases consumer engagement through high-quality


visuals.
●​ Enables realistic product visualizations in
e-commerce.
●​ Supports targeted marketing with AI-generated
visuals.

Disadvantages:

●​ Over-editing can lead to misleading advertisements.


●​ High-quality image processing requires expensive
software.
●​ Excessive use of digital effects may reduce
authenticity.

7. Designing

Graphic design, architecture, and fashion industries


use image processing for creating detailed visuals and
prototypes.

Advantages:

●​ Enhances creativity with digital tools.


●​ Allows easy modifications and corrections.
●​ Supports 3D modeling and virtual visualization.

Disadvantages:

●​ Requires expertise in design software.


●​ Can lead to over-reliance on digital tools,
reducing hand-drawn creativity.
●​ High-end software can be costly.

8. Gaming

Image processing enhances game graphics, real-time


rendering, and character animations for immersive
experiences.

Advantages:

●​ Provides realistic and immersive gaming


experiences.
●​ Enables high-definition textures and lighting
effects.
●​ Improves motion capture for realistic character
movements.

Disadvantages:

●​ Requires high-end hardware for better performance.


●​ Can lead to longer game development times.
●​ Large-sized graphics require high storage and
bandwidth.

3. Structure of human eye Explain visual


perception, brightness, adaptation. diagrams

Structure of the Human Eye & Visual Perception

Definition
The human eye is a complex organ that functions as a
biological optical system, converting light into
electrical signals for the brain to process as visual
images. It is responsible for detecting light, colour,
and depth, allowing humans to perceive their
surroundings

It is nearly spherical, with a diameter of


approximately 20 mm. It consists of three primary
layers:

1.​Outer Layer: Cornea (transparent front) and sclera


(white of the eye).
2.​Middle Layer: Choroid (blood vessels) and iris
(controls pupil size).
3.​Inner Layer: Retina (light-sensitive layer with
rods and cones)​.
How it Works
●​ Light enters through the cornea, passes
Light Entry:
through the aqueous humor, then through the pupil,
lens, and vitreous humor, finally reaching the
retina.
●​ Image Formation: The lens adjusts its shape to
focus the image on the retina.
●​ Neural Processing: The retina contains cones (for
colour vision) and rods (for low-light vision).
These photoreceptors convert light into electrical
signals, which travel via the optic nerve to the
brain for interpretation​.
Brightness Adaptation and Perception

●​ The eye adapts to light intensity variations


(brightness adaptation).
●​ Weber’s Law states that the smallest noticeable
change in brightness is proportional to the
original brightness level.
●​ Simultaneous Contrast Effect: The perception of
brightness is influenced by the surrounding area,
making identical shades appear different​.
Advantages

●​ High sensitivity to light variations.


●​ Automatic adaptation to different lighting
conditions.
●​ Efficient visual processing with feature extraction
(edges, motion, colour differentiation).
Disadvantages

●​ The eye cannot perceive extreme


Limited dynamic range:
brightness differences at once.
●​ Optical illusions: Perception can be misleading due
to contrast effects and adaptation delays​
.
4. 2D signals and classification of 2D systems -

( Classification of 2D systems types - 2d unit


impulse , sequence , unit system, linear system,
linear shift in variant, separable sequence ,
periodic sequence)

Definition
A 2D signal is a function $f(x,y)$ that varies over two
independent variables, typically representing spatial
coordinates in an image. In digital image processing,
2D signals are used to encode intensity values at
different pixel locations.

A 2D system is a mathematical model that processes 2D


signals by applying transformations such as filtering,
convolution, and enhancement, producing a new output
signal. These systems play a crucial role in image
analysis, pattern recognition, and visual data
interpretation.

4.1 Classification of 2D Systems


2D systems can be classified based on their
mathematical properties and behavior when processing
signals.

Types of 2D Systems

1. 2D Unit Impulse System

A fundamental function that forms the basis of system


analysis and convolution operations.
●​ Defined as: $$ \delta(x,y) = \begin{cases} 1, & x =
0, y = 0 \ 0, & \text{otherwise} \end{cases} $$
●​ Acts as an identity element in convolution, similar
to the Dirac delta function in continuous systems.
●​ Used to determine a system's impulse response,
which fully characterizes its behavior.
2. 2D Sequence

A discrete representation of a 2D signal, commonly used


in digital images.

●​ Example: A grayscale image, where each pixel is a


discrete sample of an underlying continuous
function.
●​ Useful in sampling, quantization, and image
reconstruction techniques.
3. 2D Unit Step System

Defines causality in 2D systems, ensuring that the


system output is influenced only by past or present
inputs.

●​ Defined as: $$ u(x,y) = \begin{cases} 1, & x \geq


0, y \geq 0 \ 0, & \text{otherwise} \end{cases} $$
●​ Ensures that signals are non-negative, which is
important in image thresholding and segmentation.
4. Linear System

A system that preserves the principles of superposition


and scaling, making it predictable and analyzable.

●​ Mathematically, if $S$ is a system and $f_1(x,y)$


and $f_2(x,y)$ are two signals, then: $$ S[a
f_1(x,y) + b f_2(x,y)] = a S[f_1(x,y)] + b
S[f_2(x,y)] $$
●​ Key property in image filtering and enhancement
techniques.
●​ Examples: Gaussian smoothing filters, edge
detection operators (Sobel, Prewitt).

5. Linear Shift-Invariant (LSI) System

A system where shifting the input results in a


corresponding shift in the output, without altering the
response.

●​ Mathematically: If $S[f(x,y)] = g(x,y)$, then: $$


S[f(x - x_0, y - y_0)] = g(x - x_0, y - y_0) $$
●​ Essential in image convolution, where a filter
kernel is applied across an image in a
shift-invariant manner.
●​ Examples: Low-pass and high-pass filtering
operations.

6. Separable Sequence

A function that can be expressed as the product of two


1D functions, making computation more efficient.

●​ Defined as: $$ f(x,y) = g(x) h(y) $$


●​ Used in separable convolution filters, where a 2D
filter is broken into two 1D filters for
computational efficiency.
●​ Example: Gaussian filters in smoothing operations.

7. Periodic Sequence

A function that repeats itself at fixed intervals,


commonly used in frequency domain analysis.

●​ Defined as: $$ f(x + T_x, y + T_y) = f(x,y) $$


●​ Forms the basis for Fourier transform
representation of images.
●​ Example: Sinusoidal patterns used in texture
analysis and image watermarking.

Advantages & Disadvantages


Advantages

●​ Provides mathematical tools for image


transformations and filtering.
●​ Enables efficient image representation (e.g.,
separable and periodic sequences).
●​ Crucial for frequency domain analysis (e.g.,
Fourier Transform, Wavelet Transform).

Disadvantages

●​ Computationally expensive for large images,


requiring optimizations.
●​ Nonlinear systems cannot be analyzed using
convolution, limiting their flexibility.
●​ Some models require complex mathematical
formulations for accurate results.

5. Convolution and correlation (examples and


codes)

Definition
Convolution:​
Convolution is a mathematical operation that combines
two functions (or signals) to produce a third function.
In image processing, it is used to apply a filter (or
kernel) to an image to modify its appearance—such as
for smoothing, sharpening, or edge detection.​

Correlation:​
Correlation is similar to convolution; it measures the
similarity between an image and a template (or kernel)
as the template slides across the image. Unlike
convolution, correlation does not involve flipping the
filter. It is commonly used for pattern recognition and
template matching.​

How It Works
Convolution Process:​

A small matrix (the kernel) is placed over the


image.

Each output pixel is computed by multiplying the


kernel values with the corresponding image pixels,
summing the results.

The kernel is then moved (shifted) across the


image, and the process repeats.

Correlation Process:​

The template (or kernel) is placed over the image.


For each position, the product of corresponding
pixels is calculated and summed, giving a measure
of similarity between the template and that image
region.

The template slides across the image, creating a


correlation map.

Formulas (in Plain Text)


Convolution Formula:​
For an image f(x, y) and a filter h(x, y), the
convolution output g(x, y) is given by:​

g(x, y) = Σ over m, n { f(m, n) * h(x - m, y - n) }​

(Here, m and n are indices over the image dimensions.)​

Correlation Formula:​
For correlation, the output r(x, y) is:​

r(x, y) = Σ over m, n { f(m, n) * h(x + m, y + n) }​

(Note: In practice, correlation usually means sliding
the kernel over the image without flipping it.)​

Advantages & Disadvantages


Advantages:​
• Convolution is fundamental for applying various
filters (e.g., Gaussian smoothing, edge detection) and
is central to many image processing algorithms.​
• Correlation is effective for template matching and
pattern recognition, allowing the detection of features
within an image.​

Disadvantages:​
• Both operations can be computationally expensive,
especially for large images or when using large
kernels.​
• Convolution requires kernel flipping, which may add
complexity; meanwhile, correlation might be less robust
to variations in orientation unless specially designed.​

Example Code in MATLAB


Below is an example MATLAB code snippet illustrating
both 2D convolution and correlation:

matlab
CopyEdit
% Read a grayscale image
A = imread('cameraman.tif');

% Create a Gaussian filter kernel using fspecial


h = fspecial('gaussian', [3 3], 0.5);

% Perform 2D Convolution
% The 'conv' option ensures convolution is used (i.e.,
kernel is flipped).
conv_result = imfilter(A, h, 'conv');
figure, imshow(conv_result), title('2D Convolution
Result');

% Perform 2D Correlation
% The 'corr' option applies the filter without flipping
it.
corr_result = imfilter(A, h, 'corr');
figure, imshow(corr_result), title('2D Correlation
Result');

●​ In the code:
○​ imfilter is used with the options 'conv' and
'corr' to perform convolution and correlation,
respectively.
○​ fspecial creates a Gaussian kernel used as the
filter.

6. Fourier Transform Theorem

Definition
The Fourier Transform is a mathematical tool that
converts a spatial domain signal (such as an image)
into its frequency domain representation. In essence,
it decomposes an image into a sum of sinusoidal
components, each with its own amplitude and phase. This
allows us to analyze the frequency content of an
image—identifying patterns like edges (high
frequencies) and smooth regions (low frequencies).
How It Works
●​ Decomposition: An image (a 2D signal) is expressed
as a combination of sinusoids with various
frequencies and orientations.
●​ Frequency Domain Representation:
○​ Low Frequencies: Represent smooth variations
(gradual changes in intensity).
○​ High Frequencies: Represent abrupt changes
(edges, noise).
●​ Filtering Advantage: Many image processing
operations (like filtering or compression) are more
efficient when performed in the frequency domain,
since convolution in the spatial domain becomes
simple multiplication in the frequency domain.

Formula (Plain Text Format)


For a continuous 2D function f(x, y), the Fourier
Transform F(u, v) is defined as:

F(u, v) = ∫∫ f(x, y) · exp( -j * 2π * (u * x + v *


y) ) dx dy

And the Inverse Fourier Transform, which reconstructs


f(x, y) from F(u, v), is given by:

f(x, y) = ∫∫ F(u, v) · exp( j * 2π * (u * x + v * y)


) du dv

(Here, j is the imaginary unit. The integrals are taken


over all x and y values.)
Example of Use
●​ Image Filtering:​
In practice, one might compute the Fourier
Transform of an image to analyze its frequency
content. A low-pass filter can be applied in the
frequency domain to remove high-frequency noise,
then the inverse transform is used to obtain a
smoother version of the original image.​

●​ Medical Imaging:​
Techniques such as Magnetic Resonance Imaging
(MRI) rely on the Fourier Transform to reconstruct
images from raw frequency data.​

●​ Image Compression:​
Many compression algorithms, such as JPEG,
leverage frequency domain representations to
discard less important (usually high-frequency)
details.​

Advantages
●​ Efficient Filtering: Convolution operations become
multiplication in the frequency domain, which can
simplify and speed up filtering tasks.
●​ Insight into Image Structure: Separates image
components into frequencies, helping identify and
process features like edges, textures, and noise.
●​ Wide Applications: Used in image reconstruction,
enhancement, compression, and pattern recognition.
7. Explain different types of image extension(
Q. Image file format --- Jpeg, gif , png,
tiff,svg, tsd, eps, bmp)
Below is the updated version with an extra sentence
added to each format’s definition, while keeping the
original sections for how they work, advantages, and
limitations.

JPEG (Joint Photographic Experts Group)

●​ Definition:​
A commonly used image format for photographs that
uses a lossy compression method. It is widely
adopted in digital cameras and online image sharing
due to its efficient storage capability.
●​ How It Works:​
The image is divided into small blocks (typically
8×8 pixels). A Discrete Cosine Transform (DCT)
converts spatial data into frequency components,
which are quantized and entropy-coded to reduce
file size.
●​ Advantages:
○​ Efficient compression
○​ Widely supported
○​ Adjustable quality
●​ Limitations:
○​ Lossy (quality loss at high compression)
○​ No transparency
○​ Possible artifacts (blocking, blurring)

GIF (Graphics Interchange Format)


●​ Definition:​
A format designed for web graphics that uses
lossless compression for images with limited color
palettes. It is popular for its ability to support
simple animations and basic transparency, making it
ideal for icons and web banners.
●​ How It Works:​
GIFs store images using a palette of up to 256
colors. The Lempel–Ziv–Welch (LZW) algorithm
compresses the indexed pixel data without data loss
and supports interlacing for gradual image
rendering.
●​ Advantages:
○​ Lossless for simple graphics
○​ Excellent web support
○​ Supports basic animations and one transparent
color
●​ Limitations:
○​ Limited to 256 colors
○​ No alpha (partial) transparency
○​ Can produce large files for complex animations

PNG (Portable Network Graphics)

●​ Definition:​
A lossless image format developed as an improved,
patent-free replacement for GIF, supporting full
color and transparency. It is commonly used when
image quality and detailed transparency are
required, especially in web design.
●​ How It Works:​
PNG uses the DEFLATE compression algorithm with
predictive filtering, preserving image quality by
compressing data without loss. It supports true
color and an alpha channel for partial
transparency.
●​ Advantages:
○​ No quality loss
○​ Supports full transparency
○​ Handles high color depths well
●​ Limitations:
○​ Larger file sizes than JPEG
○​ Not ideal for very large photographs
○​ Does not support animation

TIFF (Tagged Image File Format)

●​ Definition:​
A versatile format used for high-quality graphics,
often in professional imaging, scanning, and
publishing. It is preferred in professional
environments where preserving image detail and
color accuracy is critical.
●​ How It Works:​
TIFF files can be stored uncompressed or with
lossless compression (e.g., LZW), and they support
multiple layers and high color depths. Metadata
tags store additional information about the image.
●​ Advantages:
○​ Preserves high image quality
○​ Supports multiple layers and extensive color
depths
○​ Flexible compression options
●​ Limitations:
○​ Very large file sizes
○​ Not web-friendly
○​ Limited browser support

PSD (Photoshop Document)

●​ Definition:​
Adobe Photoshop’s native file format that supports
layers and a variety of editing features. It is the
go-to format for graphic designers and
photographers for non-destructive editing and
complex image manipulation.
●​ How It Works:​
PSD files store images along with all editing
information, such as layers, masks, and effects,
maintaining high quality for future modifications.
They do not typically compress data, which helps
preserve detail.
●​ Advantages:
○​ Fully editable with layers
○​ Retains high image quality
○​ Supports advanced features like alpha
transparency
●​ Limitations:
○​ Large file sizes
○​ Requires Photoshop or compatible software
○​ Not suitable for web display

EPS (Encapsulated PostScript)

●​ Definition:​
A vector-based format used for high-quality
graphics exchange and printing. Its ability to
combine vector and bitmap elements makes it a
standard choice for professional printing and
design applications.
●​ How It Works:​
EPS files are written in the PostScript language
and can contain both vector and raster data. They
are scalable to any size without loss of quality.
●​ Advantages:
○​ Infinitely scalable
○​ Ideal for professional printing
○​ Widely supported by design software
●​ Limitations:
○​ Can be large
○​ Not optimized for web use
○​ Editing requires specialized software

SVG (Scalable Vector Graphics)

●​ Definition:​
An XML-based vector image format designed
specifically for the web. Its text-based structure
allows for easy editing and dynamic scaling, making
it ideal for responsive designs and interactive
applications.
●​ How It Works:​
SVG images are defined using XML tags that
describe shapes, lines, and colors mathematically.
They are rendered by web browsers and can include
animations and interactivity.
●​ Advantages:
○​ Infinitely scalable
○​ Small file sizes
○​ Editable and interactive
●​ Limitations:
○​ Not suitable for complex, photo-like images
○​ Advanced features may have limited support in
older browsers

BMP (Bitmap)

●​ Definition:​
A simple raster image format used primarily in
Windows environments. Although it retains high
image quality due to minimal processing, its lack
of compression results in large file sizes.
●​ How It Works:​
BMP files store raw pixel data along with a header
containing information about image dimensions and
color depth. They are usually uncompressed, leading
to high-quality images at the cost of efficiency.
●​ Advantages:
○​ Simple and widely supported in Windows
○​ Maintains full image quality
●​ Limitations:
○​ Extremely large file sizes
○​ Not optimized for web use
○​ Lacks advanced features like transparency
8. Elements of image processing ( image
acquisition, image storage)

Elements of Image Processing


1. Image Acquisition
●​ The first step in any image processing system.
●​ Converts an optical image into numerical data for
computer manipulation.
●​ Involves sensors like CCD (Charge-Coupled Device)
and CMOS (Complementary Metal-Oxide-Semiconductor)
sensors.
●​ Captured images can be grayscale, RGB (Red, Green,
Blue), or multispectral.
●​ Can be done using cameras, scanners, satellites,
and medical imaging devices (MRI, CT, X-ray,
ultrasound).

2. Image Storage
●​ Video signals are analog, represented by electrical
signals conveying luminance and color with variable
voltage.
●​ Requires file formats such as JPEG, PNG, TIFF, BMP,
and RAW for digital storage.
●​ Compression techniques like lossy (JPEG) and
lossless (PNG, TIFF) are used to save storage
space.
●​ Storage can be local (hard drives, SSDs) or
cloud-based (Google Drive, AWS, Azure).

3. Image Processing
●​ Systems range from microcomputers to large
general-purpose computers.
●​ Digital image processing uses algorithms, primarily
implemented via software like MATLAB, OpenCV, and
Python libraries (PIL, TensorFlow, PyTorch).
●​ Common operations include:
○​ Filtering (low-pass, high-pass, median
filtering)
○​ Edge detection (Sobel, Canny, Prewitt filters)
○​ Noise reduction (Gaussian blur, bilateral
filtering)
○​ Image enhancement (histogram equalization,
contrast stretching)
○​ Segmentation (thresholding, region growing,
clustering methods like K-means)
●​ Applications include medical imaging, satellite
imaging, object detection, and machine learning.

4. Display Devices
●​ Convert numerical data from an image array into a
visual format.
●​ Display types:
○​ LCD, LED, OLED screens for digital images.
○​ Projectors for large-scale visualization.
○​ Holographic displays for advanced 3D rendering.
●​ Resolutions vary: 720p, 1080p (Full HD), 4K, 8K.
●​ Color models like RGB, CMYK, YUV affect image
rendering.

5. Image Transmission
●​ Images are transmitted over channels or networks
for remote processing and sharing.
●​ Transmission methods:
○​ Wired (Ethernet, fiber optics, HDMI, VGA,
DisplayPort).
○​ Wireless (Wi-Fi, Bluetooth, 5G, satellite
communication).
●​ Used in applications like video conferencing,
satellite imaging, and remote sensing.
●​ Compression techniques like JPEG, MPEG, H.264,
H.265 reduce bandwidth usage.

This covers detailed points for each element in image


processing. Let me know if you need further
refinements!


Unit 2

1. Image transforms ( list of transforms,(any 5


from thoery point; walsh adamar dct etc ( if
want put diag)))

Image transforms are mathematical operations


that convert an image from one domain (usually
spatial) to another domain (typically
frequency). This conversion allows us to analyze
or manipulate images in ways that may be more
efficient or revealing than working in the
original domain.

1. Walsh Transform
Definition

The Walsh Transform decomposes an image into a


set of orthogonal square-wave basis functions
(non-sinusoidal). It is especially useful for
pattern recognition and image compression
because it captures abrupt changes in intensity.

Where It’s Used

●​ Pattern recognition
●​ Image compression for binary or
low-gray-level images

Code Snippet (MATLAB Style)


matlab

CopyEdit

% Example: Compute the Walsh Transform of an


image

% Assume 'img' is a grayscale image.

W = fwht(img); % Fast Walsh-Hadamard Transform

imshow(mat2gray(W));

Explanation of Code

●​ The function fwht applies the fast


Walsh-Hadamard transform to the image.
●​ mat2gray scales the transform result for
display.
●​ This snippet shows how to convert an image to
its Walsh domain.

2. Hadamard Transform
Definition
The Hadamard Transform uses a Hadamard matrix (a
square matrix whose entries are +1 or -1) to
transform the image. It is similar in spirit to
the Walsh Transform and is used in applications
where simplicity and speed are critical.

Where It’s Used

●​ Signal and image compression


●​ Error detection and correction

Code Snippet (MATLAB Style)

matlab

CopyEdit

% Example: Apply Hadamard Transform to a small


image block

% Create a Hadamard matrix of order n (n must be


a power of 2)

n = 8;

H = hadamard(n);

% Reshape an 8x8 block from the image to apply


the transform

block = double(img(1:n,1:n));
transformedBlock = H * block * H';

imshow(mat2gray(transformedBlock));

Explanation of Code

●​ hadamard(n) generates an n-by-n Hadamard


matrix.
●​ The transform is applied by pre- and
post-multiplying an image block with the
Hadamard matrix.
●​ The result is scaled and displayed.

3. Discrete Cosine Transform (DCT)


Definition

The Discrete Cosine Transform converts spatial


domain image data into frequency domain
coefficients. It is widely used in image
compression (e.g., JPEG) because it concentrates
energy in a few low-frequency components.

Where It’s Used

●​ JPEG compression
●​ Feature extraction in image recognition

Code Snippet (MATLAB Style)


matlab

CopyEdit

% Example: Compute the 2D DCT of an image

dctImage = dct2(img);

imshow(mat2gray(dctImage));

Explanation of Code

●​ dct2 computes the 2D DCT of the image.


●​ The result is scaled for proper
visualization.
●​ This code demonstrates how to transform an
image into its cosine frequency components.

4. Haar Transform
Definition

The Haar Transform is a simple wavelet transform


that uses the Haar basis functions. It provides
a multiresolution analysis of the image, making
it useful for compression and denoising.

Where It’s Used


●​ Image compression
●​ Edge detection and image denoising

Code Snippet (MATLAB Style)

matlab

CopyEdit

% Example: Perform a 2D Haar wavelet


decomposition

[coeffs, sizes] = wavedec2(img, 2, 'haar'); %


2-level decomposition

% Reconstruct the approximation image

approxImg = appcoef2(coeffs, sizes, 'haar', 2);

imshow(mat2gray(approxImg));

Explanation of Code

●​ wavedec2 performs a 2-level 2D Haar wavelet


decomposition.
●​ appcoef2 extracts the approximation
coefficients at level 2.
●​ The code shows how to capture the
low-frequency (approximate) information from
the image.

5. Karhunen-Loeve Transform (KLT) / Principal


Component Analysis (PCA)
Definition

The Karhunen-Loeve Transform (KLT), also known


as Principal Component Analysis (PCA) in image
processing, decomposes an image into orthogonal
components that capture the maximum variance.
This transform is optimal in terms of energy
compaction.

Where It’s Used

●​ Image compression
●​ Feature extraction and dimensionality
reduction in face recognition

Code Snippet (MATLAB Style)

matlab

CopyEdit

% Example: Apply PCA to an image for


dimensionality reduction
% Reshape the image into a 2D matrix where each
row is a pixel's color vector

[m, n] = size(img);

data = double(reshape(img, m*n, 1)); % For


grayscale image; for color, use 3 channels

% Compute the covariance matrix and perform


eigen-decomposition

covMatrix = cov(data);

[V, D] = eig(covMatrix);

% Project data onto the principal components

projectedData = data * V;

% Reshape and display the first principal


component as an image

pc1 = reshape(projectedData(:, end), m, n);

imshow(mat2gray(pc1));

Explanation of Code

●​ The image is reshaped into a data matrix.


●​ The covariance matrix is computed, and
eigen-decomposition is performed to obtain
principal components.
●​ The data is projected onto these components,
and the first principal component is reshaped
for display.
●​ This snippet demonstrates the essence of
KLT/PCA in extracting the dominant features
from the image.

2. Gray level slicing , bit plane slicing

Gray Level Slicing

Definition:​
Gray level slicing is an image enhancement technique
that highlights a specific range of gray values while
suppressing others. This is used to emphasize
particular features or regions in an image by mapping
selected intensity ranges to a higher (or lower) value.

How It Works:

●​ The process involves defining a range of gray


levels that are of interest.
●​ Pixels within the selected range can be set to a
high value (or to a uniform value) to make them
stand out, while pixels outside the range can be
left unchanged or set to zero.
●​ This selective enhancement makes it easier to
detect or analyze features that fall within the
specified intensity band.
Example Code (MATLAB Style):

matlab
CopyEdit
% Read a grayscale image
img = imread('cameraman.tif');

% Define intensity range for slicing (e.g., intensities


between 100 and 150)
lower_bound = 100;
upper_bound = 150;

% Create a copy for gray level slicing


graySliced = img;

% Enhance pixels within the range by setting them to


255 (white)
graySliced(img >= lower_bound & img <= upper_bound) =
255;

% Display the original and the gray-sliced image


figure;
subplot(1,2,1), imshow(img), title('Original Image');
subplot(1,2,2), imshow(graySliced), title('Gray Level
Slicing');

Bit Plane Slicing

Definition:​
Bit plane slicing decomposes a digital image into its
individual bit planes. Each bit plane is a binary image
representing one bit of the pixel values. This
technique helps in analyzing the contribution of each
bit to the overall image structure.

How It Works:

●​ Each pixel value (for example, an 8-bit value) is


represented in binary form.
●​ The image is split into separate binary images, one
for each bit position (from the most significant
bit to the least significant bit).
●​ The higher-order bit planes (MSBs) generally
contain most of the important visual information,
while lower-order bit planes may contain noise.

Example Code (MATLAB Style):

matlab
CopyEdit
% Read a grayscale image
img = imread('cameraman.tif');

% Convert image to uint8 if not already


img = uint8(img);

% Extract and display each bit plane


figure;
for k = 1:8
% Bit plane extraction using bitget function
bitPlane = bitget(img, k);
subplot(2,4,k), imshow(bitPlane), title(['Bit Plane
' num2str(k)]);
end
3. Digital negative , contrast and brightness
(could be Explained in one program only all)
Definition:​
Digital negative, contrast adjustment, and brightness
adjustment are fundamental operations in image
processing used to modify an image's visual appearance.

●​ Digital Negative: Inverts the pixel values so that


dark areas become light and vice versa.
●​ Contrast Adjustment: Enhances the difference
between the lighter and darker regions.
●​ Brightness Adjustment: Modifies the overall
lightness or darkness of the image.

How They Work:

●​ Digital Negative: Each pixel value is subtracted


from the maximum possible intensity value (e.g.,
255 for an 8-bit image).
●​ Contrast Adjustment: The pixel values are
multiplied by a factor greater than 1 to stretch
the histogram, thereby increasing the difference
between low and high values. Values exceeding the
maximum intensity are clipped.
●​ Brightness Adjustment: A constant value is added
(or subtracted) from every pixel in the image to
increase (or decrease) overall brightness, with
care taken to avoid exceeding the intensity bounds.

Combined Example Code (MATLAB Style):

matlab
CopyEdit
% Read a grayscale image
img = imread('cameraman.tif');
img = double(img); % Convert to double for processing

% Digital Negative: Invert pixel values


negative = 255 - img;

% Contrast Adjustment: Multiply by a factor (e.g., 1.5)


and clip values
contrastFactor = 1.5;
contrast = contrastFactor * img;
contrast(contrast > 255) = 255; % Clip values
exceeding 255

% Brightness Adjustment: Add a constant (e.g., 50) and


clip values
brightnessOffset = 50;
brightness = img + brightnessOffset;
brightness(brightness > 255) = 255; % Clip values
exceeding 255

% Convert processed images back to uint8 for display


negative = uint8(negative);
contrast = uint8(contrast);
brightness = uint8(brightness);

% Display the results


figure;
subplot(2,2,1), imshow(uint8(img)), title('Original
Image');
subplot(2,2,2), imshow(negative), title('Digital
Negative');
subplot(2,2,3), imshow(contrast), title('Contrast
Adjustment');
subplot(2,2,4), imshow(brightness), title('Brightness
Adjustment');

Explanation of Code:

●​ Digital Negative: The operation 255 - img inverts


the pixel values.
●​ Contrast Adjustment: Multiplying by a factor (1.5)
enhances differences, with clipping to ensure
values do not exceed 255.
●​ Brightness Adjustment: Adding a constant (50)
increases overall brightness, with similar
clipping.
●​ The subplot function is used to display the
original and processed images side by side.

4. Threshold histogram and histogram


equalization

Thresholding and Histogram


Equalization
1. Thresholding
Definition

Thresholding is a technique used in image processing to


convert a grayscale image into a binary image by
setting pixel intensities above a threshold to one
value and below the threshold to another.

How it Works

●​ A threshold TT is selected.
●​ Pixels with intensity values greater than or equal
to TT are set to white (255).
●​ Pixels with intensity values less than TT are set
to black (0).
●​ This technique is useful for segmenting objects
from the background.
●​ Variants include global thresholding, adaptive
thresholding, and histogram-based thresholding.

Use Case / Real-Life Example

●​ Medical Imaging: Used in X-ray and MRI scans to


segment regions of interest, such as detecting
tumors.
●​ Document Scanning: Converts handwritten or printed
text into binary images for Optical Character
Recognition (OCR).
●​ Automated Inspection: Identifies defects in
industrial quality control.

Code Snippet (MATLAB)


image = imread('input.jpg');
gray_image = rgb2gray(image);
threshold_value = 128;
binary_image = gray_image > threshold_value;
imshow(binary_image);

2. Histogram Equalization
Definition

Histogram Equalization is a contrast enhancement


technique that redistributes the intensity values of an
image to improve visibility in low-contrast images.

How it Works

●​ Compute the histogram of the image.


●​ Calculate the cumulative distribution function
(CDF) of the histogram.
●​ Normalize the CDF to map the pixel values to a
wider range.
●​ Assign new intensity values based on the normalized
CDF to achieve uniform distribution of pixel
intensities.

Use Case / Real-Life Example

●​ Medical Imaging: Enhances X-ray images to highlight


fractures or abnormalities.
●​ Satellite Imaging: Improves the visibility of
landforms and weather patterns.
●​ Photography: Enhances poorly lit images by
adjusting contrast.

Code Snippet (MATLAB)


image = imread('input.jpg');
gray_image = rgb2gray(image);
equalized_image = histeq(gray_image);
imshow(equalized_image);

This provides a structured explanation of thresholding


and histogram equalization with definitions, working
principles, real-life applications, and code snippets.
Let me know if you need any modifications!
5. Low pass filter and High pass filter( maybe
ideal linear butterworth gaussian etc)

6. High boost filter

7. Homomorphic filter

[Not confirmed

Unit 1 - 2nd last book (except convulation


maybe)

Unit 2 - completely from last book]


Here’s the modified version where the code snippets now
only show the function and how it's called while
keeping everything else intact:

Low-Pass Filter, High-Pass


Filter, High-Boost Filter, and
Homomorphic Filter
1. Low-Pass Filter (LPF)
Definition
A low-pass filter (LPF) is used in image processing to
remove high-frequency components, such as noise and
fine details, while allowing low-frequency components
to pass. It is primarily used for smoothing and
blurring images.

How it Works

●​ The LPF reduces sharp variations in an image by


averaging pixel values in a local region.
●​ It can be applied in the spatial domain (using
convolution with a smoothing kernel) or in the
frequency domain (by multiplying with a low-pass
mask in the Fourier Transform).
●​ Different types of LPFs provide varying levels of
smoothness, with some offering sharper cutoffs and
others providing gradual transitions.

Use Case / Real-Life Example

●​ Medical Imaging: Used to smooth MRI and CT scans by


reducing noise.
●​ Photography: Applied to soften skin textures and
remove fine details.
●​ Satellite Imaging: Helps in smoothing terrain
features and reducing unwanted noise.

Function Call (MATLAB)


smooth_img = imfilter(im, fspecial('average', [5 5]));
imshow(smooth_img);

2. High-Pass Filter (HPF)


Definition
A high-pass filter (HPF) enhances an image by
preserving high-frequency components and removing
low-frequency components. It is commonly used for edge
detection and sharpening.

How it Works

●​ HPFs highlight sharp intensity variations and fine


details while suppressing smooth transitions.
●​ It enhances edges, making them more pronounced.
●​ The filter can be applied using convolution in the
spatial domain or by modifying the frequency
components of the image.

Use Case / Real-Life Example

●​ Edge Detection: Enhances object boundaries in


medical imaging.
●​ Fingerprint Recognition: Improves ridge visibility
for biometric identification.
●​ Satellite Imaging: Highlights terrain features and
structural details.

Function Call (MATLAB)


sharp_img = imfilter(im, fspecial('laplacian', 0.2));
imshow(sharp_img);

3. High-Boost Filter
Definition

A high-boost filter is an extension of the high-pass


filter that retains some low-frequency components while
amplifying high-frequency details, making it useful for
enhancing fine details without losing background
information.

How it Works

●​ The input image is slightly blurred, and this


blurred version is subtracted from the original
image to highlight edges.
●​ The original image is then added back with an
amplification factor to retain more details.
●​ This process enhances sharpness while preserving
the overall structure of the image.

Use Case / Real-Life Example

●​ Medical Imaging: Enhances small features like blood


vessels and abnormalities in X-ray images.
●​ Astronomy: Highlights faint celestial objects in
space images.
●​ Surveillance: Improves visibility in low-light
security camera footage.

Function Call (MATLAB)


boosted = imfilter(im, fspecial('unsharp')) * 1.5 - im;
imshow(boosted);

4. Homomorphic Filter
Definition

A homomorphic filter enhances images by adjusting both


illumination and reflectance components separately,
making it useful for improving contrast in unevenly lit
images.
How it Works

●​ In an image, illumination varies gradually, while


reflectance varies sharply.
●​ The filter reduces unwanted lighting variations
while enhancing fine details.
●​ It is commonly applied in the frequency domain
using the Fourier Transform.

Use Case / Real-Life Example

●​ Medical Imaging: Enhances X-ray and MRI images


taken under poor lighting.
●​ Satellite Imaging: Improves contrast in images
taken under different sunlight conditions.
●​ Forensics: Enhances fingerprint images for clearer
identification.

Function Call (MATLAB)


output =
exp(ifft2(ifftshift(fftshift(fft2(log(double(im) + 1)))
.* H)));
imshow(uint8(output));

This version keeps it clean and to the point, while

🚀
only showing how to call the functions instead of full
code. Let me know if you need any refinements!

You might also like