0% found this document useful (0 votes)
15 views131 pages

Image Processing Course Overview

The document outlines the syllabus for an Image Processing elective course, detailing learning objectives, course content, and assessment methods. Key topics include digital image fundamentals, 2D image transformations, image enhancement techniques, segmentation methods, and compression techniques. The document also provides a model question paper and references for further reading.

Uploaded by

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

Image Processing Course Overview

The document outlines the syllabus for an Image Processing elective course, detailing learning objectives, course content, and assessment methods. Key topics include digital image fundamentals, 2D image transformations, image enhancement techniques, segmentation methods, and compression techniques. The document also provides a model question paper and references for further reading.

Uploaded by

shenbagam naren
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ODD SEMESTER

Subject Subject Name L T P S Marks

Inst. Hours
Code

Category

Credits

External

Total
CIA
25UCSE05 Image Processing Elective
4 - - - 3 4 25 75 100
Learning Objective
LO1 To learn fundamentals of digital image processing.
LO2 To learn about various 2D Image transformations
LO3 To learn about various image enhancement processing methods and filters
LO4 To learn about various classification of Image segmentation techniques
LO5 To learn about various image compression techniques
No. of
UNIT Contents
Hours
Digital Image Fundamentals: Image representation - Basic relationship
between pixels, Elements of DIP system -Applications of Digital Image
Processing - 2D Systems - Classification of 2D Systems - Mathematical
I 12
Morphology- Structuring Elements- Morphological Image Processing -
2D Convolution - 2D Convolution Through Graphical Method -2D
Convolution Through Matrix Analysis
II 2D Image transforms: Properties of 2D-DFT - Walsh transform -
Hadamard transform- Haar transform- Discrete Cosine Transform- 12
Karhunen-Loeve Transform -Singular Value Decomposition
III
Image Enhancement: Spatial domain methods- Point processing-
Intensity transformations - Histogram processing- Spatial filtering-
12
smoothing filter- Sharpening filters - Frequency domain methods: low
pass filtering, high pass Filtering- Homomorphic filter.
IV Image segmentation: Classification of Image segmentation techniques -
Region approach – Clustering techniques - Segmentation based on
12
thresholding - Edge based segmentation - Classification of edges- Edge
detection - Hough transform- Active contour.

1
V Image Compression: Need for compression -Redundancy- Classification
of image- Compression schemes- Huffman coding- Arithmetic coding- 12
Dictionary based compression -Transform based compression,

Total 60
Course Outcomes Programme Outcome
CO On completion of this course, students will
1 Understand the fundamental concepts of digital PO1
image processing.
2 PO1, PO2
Understand various 2D Image transformations

3 Understand image enhancement processing PO4, PO6


techniques and filters
4 Understand the classification of Image segmentation PO4, PO5, PO6
Techniques
PO3, PO5
5 Understand various image compression techniques
Text Book
S Jayaraman, S Esakkirajan, T Veerakumar, Digital image processing ,Tata McGraw
1 Hill, 2015
Gonzalez Rafel C, Digital Image Processing, Pearson Education, 2009
2
Reference Books
1. 1. Jain Anil K , Fundamentals of digital image processing: , PHI,1988
Kenneth R Castleman , Digital image processing:, Pearson Education,2/e,2003
2.
3. Pratt William K , Digital Image Processing: , John Wiley,4/e,2007
Web Resources
1. [Link]
Vijaya%[Link]

2. [Link]
rd%20ed.%20-%20R.%20Gonzalez%2C%20R.%[Link]
3. [Link]
4. [Link]

MODEL QUESTION PAPER – IMAGE PROCESSING (ELECTIVE)


Time: 3 Hours Max Marks: 75

2
PART A – OBJECTIVE QUESTIONS (15 × 1 = 15 marks)
Choose the correct answer (Each carries 1 mark):
1. The basic unit of a digital image is:
A) Voxel B) Pixel C) Bit D) Node
2. Which of the following is a frequency domain enhancement technique?
A) Histogram Equalization B) Median Filter
C) Butterworth Filter D) Averaging Filter
3. Which transform provides optimal energy compaction?
A) DCT B) DFT C) KLT D) FFT
4. The operation that increases object area in morphology is:
A) Erosion B) Dilation C) Opening D) Closing
5. What is the main use of a histogram in image processing?
A) Segmentation B) Edge Detection
C) Contrast Adjustment D) Compression
6. The 2D DFT is used to:
A) Blur the image B) Detect colors
C) Analyze spatial frequency D) Convert image to binary
7. A high-pass filter emphasizes:
A) Low frequencies B) Constant regions
C) Noise only D) Edges and fine details
8. Lossy compression results in:
A) No data loss B) Increased image size
C) Irrecoverable data loss D) Faster acquisition
9. Which operator is used for edge detection?
A) Mean B) Gaussian
C) Sobel D) Laplace
10. Principal Component Analysis is closely related to:
A) DCT B) DFT C) KLT D) FFT
11. In segmentation, region growing starts from:
A) The edges B) A seed point
C) The center D) The corners
12. Which transform is most commonly used in JPEG compression?
A) KLT B) DCT C) FFT D) Wavelet
13. Thresholding is used for:
A) Smoothing B) Segmentation
3
C) Enhancement D) Filtering
14. What does SVD stand for?
A) Single Value Definition B) Simple Vector Decomposition
C) Singular Value Decomposition D) Standard Vector Display
15. Morphological closing is equivalent to:
A) Erosion followed by dilation
B) Dilation followed by erosion
C) Only dilation
D) Only erosion

PART B – ANSWER ANY 2 QUESTIONS (5 × 2 = 10 marks)


Answer All Questions:
1. Explain applications of digital image processing
2. What is the need for filtering in image processing?
3. List any two differences between DCT and KLT.
4. What is the role of structuring elements in morphology?
5. Explain the concept of image thresholding.

PART C – ANSWER 5 MARK QUESTIONS (10× 5 = 50marks)


Answer All Questions. Each question has an internal choice.
1. (a) Explain the components of a digital image processing system with a neat diagram.
OR
(b) Describe different image sampling and quantization techniques.
2. (a) Derive and explain the 2D Discrete Fourier Transform and its properties.
OR
(b) Discuss spatial domain image enhancement techniques with suitable examples.
3. (a) Explain various image segmentation techniques. Compare edge-based and region-based segmentation.
OR
(b) Describe the basic morphological operations (erosion, dilation, opening, closing) with example
4. (A) Describe the steps involved in image compression using Transform coding. Explain with DCT as an
example.
OR
(B) Explain Huffman coding and Arithmetic coding in detail. Illustrate with an example for each.

4
5. (A) Describe the frequency domain methods of image enhancement. How is it different from spatial domain
methods?
OR
(B) Discuss the region-based and edge-based segmentation methods with suitable diagrams and examples.

5
IMAGE PROCESSING
UNIT 1- DIGITAL IMAGE FUNDAMENTALS
Digital Image Fundamentals: Image representation - Basic relationship between pixels, Elements
of DIP system - Applications of Digital Image Processing
2D Systems - Classification of 2D Systems
Mathematical Morphology - Structuring Elements - Morphological Image Processing
2D Convolution - 2D Convolution Through Graphical Method - 2D Convolution Through Matrix
Analysis.

IMAGE REPRESENTATION:
Image Presentation refers to how processed or raw image data is displayed, visualized, or prepared
for interpretation, particularly after acquisition and possibly after enhancement or transformation.

Fig: Fundamental Steps in Digital Image Processing

Thus, the values of the coordinates at the origin are (x, y) = (0, 0). The next coordinate
values along the first row of the image are represented as (x, y) = (0, 1).
Figure 1 shows the coordinate convention used

1. Purpose of Image Presentation


 To visualize the results of image processing.
 To communicate information effectively (e.g., in medical imaging or remote sensing).
6
 To highlight features or changes made during processing.
2. Key Components of Image Presentation

Display Devices

 Monitors/Displays: CRT, LCD, OLED


 Projectors or virtual/augmented reality displays
 Each device has a different resolution, aspect ratio, color depth, and brightness contrast.

Image Formats & Color Mapping


 Images may need to be converted to:

o Grayscale
o Binary
o RGB, HSV, or pseudo-color maps for display
 False color: Used in satellite or medical images to show features invisible to the naked eye.
 Scaling and Resolution
 Adjusting spatial resolution (pixels per inch)
 Intensity scaling to make hidden details visible (e.g., contrast stretching, histogram
equalization)
Annotation & Overlays
 Adding labels, arrows, or boundaries to highlight features.
 Used in object recognition, medical scans (e.g., showing tumor boundaries).

Human Visual Perception Consideration

 The presentation often considers how the human eye perceives contrast, color, and detail.
 Techniques like gamma correction or perceptual color scales are applied.

3. Techniques Related to Image Presentation

Technique Purpose
Contrast Stretching Improve visibility of features

Histogram Equalization Enhance contrast

Color Mapping Improve feature recognition using pseudo-colors

Image Fusion Combine multiple images (e.g., MRI + CT) for richer visual content

7
Zooming and Interpolation Display fine details at higher magnification

4. Applications
 Medical Imaging: Enhancing X-rays, MRIs for diagnosis.
 Remote Sensing: Using false color to identify vegetation, water, urban areas.
 Industrial Inspection: Showing defects on product surfaces.
 Forensics: Revealing faint or hidden patterns.

BASIC RELATIONSHIP BETWEEN PIXELS, ELEMENTS OF DIP SYSTEM:


Pixels (short for picture elements) are the smallest units of a digital image. An image is made
up of rows and columns of these pixels, and their relationships are defined based on their spatial
proximity and intensity values.
1. Neighborhood Relationships
4-Neighbors (N4)
A pixel has four direct neighbors:
 Left (x-1, y)
 Right (x+1, y)
 Up (x, y-1)
 Down (x, y+1)
This is called 4-connectivity.
Diagonal Neighbors (ND)
The four diagonal neighbors:
 (x-1, y-1)
 (x+1, y-1)
 (x-1, y+1)
 (x+1, y+1)
8-Neighbors (N8)
Includes both direct and diagonal neighbors (combining N4 and ND).
Used for 8-connectivity, useful for more inclusive region-growing.
• A pixel p at coordinates (x,y) has four horizontal and vertical neighbors whose coordinates
are given by:
(x+1,y), (x-1, y), (x, y+1), (x,y-1)

8
This set of pixels, called the 4-neighbors or p, is denoted by N4(p). Each pixel is one unit
distance from (x,y) and some of the neighbors of p lie outside the digital image if (x,y) is on the
border of the image. The four diagonal neighbors of p have coordinates and are denoted by ND (p).
(x+1, y+1), (x+1, y-1), (x-1, y+1), (x-1, y-1)

These points, together with the 4-neighbors, are called the 8-neighbors of p, denoted by N8 (p).

As before, some of the points in ND (p) and N8 (p) fall outside the image if (x,y) is on the border of
the image.

2. Adjacency
Adjacency defines if two pixels are connected based on their intensity values and neighborhood type.
Types:
 4-adjacency: Connected through 4-neighbors with similar values.
 8-adjacency: Connected through 8-neighbors.
 m-adjacency (mixed): A hybrid that avoids ambiguous connections in 8-adjacency.

a) Arrangement of pixels; (b) pixels that are 8-adjacent (shown dashed) to the center pixel; (c) m-
adjacency

3. Connectivity
Connectivity refers to how a set of pixels with the same value forms a connected region.
 4-connected region: Only through 4-neighbors.
9
 8-connected region: Uses all 8-neighbors.
 m-connected region: Mixed rule to avoid multiple connections
4. Distance Measures Between Pixels
These define how far apart two pixels are:
Euclidean Distance (d_e)
City Block Distance (Manhattan Distance, d_4)
Chessboard Distance (d_8)
• The Euclidean Distance between p and q is defined as:
De (p,q) = [(x – s)2 + (y - t)2]1/2

Pixels having a distance less than or equal to some value r from (x,y) are the points contained in a
disk of radius „ r „centered at (x,y)

• The D4 distance (also called city-block distance) between p and q is defined as:
D4 (p,q) = | x – s | + | y – t |
Pixels having a D4 distance from (x,y), less than or equal to some value r form a Diamond centered at
(x,y)

Example:
The pixels with distance D4 ≤ 2 from (x,y) form the following contours of constant distance.
The pixels with D4 = 1 are the 4-neighbors of (x,y)

• The D8 distance (also called chessboard distance) between p and q is defined as:
D8 (p,q) = max(| x – s |,| y – t |)

10
Pixels having a D8 distance from (x,y), less than or equal to some value r form a square Centered at
(x,y).
Example:
D8 distance ≤ 2 from (x,y) form the following contours of constant distance.

• Dm distance:
It is defined as the shortest m-path between the points. In this case, the distance between two
pixels will depend on the values of the pixels along the path, as well as the values of
their neighbors.

• Example:
Consider the following arrangement of pixels and assume that p, p2, and p4 have value 1 and that p1
and p3 can have can have a value of 0 or 1 Suppose that we consider the adjacency of pixels values 1
(i.e. V = {1})

Now, to compute the Dm between points p and p4


Here we have 4 cases:
Case1: If p1 =0 and p3 = 0
The length of the shortest m-path (the Dm distance) is 2 (p, p2, p4)

Case2: If p1 =1 and p3 = 0
now, p1 and p will no longer be adjacent (see m-adjacency definition)
then, the length of the shortest path will be 3 (p, p1, p2, p4)

Case3: If p1 =0 and p3 = 1
The same applies here, and the shortest –m-path will be 3 (p, p2, p3, p4
11
Case4: If p1 =1 and p3 = 1
The length of the shortest m-path will be 4 (p, p1 , p2, p3, p4)

ELEMENTS OF DIGITAL IMAGE PROCESSING


The elements of a Digital Image Processing (DIP) system involve a sequence of components that
handle the capture, processing, analysis, and display of digital images.

Elements of a Digital Image Processing System:


1. Image Acquisition
o Purpose: Capturing the image.
o Components:
 Sensors (camera, scanner, satellite)
 Digitizer (converts analog to digital if needed)
o Output: A digital image (array of pixels).
2. Preprocessing
o Purpose: Improve image quality or prepare for further processing.
o Techniques:
 Noise reduction
 Contrast enhancement
 Image resizing or scaling
 Gray-level transformations
 Histogram equalization

12
3. Segmentation
o Purpose: Divide the image into meaningful regions or objects.

o Techniques:
 Thresholding
 Edge detection
 Region-based methods (region growing, splitting and merging)
4. Feature Extraction
o Purpose: Extract important characteristics or patterns from image regions.
o Examples:
 Shape, texture, color
 Contours, corners, edges
 Statistical features (mean, variance)
[Link] Recognition / Analysis
o Purpose: Identify or classify objects in the image.
o Methods:
 Pattern recognition
 Machine learning / deep learning models (e.g., CNNs)
 Object detection and classification
6 Image Compression and Storage
o Purpose: Reduce the size of image files for storage or transmission.
o Types:
 Lossless (e.g., PNG)
 Lossy (e.g., JPEG)
o Storage media: Hard drives, cloud storage, databases
7 Display and Visualization:
o Purpose: Show processed images or results.
o Components: Monitors, display devic

Element Function
Image Acquisition Captures digital image
Preprocessing Enhances image quality
Segmentation Divides image into meaningful parts
Feature Extraction Identifies13
important image features
Image Recognition Classifies or interprets image content
Compression & Storage Efficiently saves and transmits images
Display & Visualization Shows output images and results
APPLICATIONS OF DIGITAL IMAGE PROCESSING
1. Medical Imaging
 Applications:
o X-ray, MRI, CT scan, PET scan enhancement
o Tumor detection and classification
o Image-guided surgery
o Organ segmentation (e.g., brain, lungs)
2. Remote Sensing and Satellite Imaging
 Applications:
o Land use/land cover classification
o Disaster monitoring (floods, earthquakes, fires)
o Environmental monitoring (deforestation, pollution)
3. Photography and Image Enhancement
 Applications:
o Automatic image correction (brightness, contrast)
o Red-eye removal
o Image sharpening and denoising
4. Video Surveillance and Security
 Applications:
o Motion detection
o Face recognition
o Number plate recognition (ANPR)
o Intrusion detection
5. Autonomous Vehicles
 Applications:
o Lane detection
o Pedestrian and traffic sign recognition
o Obstacle avoidance

14
6. Industrial and Manufacturing Automation
 Applications:
o Quality control (e.g., detecting defects in products)
o Barcode and QR code scanning
o Robot vision for assembly tasks
7. Document Processing and OCR
 Applications:
o Optical Character Recognition (OCR)
o Handwriting recognition
o Scanned document enhancement
8. Entertainment and Augmented Reality
 Applications:
o Special effects in movies
o Facial motion capture
o AR filters in social media apps
9. Biometrics
 Applications:
o Face recognition
o Fingerprint and iris recognition
10. Agriculture and Food Industry
 Applications:
o Crop health monitoring via drones
o Sorting fruits and vegetables based on shape/size

2D Systems in Digital Image Processing

15
A 2D system refers to any system that processes two-dimensional signals, primarily
images, which are functions of two spatial variables: x (horizontal) and y (vertical). These
systems are foundational in Digital Image Processing (DIP) because digital images are
essentially 2D arrays (matrices) of pixel values.

Concepts of 2D Systems:
1. 2D Signals
 A 2D signal is a function f(x,y) representing an image.
 Pixel intensity varies based on position (x,y).
Example:
A grayscale image is a 2D array where each value represents brightness

2. 2D Linear Systems
 A system is linear if it satisfies:
Additivity: T[f1+f2]=T[f1]+T[f2]
Homogeneity: T[a⋅f]=a⋅T[f]
In image processing, many filters (e.g., averaging, edge detection) are linear operations.
3. 2D Convolution
 Fundamental operation in image processing.
 Defined as:

(f∗h)(x,y)=m∑n∑f(m,n)⋅h(x−m,y−n)

 Used for:
o Blurring
o Sharpening
o Edge detection

4. 2D Fourier Transform
 Used to analyze frequency content of images.
 Converts spatial data f(x,y)f(x, y)f(x,y) into frequency domain F(u,v)F(u, v)F(u,v).
 Useful in:
o Image compression
o Image filtering
o Pattern recognition

16
5. 2D Sampling and Quantization
 Sampling: Converting a continuous image into discrete pixel values.
 Quantization: Assigning pixel values to a finite set (e.g., 0–255 for 8-bit images).
6. 2D Filtering
 Spatial domain filtering: Directly modifies pixel values using a kernel or mask.
 Frequency domain filtering: Modifies image frequencies after transforming the image.

CLASSIFICATION OF 2D SYSTEM
The classification of 2D systems (two-dimensional systems) is commonly done based on the
system's properties and how it processes signals in two dimensions — typically spatial (like images)
or spatiotemporal signals. Here's an overview of how 2D systems are classified:
1. Based on Linearity
Linear 2D Systems: Obey superposition and homogeneity.
Example: Linear filters used in image processing (e.g., averaging, Sobel filters).
Non-linear 2D Systems: Do not obey linearity principles
Example: Median filters, morphological operations.
2. Based on Time/Shift Invariance
Shift-Invariant (or Space-Invariant): Output does not change if the input is shifted.
Example: Convolution with a fixed kernel.
Shift-Variant (or Space-Variant): Output depends on the input's position.
Example: Adaptive filters where kernel changes with position.
3. Based on Causality
Causal 2D Systems: Output at any point depends only on current and past inputs.
Difficult to define strictly in 2D but useful in time-space systems.
Non-Causal 2D Systems: Output depends on future inputs too.
Example: Many image processing algorithms (since images are available fully).
4. Based on Stability
Stable 2D Systems: Bounded input produces bounded output (BIBO stable).
Unstable 2D Systems: Bounded input can produce unbounded output.

17
5. Based on System Response
Static (Memoryless): Output depends only on the current input point.
Dynamic (With Memory): Output depends on current and neighboring (past) inputs.
6. Based on Domain
Spatial Domain: Operates directly on 2D data (e.g., image pixels).
Frequency Domain: Operates via transforms like 2D Fourier or 2D DCT.
7. Based on Implementation
Recursive Systems: Use feedback; output depends on previous outputs.
Non-Recursive Systems: Only use present and past inputs.

MATHEMATICAL MORPHOLOGY
Mathematical morphology is a theory and technique for the analysis and processing of geometrical
structures in digital images. It is based on set theory, lattice theory, topology, and random functions
USES:- Extraction of image components useful in representation and description, such as
boundaries, skeletons, and the convex hull.
STRUCTING ELEMENTS:
A small shape or template used to probe or interact with an input image. It defines the
neighborhood used in morphological operations.
This simple "probe" is called the structuring element, and is itself a binary image (i.e., a subset of the
space or grid).
Here are some examples of widely used structuring elements (denoted by B):
 Let ; B is an open disk of radius r, centered at the origin.
 Let ; B is a 3 × 3 square, that is, B = {(−1, −1), (−1, 0), (−1, 1), (0, −1), (0, 0), (0, 1), (1, −1),
(1, 0), (1, 1)}.
 Let ; B is the "cross" given by B = {(−1, 0), (0, −1), (0, 0), (0, 1), (1, 0)}

BASIC OPERATIONS
The basic operations are shift-invariant (translation invariant) operators strongly related
to Minkowski addition.

Let E be a Euclidean space or an integer grid, and A a binary image in E.

18
Morphological Image Processing:

1. Erosion (⊖):
o Shrinks the boundaries of foreground (white) regions.

o Binary: A ⊖ B → keeps only parts of A where B fits entirely.


o Removes small white noise, disconnects thin bridges.

A⊖B={z∣Bz⊆A}
o Effect: Reduces size of objects.
o

2. Dilation (⊕):
o Expands the boundaries of foreground regions.

o Binary: A ⊕ B → adds pixels to the boundaries of A.


o Fills small holes and connects nearby objects.

A⊕B={z∣(Bref)z∩A=∅}
o Effect: Increases size of objects.
o

o A ∘ B = (A ⊖ B) ⊕ B
3. Opening (∘):

o Smooths contours, removes small objects.


o Effect: Removes small foreground noise.

o A • B = (A ⊕ B) ⊖ B
4. Closing (•):

o Fills small holes, connects small gaps.


o Effect: Smooths contours, fills small holes.

🔸 Advanced Operations

1. Morphological Gradient:
o Difference between dilation and erosion.
o Emphasizes object boundaries.
2. Top-hat Transform:
o Top-hat = Original - Opening
o Extracts small elements and details brighter than background.
3. Black-hat Transform:
o Black-hat = Closing - Original
o Extracts dark features smaller than the structuring element.

19
4. Skeletonization:
o Reduces objects to thin versions while preserving topology.
o Useful for shape representation and pattern recognition.

Operation Purpose Effect Symbol

Erosion Shrink foreground Removes noise, small details A⊖B

Dilation Expand foreground Fills gaps, connects components A⊕B

Opening Erosion + Dilation Removes small objects A∘B

Closing Dilation + Erosion Fills small holes A∙B

2D CONVOLUTION

2D convolution is a fundamental operation in image processing, computer vision, and deep learning.
It involves applying a small matrix (called a kernel or filter) to an input image or feature map to
extract patterns like edges, textures, or shapes.

O(x,y)=∑i∑jI(x+i,y+j)⋅K(i,j)
where O(x,y) is the output pixel, (i, j) are kernel indices, and (x, y) are image pixel positions.
2D CONVOLUTION THROUGH GRAPHICAL METHOD

1. Image Representation: Consider the input image as a 2D grid of pixels.


2. Kernel (Filter): A smaller matrix moves across the image, performing element-wise
multiplication with the overlapping pixels.
3. Summation & Output: The sum of these multiplications replaces the central pixel, forming a
new processed image.

EXAMPLE:

20
FIGURE 1: Input matrices, where x represents the original image and h represents the kernel.

Step 1: Matrix inversion


This step involves flipping of the kernel along, say, rows followed by a flip along its columns, as
shown in Figure 2.

Figure 2: Pictorial representation of matrix inversion

As a result, every (i,j)th element of the original kernel becomes the (j,i)th element in the new matrix.

21
Figure 3. Convolution results obtained for the output pixels at (6,5)

Hence the resultant output matrix will be:

22
One important thing to be mentioned is the fact that zero padding is not the only way to deal with the
edge effects brought about by convolution. Other padding techniques include replicate padding,
periodic extension, mirroring, etc.

2D CONVOLUTION THROUGH MATRIX ANALYSIS


2D convolution can be efficiently represented using matrix analysis, transforming the
convolution operation into a matrix multiplication problem. This approach is particularly useful in
signal processing and computer vision, where convolution is a fundamental operation.

Matrix Representation of 2D Convolution


Instead of performing convolution using a sliding window, we can express it as a matrix
multiplication:
1. Flatten the Input Matrix: Convert the input image or signal into a column vector.
2. Construct a Toeplitz Matrix: The convolution kernel is transformed into a structured matrix
(Toeplitz or doubly blocked Toeplitz), which captures the sliding-window effect.
3. Matrix Multiplication: The convolution result is obtained by multiplying the Toeplitz
matrix with the flattened input vector.

23
4. Reshape the Output: The resulting vector is reshaped back into a matrix form.
Advantages of Matrix-Based Convolution
 Computational Efficiency: Matrix multiplication can be optimized using hardware-
accelerated linear algebra libraries.
 Parallelization: Many modern architectures (GPUs, TPUs) are optimized for matrix
operations.
 Memory Access Optimization: Regular memory access patterns improve cache utilization.

Typical implementations use a sliding-window operation where the kernel moves across the input
image. For each placement of the kernel on the input image, we compute the dot product of the
kernel and the overlapping image pixels.

QUESTION BANKS
1. What is a digital image?
A. A collection of analog signals
B. A physical photograph
C. A matrix of pixel values
D. A scanned copy of a document
Explanation: A digital image is represented as a 2D matrix where each element (pixel) holds

24
intensity values

2. What does each pixel in a grayscale image represent?


A. Color value
B. Intensity level
C. Frequency
D. Contrast
Explanation: In grayscale images, each pixel holds a value indicating brightness (intensity) from
black (0) to white (255).

3. Which is the most common size of pixel in digital images?


A. 4-bit
B. 8-bit
C. 16-bit
D. 24-bit
Explanation: 8-bit images use values from 0–255 for intensity, common in grayscale imaging.
4. What is the smallest addressable element in an image?
A. Voxel
B. Pixel
C. Element
D. Frame
Explanation: A pixel (picture element) is the smallest unit of a digital image.
5. What does resolution refer to in a digital image?
A. File size
B. Number of bits per pixel
C. Number of pixels in an image
D. Image format
Explanation: Resolution refers to the amount of detail in an image, defined by the number of pixels.

6. What is 4-neighborhood of a pixel?


A. Diagonal neighbors
B. Horizontal and vertical neighbors
C. All surrounding pixels
D. None
Explanation: 4-neighbors are left, right, top, and bottom pixels of the central pixel.

7. How many neighbors does a pixel have in an 8-connected neighborhood?


A. 4
B. 6
C. 8
D. 9
Explanation: It includes all adjacent pixels: horizontal, vertical, and diagonal.

25
8. What is adjacency in image processing?
A. Overlapping of pixels
B. Relationship of colors
C. Connectivity between pixels
D. None
Explanation: Adjacency defines whether pixels are considered connected based on neighborhood
criteria.

9. What is path in a digital image?


A. File location
B. Sequence of pixels connecting two points
C. Pixel size
D. Format of image
Explanation: A path is a sequence of adjacent pixels connecting two points.
10. What is used to capture an image in DIP systems?
A. Scanner
B. Microphone
C. Sensor
D. Display
Explanation: Image sensors (like CCD or CMOS) capture physical images and convert them to
digital.

11. What is the function of an analog-to-digital converter in DIP?


A. Compresses image
B. Enhances contrast
C. Converts image to binary
D. Converts analog image to digital format
Explanation: ADC converts continuous image data into discrete digital values.
12. Which component performs actual processing in a DIP system?
A. Camera
B. Computer
C. Display
D. Scanner
Explanation: The computer performs tasks such as filtering, enhancement, and analysis.
13. Which device displays the processed image?
A. Sensor
B. Processor
C. Monitor
D. ADC

26
Explanation: The monitor or display screen presents the output of DIP.
14. What is preprocessing in image processing?
A. Image printing
B. Image storage
C. Image preparation before analysis
D. Data encryption
Explanation: Preprocessing includes steps like noise removal, resizing, and contrast adjustment.

15. Which of the following is an application of DIP?


A. Audio recognition
B. Image enhancement
C. Voice detection
D. Data compression
Explanation: DIP is used to improve visual appearance for human interpretation.
16. Which field uses DIP for tumor detection?
A. Astronomy
B. Agriculture
C. Medicine
D. Traffic analysis
Explanation: Medical imaging uses DIP in MRI, CT scans, etc.
17. What is remote sensing?
A. Measuring objects without contact
B. Scanning documents
C. Compressing images
D. Enhancing videos
Explanation: It involves collecting image data from satellites or aerial sensors
18. How is DIP used in industry?
A. Measuring audio frequencies
B. Quality inspection of products
C. Data storage
D. File conversion
Explanation: DIP systems inspect shapes, colors, and defects in manufactured items.

19. Which of the following is a 2D signal?


A. Audio wave
B. Text file
C. Image
D. Binary number
27
Explanation: Images are 2D signals with spatial coordinates.

20. What does a 2D system process?


A. Sound data
B. Text data
C. Spatial data
D. Sequential data
Explanation: 2D systems handle input with two spatial dimensions (x, y).

21. What is linearity in a system?


A. It maintains angles
B. Follows superposition and scaling laws
C. Reduces image size
D. Inverts the image
Explanation: A linear system obeys additivity and homogeneity.

22. Which system does not change its behavior over time or space?
A. Causal system
B. Time-variant
C. Shift-invariant system
D. Nonlinear system
Explanation: Shift-invariant systems produce the same output for shifted input.
23. Which of the following is a nonlinear operation?
A. Addition
B. Convolution
C. Histogram equalization
D. Averaging
Explanation: Histogram equalization is nonlinear as it changes pixel values based on distribution.

24. What is convolution?


A. Multiplication of pixels
B. Averaging operation
C. Mathematical operation combining kernel and image
D. Rotation of an image
Explanation: Convolution blends pixel values using a kernel/mask.

25. What is a kernel?


A. File type
B. Image format

28
C. Small matrix for filtering operations
D. Image border
Explanation: A kernel (or mask) defines the filter applied during convolution.
26. What is dilation in morphology?
A. Shrinks objects
B. Smoothens image
C. Expands object boundaries
D. Converts image to grayscale
Explanation: Dilation adds pixels to object boundaries based on structuring element.
27. What is erosion in morphological image processing?
A. Enlarges objects
B. Shrinks object boundaries
C. Adds noise
D. Converts image to binary
Explanation: Erosion removes pixels from boundaries of objects.
28. What is a structuring element?
A. Image format
B. Kernel for morphological operations
C. Histogram
D. Pixel value
Explanation: It defines the neighborhood shape used in morphological operations.

29. What operation combines dilation and erosion?


A. Subtraction
B. Filtering
C. Opening or closing
D. Contrast stretching
Explanation: Opening is erosion followed by dilation; closing is the reverse.
30. What is 2D convolution useful for?
A. Storing images
B. Compressing images
C. Blurring or sharpening images
D. Capturing images
Explanation: Convolution applies filters like blur, sharpen, edge detection.

31. What does zero-padding help in convolution?


A. Increases brightness
B. Ensures output image is the same size as input
29
C. Changes color
D. Removes noise
Explanation: Zero-padding adds zeros to image borders to maintain dimensions.
32. What is a graphical method of convolution?
A. Code-based convolution
B. Step-by-step visualization of convolution
C. Histogram method
D. Geometric transformation
Explanation: It manually demonstrates convolution by flipping, shifting, multiplying.

33. In convolution, the kernel is usually:


A. Rotated 90°
B. Flipped both horizontally and vertically
C. Left unchanged
D. Mirrored
Explanation: For convolution, the kernel is flipped across both axes before applying.

34. What is matrix analysis in 2D convolution?


A. Image encryption
B. Matrix multiplication for filter operation
C. Histogram plotting
D. Color mapping
Explanation: Matrix analysis involves applying kernel as a matrix operation over the image.

35. What is the result of applying a Sobel filter?


A. Noise removal
B. Image rotation
C. Edge detection
D. Blurring
Explanation: Sobel filters detect edges by emphasizing intensity changes.

36. What operation in morphology is used to remove small white noises?


A. Erosion
B. Dilation
C. Opening
D. Closing
Explanation: Opening (erosion followed by dilation) removes small foreground objects

37. What is the result of a closing operation in morphology?


30
A. Breaks narrow gaps
B. Removes background noise
C. Fills small holes in objects
D. Shrinks objects
Explanation: Closing (dilation followed by erosion) fills small holes or gaps within an object.

38. Which is true about morphological operations?


A. They depend on pixel values only
B. They are independent of shapes
C. They use structuring elements
D. They convert color to grayscale
Explanation: Morphological operations are shape-based and require structuring elements.

39. What is the shape of a typical structuring element?


A. Line
B. Square
C. Circle
D. Any of the above
Explanation: Structuring elements can be any shape: square, circular, line, etc., depending on
application.
40. Which image transformation is linear?
A. Histogram equalization
B. Contrast stretching
C. Convolution
D. Log transformation
Explanation: Convolution satisfies linearity properties: additivity and scaling.

41. What is an impulse response in a system?


A. Output of the system for a sinusoidal input
B. Output when input is a single pixel (delta function)
C. Output for random noise
D. Frequency response
Explanation: Impulse response is the system’s output for a unit impulse (delta input), key in system
analysis.

42. What type of system is convolution used to describe?


A. Linear and time-varying
B. Nonlinear
C. Linear and shift-invariant
D. Random systems
Explanation: Convolution is valid only for linear, shift-invariant systems
31
43. Which operation enhances edges in images?
A. Smoothing
B. Erosion
C. High-pass filtering
D. Dilation
Explanation: High-pass filters accentuate edges by enhancing intensity differences.
44. What does spatial filtering involve?
A. Fourier transform
B. Image cropping
C. Convolution in the spatial domain
D. Histogram plotting
Explanation: Spatial filtering uses masks (kernels) applied via convolution on image pixels.

45. Which domain is used in 2D convolution?


A. Frequency domain
B. Spatial domain
C. Time domain
D. Wavelet domain
Explanation: 2D convolution is a spatial domain operation using kernels over image coordinates.

46. In convolution, the center of the kernel corresponds to:


A. Bottom-left pixel
B. Center of the neighborhood
C. Top-right pixel
D. First pixel of image
Explanation: The center of the kernel determines the current pixel being processed in convolution.

47. What is the purpose of filtering in DIP?


A. To enhance audio signals
B. To improve image brightness only
C. To modify image features like edges or smoothness
D. To change file format
Explanation: Filters can sharpen, blur, or detect edges depending on kernel used.

48. Which of these is a high-pass filter?


A. Mean filter
B. Laplacian filter
C. Gaussian filter
D. Box filter
32
Explanation: The Laplacian filter detects edges by highlighting high-frequency content.

49. What does a low-pass filter do in image processing?


A. Enhances edges
B. Removes noise and smoothens image
C. Sharpens image
D. Inverts pixel values
Explanation: Low-pass filters reduce high-frequency noise and blur fine details.
50. What is the effect of repeated convolution with a smoothing kernel?
A. Enhances contrast
B. Blurs image progressively
C. Detects edges
D. Fills holes
Explanation: Repeated smoothing (e.g., with Gaussian or averaging filters) blurs the image more
with each application.

5 MARK
1. Explain how a digital image is represented in a computer system.
2. Describe the basic relationships between pixels in an image.
3. Write short notes on any four important applications of Digital Image Processing..
4. What is Mathematical Morphology? Explain the role of structuring elements in morphological
operations.
5. Perform a 2D convolution through matrix analysis using a given image matrix and kernel.

10 MARK
[Link] a 2D system. Explain the classification of 2D systems with suitable examples.
2. Define 2D convolution. Explain how 2D convolution is used in graphical Method
[Link] the applications of Digital Image Processing in detail.

--------------------------------------------Unit 1 Completed----------------------------------------------

33
UNIT 2- 2D IMAGE TRANSFORMS
2D Image transforms: Properties of 2D - DFT – Walsh transform - Hadamard transform - Haar
transform - Discrete Cosine Transform - Karhunen Loeve Transform - Singular Value Decomposition.
In digital image processing, image transforms convert an image from the spatial domain to
another mathematical domain (like frequency domain). This makes certain image operations (e.g.,
filtering, compression) easier and more efficient.
2D TRANSFORMS:

Transform Domain Used For

Fourier Transform (FT) Frequency Frequency analysis, filtering

Discrete Cosine Transform (DCT) Frequency Compression (e.g., JPEG)

Dis
cret Frequ
e ency
Wav Com
elet pressi
Ti
Tra on,
m
nsfo multi
e-
rm -
(D resol
WT ution
)

Hadamard Transform Binary domain Fast processing, compression

Walsh
Binary domain Pattern recognition
Transform
34
1. 2D Discrete Fourier Transform (DFT):
🔸 Formula:

For an image f(x,y) of size M×N:


F(u,v)=x=0∑M−1y=0∑N−1f(x,y)⋅e−j2π(Mux+Nvy)
🔸 Inverse DFT:

f(x,y)=MN1u=0∑M−1v=0∑N−1F(u,v)⋅ej2π(Mux+Nvy)
🔸 Example:

Let a simple 2×2 image matrix be: f(x,y)= 1 3


2 4
The DFT of this matrix is:

F(u,v)= 10 -2
-4 0

🔹 2. 2D Discrete Cosine Transform (DCT):


Used in JPEG image compression
🔸 Formula:

F(u,v)=MN2C(u)C(v)x=0∑M−1y=0∑N−1f(x,y)cos[2Mπ(2x+1)u
]cos[2Nπ(2y+1)v].

Where:
1
 C(u)= . when u=0, otherwise 1.
√2
🔸 Example:
Using same 2×2 matrix:

f(x,y)= 1 2
35
3 4
After applying DCT, we get:

F(u,v)≈ 5.00 -1.00

-2.00 0.00

🔹 3. 2D Discrete Wavelet Transform (DWT):


 Divides the image into approximation (low frequency) and detail (high frequency) parts.
 Widely used in image compression and denoising.
🔸 Example:
Applying 1-level Haar DWT to:
4 6
10 12
Yields approximation and detail sub-bands.

🔹 4. Applications of 2D Transforms

Application Transform Used

Image filtering Fourier

Image compression (JPEG) DCT

Multi-resolution analysis DWT

Fast pattern matching Hadamard/Walsh

PROPERTIES OF 2D
In digital image processing, a 2D system takes a 2D input image and produces a 2D output image.
The properties of such systems determine their behavior and influence the design of image filters,
convolution operations, and transformations.

36
1. Linearity
 A system is linear if it satisfies additivity and homogeneity (scaling).
 Mathematical expression:

if T{af1(x,y)+bf2(x,y)}=aT{f1(x,y)}+bT{f2(x,y)} , then the


system is linear.
Example: Convolution with a constant kernel is linear.
2. Shift Invariance (Translation Invariance)
 A system is shift-invariant if a shift in the input causes an equivalent shift in the output.
 Example: Convolution is shift-invariant; thresholding is not.
3. Causality
 In temporal systems, causality means output at any time depends only on past or present
inputs.
 In 2D image systems, causality is not strictly applicable, as the image is spatial, not time-
dependent.
4. Stability
 A system is bounded-input, bounded-output (BIBO) stable if a bounded input always
produces a bounded output.
 Example: Most linear filtering systems like Gaussian filters are stable.

5. Memory
 A system has memory if the output at any pixel depends on neighborhood pixels.
 Memoryless system: Output depends only on the input at the same position.
 Example:
o Memory: Smoothing filter (uses neighborhood).
o Memoryless: Point-wise contrast adjustment.
6. Invertibility
 A system is invertible if the original input can be reconstructed from the output.
 Useful in deblurring or inverse filtering.
 Example: Linear convolution is invertible under some conditions.
37
7. Isotropy (Rotational Invariance)
 A system is isotropic if its behavior is the same in all directions.
 Example: Gaussian smoothing filter is isotropic (circular symmetry).
8. Time/Frequency Localization
 Important in wavelet transforms, where spatial and frequency details are localized.
 Example: DWT provides multi-resolution analysis.
9. Superposition Property
 Related to linearity; superposition implies combining responses from individual inputs.

🔸 Summary Table

Property Description Example

Linearity Output is linear combo of inputs Convolution

Shift Invariance Shift in input = shift in output Image filtering

Stability Bounded input = bounded output Smoothing filter

Memory Output depends on neighborhood pixels Morphological operations

Invertibility Input can be reconstructed from output Deblurring

Isotropy Response is rotation-independent Gaussian blur

Discrete Fourier Transform (DFT) in 2D transform:


What is DFT?
The Discrete Fourier Transform (DFT) transforms a spatial domain image (pixel-based) into the
frequency domain. It helps analyze the image based on its frequency content (like edges, textures,
and patterns).

38
Why Use DFT in Image Processing?
 Separates low-frequency (smooth) and high-frequency (edges, noise) components
 Makes filtering (low-pass, high-pass) easier
 Useful in image compression, enhancement, and restoration

2D DFT Formula:

For a 2D image f(x,y)of size M×N

 (x,y): spatial domain coordinates


 (u,v): frequency domain coordinates
 j: imaginary unit
 F(u,v)F: DFT output (complex)

Inverse DFT (IDFT)

 Used to reconstruct the original image from the frequency domain

39
Example:

Consider a 2×2 image: f(x,y)= 1 2

3 4
Apply 2D DFT:

F(u,v)= 10 -2

-4 0
 The DC component (low frequency) is 10
 Other values represent high-frequency variations

Properties of DFT

Property Description

Linearity DFT of a sum is the sum of DFTs

Translation Shifting image → phase shift in frequency

Convolution Theorem Convolution in spatial domain = multiplication in frequency domain

Symmetry For real images, DFT has conjugate symmetry

Applications of DFT
 Frequency domain filtering (e.g., removing noise)
 Edge detection
 Image compression
 Pattern recognition
 Image enhancement

Walsh transform in 2D transforms:

40
The Walsh Transform is a non-sinusoidal, orthogonal transform used in image processing.
Unlike the Fourier transform, which uses sine and cosine waves, the Walsh transform uses square
waveforms called Walsh functions, which take only +1 and -1 values.
1-D Inverse Walsh Transform

The above is again equivalent to

Key Features
Feature Description

Basis Functions Square waves (binary, piecewise constant)

Values +1 and –1 only

Orthogonality All Walsh functions are mutually orthogonal

Domain Time/space domain (non-frequency based)

Application Scope Image compression, filtering, pattern recognition

The Walsh transform is defined as follows for two dimensional signals.

The inverse Walsh transform is defined as follows for two dimensional signals

41
Properties of the Walsh Transform
 The Walsh transform is real, symmetric and orthogonal.

 The Walsh transform is a fast transform

 The Walsh transform has very good to excellent energy compaction property of
images,


transform consists of a series expansion of basis functions whose values are only or
and they have the form of square waves. These functions can be implemented more
efficiently in a digital environment than the exponential basis functions of the Fourier
transform.


multiplicative factor of for 1-D signals.

 entical for 2-D signals. This is


because the array formed by the kernels is a symmetric matrix having orthogonal rows
and columns, so its inverse array is the same as the array itself.

 ions
can think of frequency as the number of zero crossings or the number of transitions in a
basis vector and we call this number sequency. The Walsh transform exhibits the
property of energy compaction as all the transforms that we are currently studying


called Fast Walsh Transform (FWT). This is a straightforward modification of the FFT.

Hadamard Transform
In a similar form as the Walsh transform, the 2-D Hadamard transform is defined as follows.

42
Properties of the Hadamard Transform

 The Hadamard transform is real, symmetric and orthogonal.


 The Hadamard transform is a fast transform
 The Hadamard transform has very good to excellent energy compaction property of
images,

Properties are almost similar to that of Walsh transform.


The Hadamard transform differs from the Walsh transform only in the order of basis functions. The
order of basis functions of the Hadamard transform does not allow the fast computation of it by
using a straightforward modification of the FFT. An extended version of the Hadamard transform is
the Ordered Hadamard Transform for which a fast algorithm called Fast Hadamard Transform
(FHT) can be applied

Harr Transform

The harr function hk(x) are defined on a continuous interval, x ϵ [0,1], and for k=
0 to N-1, where N=2n, The integer k can be uniquely decomposed as

K= 2p+q-1
Where 0≤p≤n-1
q=0,1 for p=0 and 1≤q≤2p.
For example, N=4 we have

43
The harr function can be defined as

For N=[Link] harr transform is given by

Properties of Harr transform

 The Harr transform is real and orthogonal.


 The Harr transform is a fast transform
 The basis vectors of the Harr transform are sequency ordered
 The Harr transform is close to the KL transform of first order Markov
sequences. The Harr transform has poor energy compaction property
for images

THE DISCRETE COSINE TRANSFORM (DCT)

This is a transform that is similar to the Fourier transform in the sense that the new independent
variable represents again frequency. The DCT is defined below.

with a(u) a parameter that is defined below.

44
The inverse DCT (IDCT) is defined below.

Two dimensional signals (images)

Properties of the DCT transform


 The cosine transform is real and orthogonal.
 The cosine transform is not a real part of the unitary DFT.
 The cosine transform of a sequence is related to the DFT of its antisymmetric
extension
 The cosine transform is a fast transform
 The basis vectors of the cosine transform are the eigen vectors of the symmetric
tridiagonal of Toeplitz matrix
 The cosine transform is close to the KL transform of first order Markov sequences. The
cosine transform has very good to excellent energy compaction property of images,

The basic operation of the DCT is as follows:


 The input image is N by M;
 f(i,j) is the intensity of the pixel in row i and column j;
 F(u,v) is the DCT coefficient in row k1 and column k2 of the DCT matrix.
 For most images, much of the signal energy lies at low frequencies; these appear in the
upper left corner of the DCT.
 Compression is achieved since the lower right values represent higher frequencies, and
are often small - small enough to be neglected with little visible distortion.
 The DCT input is an 8 by 8 array of integers. This array contains each pixel's gray scale
level;
 8 bit pixels have levels from 0 to 255.

The DCT is a real transform. This property makes it attractive in comparison to the Fourier
transform.
45
The DCT has excellent energy compaction properties. For that reason it is widely used in image
compression standards (as for example JPEG standards).
There are fast algorithms to compute the DCT, similar to the FFT for computing the DFT.

Karhunen-Loeve Transform or KLT


The Karhunen-Loeve Transform or KLT was originally introduced as a series expansion
for continuous random processes by Karhunen and Loeve. For discrete signals Hotelling first
studied what was called a method of principal components, which is the discrete equivalent of
the KL series expansion. Consequently, the KL transform is also called the Hotelling transform
or the method of principal components

Descri
Feature
ption

KLT provides the best representation of a signal in the least-squares


Optimality
sense.

Data- The transform matrix depends on the statistical properties (covariance


dependent matrix) of the data.

Energy KLT concentrates the signal energy into the fewest number of
compaction components, ideal for compression.

.
Advantages:
 Optimal decorrelation.
 Maximum energy packing in the fewest components.
 Ideal for compression and pattern recognition.

Limitations:
 High computational complexity.
 Requires prior knowledge or estimation of the covariance matrix.
 Not suitable for real-time applications unless data statistics are fixed or slowly varying.

Applications :
 Image Compression: Like JPEG but uses KLT instead of DCT.
 Feature Extraction: Especially in face recognition (Eigenfaces).

46
 Noise Reduction: Removes low-variance components (noise).
 Dimensionality Reduction: Reduces high-dimensional image data for efficient storage or
learning.

47
Let ei and ,i
i n , be this set of eigenvectors and corresponding eigenvalues of Cx ,
arranged in

Properties of the Karhunen-Loeve transform


Despite its favourable theoretical properties, the KLT is not used in practice for the following
reasons.
 Its basis functions depend on the covariance matrix of the image, and hence they have to
recomputed and transmitted for every image.
 Perfect decorrelation is not possible, since images can rarely be modelled as
realisations of ergodic fields.
 There are no fast computational algorithms for its implementation.

48
SVD (Singular Value Decomposition)
SVD (Singular Value Decomposition) is a method used in linear algebra to decompose a
matrix into three simpler matrices, making it easier to analyze and manipulate.
SVD helps you split that table into three parts:
 U: This part tells you about the people (like their general preferences).
 Σ: This part shows how important each factor is (how much each rating matters).
 Vᵀ: This part tells you about the products (how similar they are to each other)

 the SVD of a matrix A (of size m×n) is represented as:


A=UΣV T
Here:
 U: An m×m orthogonal matrix whose columns are the left singular vectors of A.
 Σ: A diagonal m×n matrix containing the singular values of AA in descending order.

V : The transpose of an n×n orthogonal matrix, where the columns are the right singular
T

vectors of A.
How to perform Singular Value Decomposition
To perform Singular Value Decomposition (SVD) for the matrix A= 3 2 2
2 3 -2
Step 1: Compute A AT

First, we need to calculate the matrix A AT (where AT is the transpose of matrix A):

A= 3 2 2 A = 3 2
T

2 3 -2 2 3

2 -2

Now Compute A AT

3 2 2 3 2 17
8

2 3 -2 . 2 3 = 8 17

2 -2
T
Step 2: Find the Eigenvalues of A A

det(A AT −λI) = 0

det 17-λ 8
49
8 17-λ

(λ−25)(λ−9)=0
Thus, the eigenvalues are λ1=25λ1=25 and λ2=9λ2=9. These eigenvalues correspond to the
singular values σ1=5σ1=5 and σ2=3σ2=3, since the singular values are the square roots of the
eigenvalues.

Step 3: Find the Right Singular Vectors (Eigenvectors of AT A)

Next, we find the eigenvectors of AT A for λ=25 and λ=9.


For λ=25:
Solve ( AT A−25I) v=0:
T
A A−25I= -12 12 2

12 -12 -2

2 -2 -17
The eigenvector corresponding to λ=25 is
1
v1= √2
1
√2
0
For λ=9:

Solve ( AT A−9I)v=0
The eigenvector corresponding to λ=9 is:
1
v2= √18
1
√18
4
√18

Step 4: Compute the Left Singular Vectors (Matrix U)


50
1
To compute the left singular vectors U, we use the formula ui= Aui . This results in:
σi

1 1
U= √2 √2
1 −1
√2 √2

Step 5: Final SVD Equation


Finally, the Singular Value Decomposition of matrix A is:
A=UΣ V T
Where:
1 1
U=
√2 √2
1 −1
√2 √2
Σ= 5 0 0
0 3 0

1 1
V= 0
√2 √ 2
1 −1 4
√18 √18 √18
2 −2 1
3 3 3

Thus, the SVD of matrix AA is:


1 1 1 1
A= 5 0 0 0
√2 √2 √2 √ 2
1 −1 1 −1 4
0 3 0
√2 √2 √18 √18 √18
2 −2 1
3 3 3
This is the Result SVD matrix of matrix A.

51
QUESTION BANKS
1. What is the primary purpose of image transforms in DIP?
a) Enhance image sharpness
b) Represent images in frequency domain
c) Reduce file size
d) Apply color filters
✅ Answer: b
2. Which transform converts spatial data into frequency components?
a) DFT
b) DCT
c) Walsh
d) All of the above
✅ Answer: d
3. What does a separable transform imply?
a) It works only for square images
b) It can be applied row-wise and column-wise independently
c) It compresses only grayscale images
d) It is non-reversible
✅ Answer: b
4. Which of the following transforms is orthogonal?
a) DFT
b) DCT
c) Walsh
d) All of the above
✅ Answer: d
5. Which transform is best for energy compaction?
a) Fourier
b) DCT
c) Hadamard
52
d) Haar
✅ Answer: b
6. Which of the following is NOT a reason to use image transforms?
a) Feature extraction
b) Image compression
c) Histogram equalization
d) Image filtering
✅ Answer: c
7. Which domain does the DFT operate in?
a) Spatial
b) Frequency
c) Time
d) None
✅ Answer: b
8. Which of the following is a 2D image transform?
a) 2D FFT
b) 2D DCT
c) 2D Walsh
d) All of the above
✅ Answer: d
9. Image transforms work on which type of images?
a) Only color images
b) Only grayscale images
c) Binary images
d) All image types
✅ Answer: d
10. Which property ensures that the transform can be reversed?
a) Linearity
b) Separability
c) Invertibility
d) Orthogonality
✅ Answer: c
11. Which function is used in the basis of DFT?
a) Cosine
b) Sine
c) Complex exponentials
d) Square waves
✅ Answer: c
12. What is the range of frequency components in DFT?
a) 0 to M
b) –π to π
c) 0 to ∞

53
d) 0 to 255
✅ Answer: b
13. Which DFT property allows frequency domain convolution?
a) Symmetry
b) Linearity
c) Translation
d) Convolution theorem
✅ Answer: d
14. In DFT, the transform of a real and even function is:
a) Real and even
b) Imaginary and odd
c) Complex and odd
d) Imaginary and even
✅ Answer: a

15. How is 2D DFT computed?


a) Apply 1D DFT on rows only
b) Apply 1D DFT on rows and columns
c) Use histogram
d) None
✅ Answer: b
16. Which part of DFT output contains the most energy for natural images?
a) Corners
b) Center
c) Diagonal
d) Border
✅ Answer: b
17. What is the computational complexity of 2D DFT (naive method)?
a) O(MN)
b) O(M²N²)
c) O(MN log MN)
d) O(log M + log N)
✅ Answer: b
18. Which is the fast algorithm for computing DFT?
a) DCT
b) FFT
c) SVD
d) None
✅ Answer: b
19. The imaginary part of a DFT arises due to:
a) Odd symmetry
b) Even symmetry
54
c) Constant images
d) Real-valued inputs
✅ Answer: a
20. Shifting an image in the spatial domain results in:
a) Phase shift in frequency domain
b) Amplitude increase
c) Blur
d) Centered transform
✅ Answer: a
21. DCT uses which basis function?
a) Sine
b) Cosine
c) Exponential
d) Gaussian
✅ Answer: b

22. Which of the following is true for DCT?


a) Energy is distributed across the entire spectrum
b) Energy is compacted in low frequencies
c) Output is always complex
d) Not useful for compression
✅ Answer: b
23. DCT is commonly used in:
a) MRI
b) Satellite imaging
c) JPEG compression
d) Edge detection
✅ Answer: c
24. Which DCT coefficient represents average intensity?
a) DC
b) AC
c) Imaginary
d) Maximum
✅ Answer: a
25. The main advantage of DCT over DFT is:
a) Faster
b) Energy compaction and real output
c) Complex representation
d) Better for noise
✅ Answer: b
26. Which image region has high-frequency DCT coefficients?
a) Smooth
55
b) Edge
c) Uniform
d) Low-contrast
✅ Answer: b
27. DCT is real-valued for:
a) Real input images
b) Complex input
c) Noisy images
d) Binary images
✅ Answer: a
28. In JPEG, which DCT coefficients are often quantized heavily?
a) Low frequency
b) High frequency
c) DC
d) None
✅ Answer: b

29. Which transform is best suited for lossy image compression?


a) DFT
b) Haar
c) DCT
d) Laplace
✅ Answer: c
30. DCT is preferred over DFT for image compression because:
a) Less memory
b) No complex numbers
c) Better energy compaction
d) Faster
✅ Answer: c
31. The Walsh transform uses which type of waveforms?
a) Sinusoidal
b) Cosine
c) Square
d) Triangular
✅ Answer: c
32. Hadamard matrix contains elements of:
a) 0 and 1
b) –1 and 1
c) 0 and –1
d) Only 1
✅ Answer: b

56
33. Hadamard and Walsh transforms are:
a) Non-orthogonal
b) Non-separable
c) Orthogonal
d) Inverse-only
✅ Answer: c
34. Haar transform is best used for:
a) Color images
b) Binary image segmentation
c) Multiresolution analysis
d) Smoothing
✅ Answer: c
35. Haar transform basis functions are:
a) Sine waves
b) Cosine waves
c) Step functions
d) Exponentials
✅ Answer: c

36. Which transform is best for representing blocky, low-resolution images?


a) Haar
b) DCT
c) Walsh
d) Laplace
✅ Answer: a
37. Walsh transform is particularly effective for:
a) Edge detection
b) Histogram equalization
c) Binary image compression
d) Color mapping
✅ Answer: c
38. Hadamard transform is computationally efficient due to:
a) Use of FFT
b) Binary operations
c) Sparse matrices
d) No multiplication
✅ Answer: d
39. Which transform is not based on sinusoidal functions?
a) DFT
b) DCT
c) Walsh

57
d) Fourier
✅ Answer: c
40. The order of Hadamard transform matrix must be:
a) Prime
b) Power of 2
c) Even
d) Odd
✅ Answer: b
41. SVD stands for:
a) Single Value Decomposition
b) Simple Value Decomposition
c) Singular Value Decomposition
d) Singular Vector Division
✅ Answer: c
42. In SVD, matrix D contains:
a) Eigenvalues
b) Singular values
c) Zeroes
d) Imaginary values
✅ Answer: b

43. U and V matrices in SVD are:


a) Diagonal
b) Orthogonal
c) Sparse
d) Random
✅ Answer: b
44. SVD is useful in image processing for:
a) Segmentation
b) Compression
c) Denoising
d) Both b and c
✅ Answer: d
45. SVD can be applied to:
a) Only square matrices
b) Only grayscale images
c) Any M×N matrix
d) Only real matrices
✅ Answer: c
46. What is the size of matrix D in SVD of A (M×N)?
a) M×N
b) M×M
58
c) N×N
d) M×N (diagonal)
✅ Answer: d
47. SVD approximates an image using:
a) High-rank matrices
b) Low-rank approximation
c) Edge-based filtering
d) Median filtering
✅ Answer: b
48. SVD is computationally expensive but gives:
a) Better histogram
b) Higher accuracy
c) Poor compression
d) Real values
✅ Answer: b
49. Truncated SVD keeps:
a) All singular values
b) Only top-k singular values
c) Only diagonal matrix
d) None
✅ Answer: b

50. SVD is a type of:


a) Time-domain method
b) Space-domain method
c) Matrix factorization
d) Frequency filter
✅ Answer: c
5 MARKS
1. Compare DFT and DCT in terms of their properties and applications.
2. Describe the Walsh and Hadamard Transforms with their applications in DIP.
3. Explain the concept of Singular Value Decomposition (SVD) and its use in image
compression.
4. List and explain about properties of 2D image transforms.
5. Explain and compare the Haar Transform and Karhunen-Loeve Transform.

10 MARKS
1. Explain about different 2D image transforms: DFT, DCT, Walsh, Hadamard, and Haar.
2. Explain Singular Value Decomposition (SVD) in the context of image compression.

59
3. Explain 2D transforms and their properties in detail.

------------------------------------------unit 2
completed---------------------------------------------

UNIT-3 IMAGE ENHANCEMENT


Image Enhancement: Spatial domain methods-Point processing Intensity transformations Histogram
processing-Spatial filtering moothing filter - Sharpening filters
Frequency domain methods: low pass filtering; high pass Filtering - Homomorphic filter.
IMAGE ENHANCEMENT
 Improving the interpretability or perception of information in images for human
viewers
 The objective of enhancement technique is to process an image so that the result is
more suitable than the original image for a particular application.
 Providing `better' input for other automated image processing techniques
o Spatial domain methods:
 operate directly on pixels
60
o Frequency domain methods:
 operate on the Fourier transform of an image
SPATIAL DOMAIN METHODS
The term spatial domain refers to the image plane itself and approaches in this
categories are based on direct manipulation of pixel in an image. Spatial domain process are
denoted by the expression
g(x,y)=T[f(x,y)]
Where f(x,y)- input image, T- operator on f, defined over some neighborhood of f(x,y) and
g(x,y)-processed image
The neighborhood of a point (x,y) can be explain by using as square or rectangular sub image
area centered at (x,y).

The center of sub image is moved from pixel to pixel starting at the top left corner.
The operator T is applied to each location (x,y) to find the output g at that location . The
process utilizes only the pixel in the area of the image spanned by the neighborhood.

3.2.1Point Processing:
(i) Contract stretching:
It produces an image of higher contrast than the original one. The operation is performed by
darkening the levels below m and brightening the levels above m in the original image.

61
In this technique the value of r below m are compressed by the transformation function into a
narrow range of s towards black .The opposite effect takes place for the values of r above m.
(ii) Thresholding function:
It is a limiting case where T(r) produces a two levels binary image. The values below m are
transformed as black and above m are transformed as white.
3.2 Basic Gray Level Transformation Functions
It is the simplest form of the transformations when the neighborhood is of size IXI. In this
case g depends only on the value of f at (x,y) and T becomes a gray level transformation
function of the forms
S=T(r)
r- Denotes the gray level of f(x,y)
s- Denotes the gray level of g(x,y) at any point (x,y)
t- Denotes the gray level of g(x,y) at any point (x,y)
Because enhancement at any point in an image deepens only on the gray level at that point,
technique in this category are referred to as point processing.
There are basically kinds of functions in gray level transformation –
 Image negative
 Log transformations
 Power law transformations
 Piecewise-Linear transformation functions

3.2.1 Basic Gray Level Transformation:


These are the simplest image enhancement techniques.
(i) Image Negative:
62
The negative of in image with gray level in the range [0, l, -1] is obtained by using the
negative transformation. The expression of the transformation is
s= L-1-r

Reverting the intensity levels of an image in this manner produces the equivalent of a
photographic negative. This type of processing is practically suited for enhancing white or
gray details embedded in dark regions of an image especially when the black areas are
dominant in size.
1. Log transformations:
The general form of the log transformation is s= c log(1+r)
Where c- constant and r ≥ o
This transformation maps a narrow range of gray level values in the input image into a wider
range of output gray levels. The opposite is true for higher values of input levels. We would
use this transformations to expand the values of dark pixels in an image while compressing
the higher level values. The opposite is true for inverse log transformation. The log
transformation function has an important characteristic that it compresses the dynamic range
of images with large variations in pixel values.
Eg- Fourier spectrum

2. Power Law Transformation:


Power law transformations has the basic form

Where c and y are positive constants.

63
Power law curves with fractional values of y map a narrow range of dark input values into a
wider range of output values, with the opposite being true for higher values of input gray
levels. We may get various curves by varying values of y.

A variety of devices used for image capture, printing and display respond according to a
power law. The process used to correct this power law response phenomenon is called gamma
correction. For eg-CRT devices have intensity to voltage response that is a power function.
Gamma correction is important if displaying an image accurately on a computer screen is of
concern. Images that are not corrected properly can look either bleached out or too dark.
Color phenomenon also uses this concept of gamma correction. It is becoming more popular
due to use of images over the internet. It is important in general purpose contract
manipulation. To make an image black we use y>1 and y<1 for white image.

3.2.2 Piece wise linear transformation functions:


The principal advantage of piecewise linear functions is that these functions can be arbitrarily
Complex. But their specification requires considerably more user input.
(i) Contrast Stretching:
It is the simplest piecewise linear transformation function. We may have various low contrast
images and that might result due to various reasons such as lack of illumination, problem in
imaging sensor or wrong setting of lens aperture during image acquisition. The idea behind

64
contrast stretching is to increase the dynamic range of gray levels in the image Being
processed.

The location of points (r1,s1) and (r2,s2) control the shape of the curve
a) If r1=r2 and s1=s2, the transformation is a linear function that deduces no change in gray
levels.
b) If r1=s1, s1=0 , and s2=L-1, then the transformation become a thresholding function that
creates a binary image
c) Intermediate values of (r1, s1) and (r2, s2) produce various degrees of spread in the gray
value of the output image thus effecting its contract.
Generally r1≤ r2 and s1≤ s2 so that the function is single valued and monotonically
increasing.

65
(ii) Gray Level Slicing:

Highlighting a specific range of gray levels in an image is often desirable. For example when
enhancing features such as masses of water in satellite image and enhancing flaws in x- ray
images.
There are two ways of doing this-
(1) One method is to display a high value for all gray level in the range. Of interest and a low
value for all other gray level.
(2) Second method is to brighten the desired ranges of gray levels but preserve the background
and gray level tonalities in the image.
(iii) Bit Plane Slicing:
Sometimes it is important to highlight the contribution made to the total image appearance by
specific bits. Suppose that each pixel is represented by 8 bits. Imagine that an image is
composed of eight 1-bit planes ranging from bit plane 0 for the least significant bit to bit
plane 7 for the most significant bit. In terms of 8-bit bytes, plane 0 contains all the lowest
order bits in the image and plane 7 contains all the high order bits.

66
High order bits contain the majority of visually significant data and contribute to more subtle
details in the image. Separating a digital image into its bits planes is useful for analyzing the
relative importance played by each bit of the image. It helps in determining the adequacy of
the number of bits used to quantize each pixel. It is also useful for image compression.
3.3 Histogram Processing:
The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function
of the form
H(rk)=nk
where rk is the kth gray level and nk is the number of pixels in the image having the level rk..
A normalized histogram is given by the equation
p(rk)=nk/n for k=0,1,2,…..,L-1

P(rk) gives the estimate of the probability of occurrence of gray level rk.
The sum of all components of a normalized histogram is equal to 1. The histogram plots are
simple plots of H(rk)=nk versus rk.

67
68
In the dark image the components of the histogram are concentrated on the low (dark) side of
the gray scale. In case of bright image the histogram components are baised towards the high
side of the gray scale. The histogram of a low contrast image will be narrow and will be
centered towards the middle of the gray scale.
The components of the histogram in the high contrast image cover a broad range of the gray
scale. The net effect of this will be an image that shows a great deal of gray levels details and
has high dynamic range.
3.3.1 Histogram Equalization:
Histogram equalization is a common technique for enhancing the appearance of images.
Suppose we have an image which is predominantly dark. Then its histogram would be
skewed towards the lower end of the grey scale and all the image detail are compressed into
the dark end of the histogram. If we could „stretch out‟ the grey levels at the dark end to
produce a more uniformly distributed histogram then the image would become much clearer.
Let there be a continuous function with r being gray levels of the image to be enhanced. The
range of r is [0, 1] with r=0 repressing black and r=1 representing white. The transformation
function is of the form
S=T(r) where 0<r<1
It produces a level s for every pixel value r in the original image. The
transformation function is assumed to fulfill two condition T(r) is single valued and
monotonically increasing in the internal 0<T(r)<1 for 0<r<[Link] transformation function
should be single valued so that the inverse transformations should exist. Monotonically
increasing condition preserves the increasing order from black to white in the output image.
The second conditions guarantee that the output gray levels will be in the same range as the
input levels. The gray levels of the image may be viewed as random variables in the interval
[0.1]. The most fundamental descriptor of a random variable is its probability density
function (PDF) Pr(r) and Ps(s) denote the probability density functions of random variables r
and s respectively. Basic results from an elementary probability theory states that if Pr(r) and
Tr are known and T-1(s) satisfies conditions (a), then the probability density function Ps(s) of
the transformed variable is given by the formula
Thus the PDF of the transformed variable s is the determined by the gray levels PDF of the
input image and by the chosen transformations function.
A transformation function of a particular importance in image processing

This is the cumulative distribution function of r.


Using this definition of T we see that the derivative of s with respect to r is

69
70
Substituting it back in the expression for Ps we may get

An important point here is that Tr depends on Pr(r) but the resulting Ps(s) always is uniform,
and independent of the form of P(r). For discrete values we deal with probability and
summations instead of probability density functions and integrals. The probability of
occurrence of gray levels rk in an image as approximated

N is the total number of the pixels in an image.


nk is the number of the pixels that have gray level rk.

3.3.2 Histogram Matching (Specification):


In some cases it may be desirable to specify the shape of the histogram that we wish the
processed image to have. Histogram equalization does not allow interactive image
enhancement and generates only one result: an approximation to a uniform histogram.
Sometimes we need to be able to specify particular histogram shapes capable of highlighting
certain gray-level ranges. The method use to generate a processed image that has a specified
histogram is called histogram matching or histogram specification.

L is the total number of possible gray levels in the image. The discrete transformation
function is given by

Thus a processed image is obtained by mapping each pixel with levels rk in the input
image into a corresponding pixel with level sk in the output image. A plot of Pr (rk) versus rk
is called a histogram. The transformation function given by the above equation is the called
histogram equalization or linearization. Given an image the process of histogram equalization
consists simple of implementing the transformation function which is based information that
can be extracted directly from the given image, without the need for further parameter
specification.
71
72
Equalization automatically determines a transformation function that seeks to produce an
output image that has a uniform histogram. It is a good approach when automatic
enhancement is needed.
Algorithm:
1. Compute sk=Pf (k), k = 0, …, L-1, the cumulative normalized histogram of f .
2. Compute G(k), k = 0, …, L-1, the transformation function, from the given histogram hz 3.
Compute G-1(sk) for each k = 0, …, L-1 using an iterative method (iterate on z), or in
effect, directly compute G-1(Pf (k))
4. Transform f using G-1(Pf (k)) .
3.4 Basic filtering through the enhancement:
Spatial filtering is an example of neighborhood operations, in this the operations are done on
the values of the image pixels in the neighborhood and the corresponding value of a sub
image that has the same dimensions as of the neighborhood This sub image is called a filter,
mask, kernel, template or window; the values in the filter sub image are referred to as
coefficients rather than pixel. Spatial filtering operations are performed directly on the pixel
values (amplitude/gray scale) of the image The process consists of moving the filter mask
from point to point in the image. At each point (x,y) the response is calculated using a
predefined relationship.

73
74
For linear spatial filtering the response is given by a sum of products of the filter coefficient
and the corresponding image pixels in the area spanned by the filter mask. The results R of
liner filtering with the filter mask at point (x,y) in the image is

The sum of products of the mask coefficient with the corresponding pixel directly under the
mask. The coefficient w (0,0) coincides with image value f(x,y) indicating that mask it
centered at (x,y) when the computation of sum of products takes place. For a mask of size

MxN we assume m=2a+1 and n=2b+1, where a and b are nonnegative integers. It shows that
all the masks are of add size. In the general liner filtering of an image of size f of size M*N
with a filter mask of size m*m is given by the expression
Where a= (m-1)/2 and b = (n-1)/2
To generate a complete filtered image this equation must be applied for x=0,
1, 2,M-1
and y=0,1,2 ,N-1. Thus the mask processes all the pixels in the image. The process of linear
filtering is similar to frequency domain concept called convolution. For this reason, linear
spatial filtering often is referred to as convolving a mask with an [Link] mask are
sometimes called convolution mask.
R= W,Z,+W2, Z2 +….+ Wmn Zmn
Where w‟s are mask coefficients and z‟s are the values of the image gray levels
corresponding to those coefficients, mn is the total number of coefficients in the mask.
An important point in implementing neighborhood operations for spatial filtering is the
issue of what happens when the center of the filter approaches the border of the image.
There are several ways to handle this situation.
i) To limit the excursion of the center of the mask to be at distance of less than (n-1) /2 pixels
form the border. The resulting filtered image will be smaller than the original but all the
pixels will be processed with the full mask.
ii) Filter all pixels only with the section of the mask that is fully contained in the image. It will
create bands of pixels near the border that will be processed with a partial mask.
iii)Padding the image by adding rows and columns of o‟s & or padding by replicating rows
and columns. The padding is removed at the end of the process
75
For example, the filtered value of the pixel located at E5 is (9*1/9) + (5*1/9) + (5*1/9) + (9*1/9) + (5*1/9)
+ (5*1/9) + (5*1/9) + (5*1/9) +(5*1/9) = 5.89, rounded up to 6

o
Spatial Feature Manipulation
• Spatial filters pass (emphasize) or suppress (de-emphasize) image data of various spatial
frequencies
• Spatial frequency refers to the number of changes in brightness value, per unit distance, for
any area within a scene
• Spatial frequency corresponds to image elements (both important details and noise) of
certain size
• High spatial frequency à rough areas
High frequency corresponds to image elements of smallest size
– An area with high spatial frequency will have rapid change in digital values
with distance (i.e. dense urban areas and street networks)
– Low spatial frequency à smooth areas
Low frequency corresponds to image elements of (relatively) large size.
– An object with a low spatial frequency only changes slightly over many
pixels and will have gradual transitions in digital values (i.e. a lake or a
smooth water surface).
76
IMAGE ENHANCEMENT IN FREQUENCY DOMAIN:
Frequency Domain Methods in Digital Image Processing (DIP) refer to techniques where
images are analyzed and processed based on their frequency components rather than spatial
pixel values. These methods are particularly powerful for filtering, enhancement, restoration,
and compression.
3.2 Basics of filtering in frequency domain:
Basic steps of filtering in frequency Domain
i) Multiply the input image by (-1) X+Y to centre the transform
ii) Compute F(u,v), Fourier Transform of the image
iii) Multiply f(u,v) by a filter function H(u,v)
iv) Compute the inverse DFT of Result of (iii)
v) Obtain the real part of result of (iv)
vi) Multiply the result in (v) by (-1) x=y

H(u,v) called a filter because it suppresses certain frequencies from the image while
leaving others unchange

Filter Type Purpose

Low-pass Filter (LPF) Smooths image, removes high-frequency noise

High-pass Filter (HPF) Enhances edges and details

Band-pass Filter Preserves mid-frequency components

Notch Filter Removes specific frequency components (e.g., periodic noise)

77
Image smoothing filtering:
Edges and other sharp transition of the gray levels of an image contribute significantly to the
high frequency contents of its Fourier transformation. Hence smoothing is achieved in the
frequency domain by attenuation a specified range of high frequency components in the
transform of a given image. Basic model of filtering in the frequency domain is
G(u,v) = H(u,v)F(u,v)
F(u,v) - Fourier transform of the image to be smoothed objective is to find out a filter
function H (u,v) that yields G (u,v) by attenuating the high frequency component of F (u,v)
There are three types of low pass filters
1. Ideal
2. Butterworth
3. Gaussian
(i) Ideal Low pass filter:
It is the simplest of all the three filters. It cuts of all high frequency component of the Fourier
transform that are at a distance greater that a specified distance D0 form the origin of the
transform. it is called a two – dimensional ideal low pass filter (ILPF) and has the transfer
function

Where D0 is a specified nonnegative quantity and D(u,v) is the distance from point (u,v) to
the center of frequency rectangle. If the size of image is M*N , filter will also be of the same
size so center of the frequency rectangle (u,v) = (M/2, N/2) because of center transform
Because it is ideal case. So all frequency inside the circle are passed without any attenuation

where as all frequency outside the circle are completely attenuated. For an ideal low pass
filter cross section, the point of transition between H (u,v) =1 and H(u,v)=0 is called of the “
cut of frequency”.

78
(ii) Butterworth Low pass filter:
It has a parameter called the filter order. For high values of filter order it approaches the form
of the ideal filter whereas for low filter order values it reach Gaussian filter. It may be viewed
as a transition between two extremes. The transfer function of a Butterworth low pass filter
(BLPF) of order n with cut off frequency at distance Do from the origin is defined as

Most appropriate value of n is [Link] does not have sharp discontinuity unlike ILPF that
establishes a clear cutoff between passed and filtered frequencies. Defining a cutoff
frequency is a main concern in these filters. This filter gives a smooth transition in blurring as
a function of increasing cutoff frequency. A Butterworth filter of order 1 has no ringing.
Ringing increases as a function of filter order. (Higher order leads to negative values).
(i) Gaussian Low pass filter:
The transfer function of a Gaussian low pass filter is

79
Where D(u,v)- the distance of point (u,v) from the center of the transform σ = D0- specified
cut off frequency
The filter has an important characteristic that the inverse of it is also Gaussain.

80
a function of increasing cutoff frequency. A Butterworth filter of order 1 has no ringing.
Ringing increases as a function of filter order. (Higher order leads to negative values).
(ii) Gaussian Low pass filter:
The transfer function of a Gaussian low pass filter is

Where D(u,v)- the distance of point (u,v) from the center of the transform σ = D0- specified
cut off frequency
The filter has an important characteristic that the inverse of it is also Gaussain.

3.2 Image Sharpening filtering:

81
Image sharpening can be achieved by a high pass filtering process, which attenuates the low
frequency components without disturbing high-frequency information. These are radially
symmetric and completely specified by a cross section. If we have the transfer function of a
low pass filter the corresponding high pass filter can be obtained using the equation
Hhp (u,v)=1- Hlp (u,v)

(i) Ideal High pass filter:


This filter is opposite of the Ideal Low Pass filter and has the transfer function of the form

(ii) Butterworth High pass filter:


The transfer function of Butterworth High Pass filter of order n is given by the equation

(iii) Guassian High pass filter:


The transfer function of a Gaussain High Pass Filter is given by the equation

Homomorphic filtering:
Homomorphic filters are widely used in image processing for compensating the
effect of no uniform illumination in an image. Pixel intensities in an image represent the light
reflected from the corresponding points in the objects. As per as image model, image
f(z,y) may be characterized by two components: (1) the amount of source light incident on
the scene being viewed, and (2) the amount of light reflected by the objects in the scene.
These portions of light are called the illumination and reflectance components, and are
denoted i ( x , y) and r ( x , y) respectively. The functions i ( x , y) and r ( x , y) combine
multiplicatively to give the image function f ( x , y):

82
f ( x , y) = i ( x , y).r(x, y)-----------(1)

where 0 < i ( x , y ) < a and 0 < r( x , y ) < 1. Homomorphic filters are used in such situations
where the image is subjected to the multiplicative interference or noise as depicted in
equation 1. We cannot easily use the above product to operate separately on the frequency
components of illumination and reflection because the Fourier transform of f ( x , y) is not
separable; that is

F[f(x,y)) not equal to F[i(x, y)].F[r(x, y)].


We can separate the two components by taking the logarithm of the two sides
ln f(x,y) = ln i(x, y) + ln r(x, y).
Taking Fourier transforms on both sides we get,
F[ln f(x,y)} = F[ln i(x, y)} + F[ln r(x, y)].
that is, F(x,y) = I(x,y) + R(x,y),
where F, I and R are the Fourier transforms ln f(x,y),ln i(x, y) ,

and ln r(x, y). respectively. The function F represents the Fourier transform of the sum of two
images: a low-frequency illumination image and a high-frequency reflectance image. If we now
apply a filter with a transfer function that suppresses low- frequency components and enhances
high-frequency components, then we can suppress the illumination component and enhance the
reflectance component. Taking the inverse transform of F ( x , y) and then anti- logarithm, we
get

f’ ( x , y) = i’ ( x , y) + r’(x, y)

Color Image enhancement:


Color of an object is determined by the nature of the light reflected from it. When a beam

83
of sunlight passes through a glass prism, the emerging beam of light is not white but consists
instead of a continuous spectrum of colors ranging from violet at one end to red at the other.
As shown in figure, the color spectrum may be divided into six broad regions: violet, blue,
green,yellow, orange, and red. When viewed in full color no color in the spectrum ends
abruptly, but rather each color blends smoothly into the next.

As illustrated in Figure, visible light is composed of a relatively narrow band of frequencies in


the electromagnetic spectrum. A body that reflects light that is balanced in all visible
wavelengths appears white to the observer. However, a body that favors reflectance in a limited
range of the visible spectrum exhibits some shades of color. For example, green objects reflect
light with wavelengths primarily in the 500 to 570 nm range while absorbing most of the
energy at other wavelengths. Characterization of light is central to the science of color. If the
light is achromatic (void of color), its only attribute is its intensity, or amount. Achromatic light
is what viewers see on a black and white television set. Three basic quantities are used to
describe the quality of a chromatic light source: radiance, luminance, and brightness.

84
QUESTION BANK:
1. What is the primary goal of image enhancement?
A) Data compression
B) Improve image quality for human viewing
C) Object recognition
D) Reduce resolution
Ans: B
2. Which domain is commonly used in image enhancement?
A) Time domain
B) Frequency domain
C) Spatial domain
D) Both B and C
Ans: D
3. Which operation is used in spatial domain enhancement?
A) Fourier Transform
B) Histogram Equalization
C) Convolution
D) Laplace Transform
Ans: C
4. Which of the following is a spatial domain technique?
A) Filtering
B) DFT
C) DCT
D) Wavelet Transform
Ans: A
5. In histogram equalization, what is modified?
A) Frequency components
B) Intensity levels
C) Pixel positions
D) RGB color
Ans: B
6. Which enhancement technique works by adjusting pixel values directly?
A) Spatial filtering
B) Histogram processing
C) Image segmentation
D) Morphological processing
Ans: A

85
7. Contrast stretching is used to:
A) Compress image
B) Improve brightness

C) Increase dynamic range


D) Enhance edge features
Ans: C
8. Which of the following is a point processing technique?
A) Log transformation
B) Sobel operator
C) Median filter
D) Gaussian filter
Ans: A
9. A negative image is produced by:
A) Logarithmic transform
B) s = L-1 – r
C) Power-law transform
D) Gamma correction
Ans: B
10. Power-law transformation is also known as:
A) Gamma correction
B) Log transform
C) Inverse filter
D) Histogram equalization
Ans: A
11. Histogram equalization is used to:
A) Reduce image resolution
B) Improve contrast
C) Compress image
D) Remove noise
Ans: B
12. Which method adjusts the intensity distribution of an image to match another?
A) Histogram equalization
B) Histogram matching
C) Power-law transform
D) Contrast stretching
Ans: B

86
13. Which of the following is not a point processing operation?
A) Image subtraction
B) Thresholding
C) Log transformation
D) Smoothing
Ans: D

14. What does a histogram of a digital image represent?


A) Pixel location
B) Pixel intensities over time
C) Frequency of intensity values
D) Edge strength
Ans: C
15. Contrast stretching maps:
A) One intensity level to one level
B) Low contrast range to full dynamic range
C) High-frequency components
D) Image to binary form
Ans: B
16. Log transformation enhances:
A) High intensity values
B) Middle range
C) Low intensity values
D) Uniform histogram
Ans: C
17. Gamma correction is mainly used in:
A) Image segmentation
B) Display devices
C) Edge detection
D) Color matching
Ans: B
18. If gamma < 1 in power-law transformation, the image becomes:
A) Darker
B) Brighter
C) Binary
D) Inverted
Ans: B

87
19. Which of the following is an advantage of histogram equalization?
A) Reduces size
B) Improves contrast
C) Removes blur
D) Filters color
Ans: B
20. Which function helps compress dynamic range?
A) Linear transform
B) Logarithmic
C) Exponential
D) Piecewise linear
Ans: B
21. Smoothing filters are used to:
A) Sharpen edges
B) Reduce noise
C) Highlight details
D) Detect corners
Ans: B
22. Which of these is a smoothing linear filter?
A) Sobel
B) Median
C) Box filter
D) Laplacian
Ans: C
23. Which of the following is a non-linear filter?
A) Gaussian
B) Box
C) Median
D) Laplacian
Ans: C
24. Median filtering is effective for:
A) Gaussian noise
B) Salt and pepper noise
C) Speckle noise
D) Quantization noise
Ans: B
25. The Laplacian filter is a:
A) Low-pass filter
B) Band-pass filter
C) High-pass filter

88
D) Non-linear filter
Ans: C
26. Unsharp masking is used for:
A) Noise removal
B) Contrast adjustment
C) Image sharpening
D) Edge detection
Ans: C
27. Which filter emphasizes edges?
A) Smoothing
B) Averaging
C) High-pass
D) Box filter
Ans: C
28. The Gaussian filter is a:
A) Sharpening filter
B) Low-pass filter
C) High-pass filter
D) Notch filter
Ans: B
29. Edge enhancement is best achieved using:
A) Mean filter
B) Gaussian filter
C) Laplacian filter
D) Histogram equalization
Ans: C
30. Which operator is used for edge detection?
A) Laplacian
B) Gaussian
C) Roberts
D) Both A and C
Ans: D
31. Averaging filters are sensitive to:
A) Noise
B) Illumination
C) Compression
D) Scaling
Ans: A
32. Which of the following has directional edge detection?
A) Sobel
89
B) Laplacian
C) Gaussian
D) Median
Ans: A
33. Kernel of Laplacian filter sums to:
A) Zero
B) One
C) Positive value
D) Negative value
Ans: A
34. A 3x3 mean filter replaces each pixel with:
A) Max of neighbors
B) Median of neighbors
C) Average of 3x3 neighbors
D) Difference from center pixel
Ans: C
35. The Sobel operator is used for:
A) Histogram processing
B) Color balancing
C) Edge detection
D) Image segmentation
Ans: C
36. In frequency domain, enhancement is done by modifying:
A) Histogram
B) Fourier coefficients
C) Pixel values
D) Color maps
Ans: B
37. A high-pass filter in frequency domain enhances:
A) Noise
B) Edges and fine details
C) Brightness
D) Contrast
Ans: B
38. Which transform is used in frequency domain filtering?
A) Fourier Transform
B) Logarithmic
C) Histogram
D) Edge
Ans: A

90
39. Low-pass filters are used to:
A) Blur images
B) Enhance edges
C) Add noise
D) Segment images
Ans: A
40. Ideal high-pass filters cause:
A) Smooth output
B) Ringing artifacts
C) Edge blurring
D) Uniform brightness
Ans: B
41. Which frequency components are removed by low-pass filter?
A) Low
B) High
C) Medium
D) DC
Ans: B
42. Gaussian filter in frequency domain has:
A) Circular symmetry
B) Sharp cutoff
C) Notch shape
D) Random response
Ans: A
43. Butterworth filters have:
A) Sudden drop
B) Gradual roll-off
C) Rectangular shape
D) Gaussian curve
Ans: B
44. Notch filters are used to remove:
A) All frequencies
B) Low frequencies
C) Specific periodic noise
D) High-pass noise
Ans: C
45. Homomorphic filtering is used to:
A) Remove noise
B) Sharpen edges
C) Enhance contrast and remove illumination

91
D) Match histogram
Ans: C
46. Which filter combines sharpening and smoothing?
A) Gaussian
B) High-boost
C) Laplacian
D) Box
Ans: B
47. Which enhancement is preferred for human perception?
A) Frequency domain only
B) Spatial domain
C) Edge enhancement
D) Perceptual-based enhancement
Ans: D
48. Which domain is preferred for real-time enhancement?
A) Spatial domain
B) Frequency domain
C) Morphological
D) Color domain
Ans: A
49. Which operation best enhances features of an image?
A) Smoothing
B) Sharpening
C) Rotation
D) Scaling
Ans: B
50. Which image enhancement technique is useful for medical images?
A) Thresholding
B) Histogram equalization
C) Contrast stretching
D) All of the above
Ans: D
5MARK

1. Explain the concept of image enhancement. What are its goals and applications?
2. Discuss smoothing filters and sharpening filters. Give two examples for each.
3. Describe the process of image enhancement in the Spatial domain methods.
4. What are point processing operations?
5. Explain the steps involved in applying a spatial filtering?

92
10 MARK
1. Explain the spatial domain Image Enhancement?
2. Briefly explain smoothing filters and sharpening filters?
3. Explain various intensity transformations in point processing.

------------------------------------------------------------unit 3 completed-----------------------------------------------------

93
UNIT-4 IMAGE SEGMENTATION
Image segmentation: Classification of Image segmentation techniques – Region approach – Clustering
techniques Segmentation based on thresholding - Edge based segmentation Classification of edges - Edge
detection - Hough transform - Active contour.
IMAGE SEGMENTATION
Image segmentation techniques can be broadly classified into region-based and edge-
based approaches. Region-based methods group pixels based on similarities, while edge-based
methods identify boundaries using discontinuities in pixel values. Image segmentation may use
statistical classification, thresholding, edge detection, region detection, or any combination of
these techniques. The output of the segmentation step is usually a set of classified elements,
Most segmentation techniques are either region-based or edge based
(i) Region-based techniques rely on common patterns in intensity values within a cluster of
neighboring pixels. The cluster is referred to as the region, and the goal of the
segmentation algorithm is to group regions according to their anatomical or functional
roles.
(ii) Edge-based techniques rely on discontinuities in image values between distinct regions,
and the goal of the segmentation algorithm is to accurately demarcate the boundary
separating these regions. Segmentation is a process of extracting and representing
information from an image is to group pixels together into regions of similarity.
Classification of Image Segmentation Techniques:
1. Thresholding-based Segmentation
2. Region-based Segmentation
3. Edge-based Segmentation
4. Clustering-based Segmentation
5. Model-based Segmentation (e.g., Active Contours, Hough Transform)

1. Thresholding-based Segmentation
Thresholding is a simple and widely used image segmentation technique that converts
a grayscale image into a binary image based on a threshold value.
Global – T depends only on gray level values

Local – T depends on both gray level values and local property


Dynamic or Adaptive – T depends on spatial coordinates

 A threshold value T is selected:


94
o Pixels > T → Object
Pixels ≤ T → Background

Gray level thresholding


Types of Thresholding:
1. Global Thresholding:
o A single threshold value is applied to the whole image.
o Works well when the image has uniform lighting and background.
2. Local (Adaptive) Thresholding:
o The threshold is computed for small regions of the image.
o Suitable for images with non-uniform illumination.
3. Otsu’s Method:
o An automatic threshold selection technique.
o Chooses the threshold that minimizes intra-class variance or maximizes
inter-class variance.
Advantages:
 Very simple and fast
 Effective for high-contrast images
 Easy to implement in hardware/software
Applications:
 Document image analysis (e.g., separating text from background)
 Medical image processing (e.g., detecting cells or tumors)
 Industrial inspection (e.g., identifying defects)
2. Region-based Segmentation
• Edges and thresholds sometimes do not give good results for segmentation.

95
• Region-based segmentation is based on the connectivity of similar pixels in
a region.

– Each region must be uniform.

– Connectivity of the pixels within the region is very important.

96
Techniques in Region based segmentation:

(a) Region based growing segmentation:


Homogeneity of regions is used as the main segmentation criterion in region growing.
The criteria for homogeneity:
•graylevel
•color
•texture
•shape
• model
The basic purpose of region growing is to segment an entire image R into smaller sub-
images, Ri, i=1,2,….,N. which satisfy the following conditions:

(b) Region Splitting:


The basic idea of region splitting is to break the image into a set of disjoint regions, which are
coherent within themselves:
• Initially take the image as a whole to be the area of interest.
• Look at the area of interest and decide if all pixels contained in the region satisfy some
similarity constraint.
• If TRUE then the area of interest corresponds to an entire region in the image.
• If FALSE split the area of interest (usually into four equal subareas) and consider each
of the sub-areas as the area of interest in turn.
• This process continues until no further splitting occurs. In the worst case this
happens when the areas are just one pixel in size.
If only a splitting schedule is used then the final segmentation would probably contain many
neighboring regions that have identical or similar properties. We need to merge these
regions. (c)Region merging:
The result of region merging usually depends on the order in which regions are merged. The
simplest methods begin merging by starting the segmentation using regions of 2x2, 4x4 or
8x8 pixels. Region descriptions are then based on their statistical gray level properties. A

97
region description is compared with the description of an adjacent region; if they match,

98
They are merged into a larger region and a new region description is computed. Otherwise
regions are marked as non-matching. Merging of adjacent regions continues between all neighbors,
including newly formed ones. If a region cannot be merged with any of its neighbors, it is marked
`final' and the merging process stops when all image regions are so marked.

The segmentation process can be understood as the construction of a segmentation quad tree
where each leaf node represents a homogeneous region. Splitting and merging corresponds to
removing or building parts of the segmentation quad tree.

Region splitting procedure

Region growing
Region growing approach is the opposite of the split and merges approach:
• An initial set of small areas is iteratively merged according to similarity constraints.
• Start by choosing an arbitrary seed pixel and compare it with neighboring pixels
• Region is grown from the seed pixel by adding in neighboring pixels that are similar,
increasing the size of the region.
• When the growth of one region stops we simply choose another seed pixel which does not
yet belong to any region and start again.
99
• This whole process is continued until all pixels belong to some region.
• A bottom up method.
Region growing methods often give very good segmentations that correspond well to the observed
edges.

Advantages:
 Preserves spatial relationships between pixels
 Works well for images with gradual intensity variations
 More robust than edge detection in noisy images

Applications:
 Medical imaging (e.g., organ detection)
 Remote sensing
 Object recognition
 Industrial inspection

[Link]-based Segmentation:
Edge-based segmentation is a technique used to identify object boundaries by detecting
discontinuities (edges) in the image. These discontinuities represent sudden changes in pixel intensity,
often indicating boundaries between different regions.
Steps in Edge-Based Segmentation
Edge-based segmentation identifies the boundaries between regions in an image by detecting edges
—points where there is a sharp change in intensity. Here's a clear breakdown of the key steps
involved:
1. Preprocessing – Image Smoothing
 Purpose: Remove noise which can create false or broken edges.
 Method: Apply a Gaussian filter or other smoothing techniques.
2. Edge Detection – Gradient Calculation
 Purpose: Identify pixels with significant intensity changes.
 Method: Use edge detectors like Sobel, Prewitt, Roberts, or Canny to compute:
100
o Gradient Magnitude – How strong the edge is.
o Gradient Direction – Which way the intensity is changing.

3. Edge Thresholding
 Purpose: Retain only significant edges.
 Method: Apply a threshold to the gradient magnitude.
o Pixels with magnitude > threshold are considered edges.
4. Edge Refinement (Optional but Common in Advanced Methods)
 Non-Maximum Suppression (in Canny):
Thins edges by keeping only local maxima along the gradient direction.
 Double Thresholding & Hysteresis (in Canny):
o Strong edges: Clearly part of object boundary.
o Weak edges: Kept only if connected to strong edges.
o Isolated weak edges: Removed.
5. Edge Linking and Segmentation
 Purpose: Form continuous boundaries from detected edge pixels.
 Method: Use techniques like contour tracing or edge linking algorithms to form closed
region boundaries.
 These boundaries are then used to segment the image into different objects or regions.
Advantages:
 Accurate boundary detection
 Useful in high-contrast and well-defined objects
 Efficient in terms of processing
Applications:
 Object recognition
 Road/lane detection
 Medical imaging (e.g., blood vessel boundaries)
 Industrial inspection (e.g., crack detection)
[Link]-based Segmentation
Clustering-based segmentation divides an image into regions (segments) by grouping similar pixels
based on feature similarity, such as intensity, color, or texture — without prior label information.
It's an unsupervised learning technique.
101
Common Clustering Techniques:
1.K-Means Clustering
 Most widely used clustering method in image segmentation.
 Divides pixels into K clusters based on feature vectors like [R, G, B] or grayscale intensity.
Algorithm Steps:
1. Choose K initial cluster centroids randomly.
2. Assign each pixel to the nearest centroid.
3. Recalculate centroids as the mean of assigned pixels.
4. Repeat steps 2–3 until convergence (centroids no longer change).
2. Mean Shift Clustering
 A non-parametric clustering technique.
 Does not require specifying K.
 Groups pixels by shifting each point to the average of neighboring points iteratively.
3. Fuzzy C-Means Clustering
 Assigns each pixel a probability of belonging to each cluster instead of a hard label.
 Useful for images with soft boundaries or overlapping regions.
Advantages:
 Works well for color images and multi-feature segmentation
 Simple and unsupervised
 Can detect complex patterns
Applications:
 Medical image segmentation (e.g., tumor detection)
 Satellite imagery (land cover classification)
 Object/background separation
 Content-aware image editing

[Link]-based Segmentation (e.g., Active Contours, Hough Transform)


Model-based segmentation uses predefined mathematical models to detect and segment
objects in an image based on their shape or structure. These models evolve or fit themselves to the
object boundaries using geometric, statistical, or physical assumptions.
1. Active Contours (Snakes):

102
Active contours are curves that evolve iteratively to fit object boundaries in an image by minimizing

an energy function.

Esnake=Einternal+Eexternal+Eimage
 Internal Energy – Maintains smoothness of the curve

Internal Energy – Maintains smoothness of the curve


Image Energy – Attracts the contour to image features like edges
External Energy – Adds constraints from user or higher-level model
Advantages:
 Good for closed object boundaries
 Can be guided interactively
 Works with smooth and noisy images
2. Hough Transform
A voting-based technique used to detect simple parametric shapes like lines, circles, or
ellipses by transforming image points into a parameter space.
ρ=xcosθ+ysinθ
 ρ – Distance from origin
 θ– Angle of the line normal
Each edge pixel votes for all possible lines that could pass through it in a Hough
accumulator space. Peaks in this space correspond to detected lines.
Advantages:
 Robust to noise and gaps in edges
 Can detect lines, circles, and ellipses
 Works well with geometric shapes
Applications:
 Medical imaging (organ/tumor boundaries)
 Lane detection in self-driving cars (Hough)
 Industrial inspection (e.g., crack or hole detection)
 Object shape modeling

103
QUESTION BANKS:

1. Image segmentation aims to:


A) Compress the image
B) Identify regions of interest
C) Remove noise
D) Rotate the image
➤ Answer: B
2. Thresholding is a:
A) Frequency domain technique
B) Region-based segmentation method
C) Clustering technique
D) Compression method
➤ Answer: B
3. In Otsu’s method, the threshold is chosen to:
A) Maximize entropy
B) Minimize variance
C) Minimize intra-class variance
D) Maximize contrast
➤ Answer: C
4. Region growing requires:
A) Training data
B) Edge maps
C) Seed points

104
D) Frequency transform
➤ Answer: C
5. A segmented image is primarily used for:
A) Image compression
B) Edge sharpening
C) Feature extraction
D) De-blurring
➤ Answer: C
6. In edge-based segmentation, edges are found by:
A) Histogram equalization
B) Shape detection
C) Sharp intensity change
D) Smoothing
➤ Answer: C
7. Canny edge detector includes:
A) Thresholding only
B) Gradient and Laplacian
C) Gaussian smoothing, gradient, NMS, hysteresis
D) Morphological operations
➤ Answer: C
8. Watershed segmentation is based on:
A) Frequency domain
B) Color models
C) Topographic interpretation
D) Entropy
➤ Answer: C
9. Region splitting and merging is based on:
A) Texture similarity
B) Edge maps
C) Homogeneity criteria
D) Histograms
➤ Answer: C
10. K-means clustering is:
A) Supervised
B) Unsupervised
C) Rule-based
D) Region growing
➤ Answer: B

11. The Laplacian of Gaussian detects:


A) Corners
B) Edges
C) Regions
D) Colors
➤ Answer: B
12. Fuzzy C-means clustering is:
A) Supervised

105
B) Binary segmentation
C) Hard clustering
D) Soft clustering
➤ Answer: D
13. Active contours are also called:
A) Regions
B) Snakes
C) Ridges
D) Valleys
➤ Answer: B
14. The Hough transform is best for detecting:
A) Curves and gradients
B) Shapes with known parameters
C) Irregular boundaries
D) Textures
➤ Answer: B
15. Histogram-based segmentation uses:
A) Entropy
B) Gradient
C) Intensity distribution
D) Edges
➤ Answer: C
16. Edge detection works best on images with:
A) Uniform regions
B) Smooth gradients
C) Sharp boundaries
D) Flat intensities
➤ Answer: C
17. The Sobel operator is a type of:
A) Low-pass filter
B) Clustering method
C) Edge detector
D) Texture filter
➤ Answer: C
18. Seed points are used in:
A) Thresholding
B) K-means
C) Region growing
D) Watershed
➤ Answer: C
19. Which segmentation method uses histogram peaks?
A) Watershed
B) Otsu’s method
C) Active contour
D) Hough transform
➤ Answer: B

106
20. Segmentation evaluation is typically done using:
A) PSNR
B) Histogram difference
C) Ground truth comparison
D) Fourier coefficients
➤ Answer: C

21. Noise sensitivity is a disadvantage of:


A) Region growing
B) Thresholding
C) K-means
D) All of the above
➤ Answer: D
22. Watershed transform can result in:
A) Under-segmentation
B) Over-segmentation
C) No segmentation
D) Flat images
➤ Answer: B
23. Edge linking is used to:
A) Smooth boundaries
B) Combine short edge fragments
C) Blur the image
D) Enhance regions
➤ Answer: B
24. The gradient magnitude is computed as:
A) Gx + Gy
B) Gx – Gy
C) √(Gx² + Gy²)
D) Gx * Gy
➤ Answer: C
25. Clustering-based segmentation groups pixels using:
A) Histogram bins
B) Proximity in feature space
C) Fourier descriptors
D) Shape priors
➤ Answer: B
26. In segmentation, a boundary refers to:
A) Central region
B) Noise edge
C) Discontinuity between regions
D) Smooth areas
➤ Answer: C
27. The Canny detector uses:
A) A single threshold
B) Two thresholds
C) Otsu’s method

107
D) Region averaging
➤ Answer: B
28. Morphological operations are useful for:
A) Region merging
B) Edge sharpening
C) Post-processing segmentation
D) Histogram analysis
➤ Answer: C
29. Hysteresis thresholding in Canny helps:
A) Create histograms
B) Remove noise
C) Link strong and weak edges
D) Enhance contrast
➤ Answer: C
30. Gabor filters are useful in segmentation for:
A) Edge linking
B) Shape analysis
C) Texture-based segmentation
D) Histogram smoothing
➤ Answer: C

31. In region growing, two pixels are merged if:


A) Gradient is high
B) Intensity difference is small
C) Texture varies
D) Boundary is weak
➤ Answer: B
32. Over-segmentation refers to:
A) Missing boundaries
B) Merging too many regions
C) Dividing image into too many regions
D) No segmentation
➤ Answer: C
33. Mean shift clustering is:
A) Parametric
B) Non-parametric
C) Gradient-based
D) Edge-based
➤ Answer: B
34. Which is a top-down segmentation method?
A) Region growing
B) Thresholding
C) Region splitting
D) Clustering
➤ Answer: C
35. Contours represent:
A) Pixels

108
B) Shapes
C) Boundaries
D) Histograms
➤ Answer: C
36. The main challenge in segmentation is:
A) Memory usage
B) Labeling
C) Image noise and variability
D) Compression ratio
➤ Answer: C
37. Texture segmentation is based on:
A) Gradient
B) Edge
C) Pattern similarity
D) Region variance
➤ Answer: C
38. Hough space is used to:
A) Sharpen edges
B) Perform contour detection
C) Detect parametric shapes
D) Classify objects
➤ Answer: C
39. Zero-crossing technique is associated with:
A) Histogram analysis
B) Laplacian edge detection
C) Region labeling
D) Morphological operations
➤ Answer: B
40. Superpixel segmentation clusters:
A) Edge fragments
B) Regions
C) Similar pixels into perceptual groups
D) Histogram bins
➤ Answer: C

41. Watershed lines in an image indicate:


A) Regions of maximum brightness
B) Boundaries between catchment basins
C) Low-gradient areas
D) Histogram peaks
➤ Answer: B
42. Which segmentation is best for textures?
A) Edge-based
B) Region growing
C) Gabor filter-based
D) Thresholding
➤ Answer: C

109
43. The minimum variance thresholding method was proposed by:
A) Sobel
B) Canny
C) Otsu
D) Prewitt
➤ Answer: C
44. Split-and-merge algorithms rely on:
A) Fourier analysis
B) Homogeneity criterion
C) Color similarity
D) Local entropy
➤ Answer: B
45. Supervised segmentation uses:
A) Thresholds
B) Trained classifiers
C) Watershed transform
D) K-means
➤ Answer: B
46. Graph-cut segmentation models an image as a:
A) Matrix
B) Histogram
C) Graph
D) Contour
➤ Answer: C
47. Edge relaxation technique improves:
A) Region similarity
B) Contour detection
C) Boundary smoothness
D) Texture mapping
➤ Answer: C
48. A binary mask is used in segmentation to:
A) Smooth images
B) Highlight selected regions
C) Calculate Fourier transforms
D) Reduce resolution
➤ Answer: B

49. Graph-based segmentation is based on:


A) Thresholds
B) Edge linking
C) Node connectivity and weight
D) Region merging
➤ Answer: C
50. Saliency-based segmentation focuses on:
A) Blurry areas

110
B) Uniform textures
C) Visually prominent regions
D) Histogram flatness
➤ Answer: C

5 Mark Questions (Short Descriptive)

1. Explain the basic steps in edge-based segmentation with a neat diagram.


2. Describe the region growing method. What are its advantages and limitations?
3. Discuss the working of the K-means clustering algorithm in image segmentation.
4. Explain the concept of watershed segmentation with a suitable example.
5. Differentiate between edge-based and region-based segmentation techniques.

Ten-Mark Questions (Long Answer/Essay Type)

1. Compare and contrast various segmentation techniques: thresholding, region-based, edge-


based, clustering, and model-based methods. Include advantages and use-cases.
2. Explain the working of the Canny edge detector in detail. Include all steps such as
smoothing, gradient computation, non-maximum suppression, and hysteresis thresholding.
3. Describe model-based segmentation methods like Active Contours and Hough Transform.
Explain their algorithms, use-cases, and limitations.

----------------------------------------------------unit 4-- completed-------------------------------------------

UNIT-5 IMAGE COMPRESSION


Image Compression: Need for compression – Redundancy – Classification of image - Compression schemes -
Huffman coding - Arithmetic coding.
111
Compression: Compression is a process intended to yield a compact digital representation of a signal. In the
literature, the terms source coding, data compression, bandwidth compression, and signal compression are all
used to refer to the process of compression. In the cases where the signal is defined as an image, a video
stream, or an audio signal, the generic problem of compression is to minimise the bit rate of their digital
representation.

In the following figure, a systems view of Image compression process is depicted.

the term compression ratio, denoted as cr , is also used instead of bit rate to characterise the
capability of the compression system. An intuitive definition of cr is
cr =(Source coder input size) / (Source coder output size)
Need for compression:
 Storage Efficiency
High-resolution images require substantial storage space.
 Faster Transmission
Compressed images can be transmitted over networks more quickly.
 Resource Optimization
Compression minimizes bandwidth usage.
Redundancy
Redundancy refers to unnecessary or repetitive data in an image that can be eliminated without
significant loss of information. Identifying and removing redundancy is the core idea behind image
compression.

112
Types of Redundancy in Image Compression
1. Spatial Redundancy
o Also known as Interpixel Redundancy
o Occurs due to correlation between neighboring pixels.
o Example: In a smooth area, adjacent pixels often have similar values.
o Eliminated using: Differential encoding, predictive coding, transform coding (e.g.,
DCT, wavelets).
2. Spectral Redundancy
o Also known as Interband Redundancy
o Arises in color or multispectral images due to correlation between color bands (e.g.,
RGB).
o Example: R, G, and B channels carry overlapping information.
o Eliminated using: Color space conversion (e.g., RGB to YCbCr), Principal
Component Analysis (PCA), Karhunen–Loève Transform (KLT).
3. Temporal Redundancy
o Found in video sequences (not static images).
o Consecutive frames in a video are often very similar.
o Eliminated using: Motion estimation, inter-frame prediction (e.g., MPEG).
4. Psychovisual Redundancy
o Based on the limitations of human vision.
o Certain image details are imperceptible to the human eye.
o Eliminated using: Lossy compression like JPEG (quantization step).
o Example: Human eye is less sensitive to high-frequency details and chrominance
changes.
5. Coding Redundancy
o Occurs when fixed-length codes are used for symbols that occur with different
frequencies.
o Eliminated using: Variable-length coding like Huffman coding, Arithmetic coding.
o Example: Encoding frequent gray levels with fewer bits.
Classification of image

113
1. Binary Images

 Only two pixel values: 0 (black) and 1 (white).


 Example: Scanned text documents, signatures.
 Storage Size: Small.
 Compression Method: Run-Length Encoding, Huffman Coding.
2. Grayscale Images

 Pixels range from 0 to 255 (8-bit).


 Represents intensity (brightness) without color.
 Example: X-rays, black and white photos.
 Compression Method: JPEG, DPCM (Differential PCM).
3. Color Images

 Consist of multiple color channels (e.g., RGB).


 Each pixel has red, green, and blue components.
 Example: Digital photos, videos.
 Compression Method: JPEG, JPEG 2000, PNG.
4. Multispectral/ Hyperspectral Images

 Captured using sensors that record more than 3 bands (wavelengths).


 Example: Satellite images, remote sensing.
 Compression Method: Transform coding, PCA (Principal Component Analysis).

Compression schemes

Types of Compression Schemes:

 Lossless compression
 Lossy compression

Reversible (loss less), with no loss of information.


• A new image is identical to the
original image (after
decompression).
• Original data exactly recovered from compressed

114
data
• Lower compression ratio
• Reversibility is necessary in most image analysis
applications.
• The compression ratio is typically 2 to 10 times.
• Examples are Huffman coding and run-length

coding.

Non reversible (lossy), with loss of some information.


• Lossy compression is often used in
image communication, video,WWW,
etc.
• It is usually important that the image visually is
still nice.
The compression ratio is typically 10 to 30 times.
• Loss of information
• Perceptual loss of information reduced
(controlled)
• Higher compression ratio

115
Huffmann Coding

• The Huffman code, developed by D. Huffman in 1952, is a minimum length code


• This means that given the statistical distribution of the gray levels (the histogram),
the Huffman algorithm will generate a code that is as close as possible to the
minimum bound, the entropy
• The method results in an unequal (or variable) length code, where the size of the code
words can vary
• For complex images, Huffman coding alone will typically reduce the file by 10% to 50%
(1.1:1 to 1.5:1), but this ratio can be improved to 2:1 or 3:1 by preprocessing for
irrelevant information removal

The Huffman algorithm can be described in five steps:

1. Find the gray level probabilities for the image by finding the histogram
2. Order the input probabilities (histogram magnitudes) from smallest to largest
3. Combine the smallest two by addition
4. GOTO step 2, until only two probabilities are left

116
5. By working backward along the tree, generate code by alternating assignment of 0 and 1

117
Advantages of Huffman Coding
 Lossless: Original image can be perfectly reconstructed.
 Efficient: Reduces average number of bits per symbol.
 Simple to implement with clear theoretical foundation.

Applications
 Used in JPEG entropy coding.
 Used in GIF, PNG image formats.
 Part of MP3, MPEG, and other multimedia compression standards.

Arithmetic Coding
Arithmetic Coding is an advanced lossless compression technique that encodes an entire message
(e.g., image data) into a single fractional number between 0 and 1. Unlike Huffman coding which
assigns discrete codes to symbols, arithmetic coding works on symbol sequences and achieves better
compression ratios, especially for sources with skewed probabilities.

Instead of assigning fixed binary codes to individual symbols (like in Huffman coding), arithmetic
coding:
 Divides the interval [0, 1) into subintervals based on symbol probabilities.
 Narrowly refines the interval with each input symbol.
 The final subinterval represents the entire sequence.
 Any number within this interval can be used to represent the sequence.
Example:

Let’s encode the message: AB

Symbol Probabilities:

Symbo Probabilit
Range
l y

[0.0,
A 0.6
0.6)

B 0.4 [0.6,

118
Symbo Probabilit
Range
l y

1.0)

Step 1: Start with interval [0.0, 1.0)

Step 2: For ‘A’ → New interval = [0.0, 0.6)

Step 3: For ‘B’ → Within [0.0, 0.6), take the B range:

 New lower = 0.0 + (0.6 × 0.6) = 0.36


 New upper = 0.0 + (0.6 × 1.0) = 0.6
 Final interval = [0.36, 0.6)
Any number in [0.36, 0.6) represents message AB. Example: 0.5

Applications:

 Text and image compression


 Used in JPEG2000, bzip2, video codecs
Dictionary-Based Compression
Dictionary-based compression is a lossless data compression technique where repeating
sequences (like pixel patterns or strings) are replaced by shorter references to a dictionary or codebook.
This method is widely used for text, but also applies to image formats like GIF and TIFF, especially
when pixel patterns repeat (common in cartoons, line art, etc.).

 A dictionary (explicit or implicit) is built dynamically or predefined.


 Repeated sequences of symbols (e.g., pixel values) are replaced with codes (dictionary
indices).
 During decompression, these codes are looked up in the dictionary to reconstruct the original
data.

Advantages
 Simple and fast for repeating data
 No loss of information (lossless)
119
 Works well on images with repeated patterns or large uniform areas
Applications
 GIF: Uses LZW compression for storing indexed-color images
 TIFF: Supports optional LZW and other dictionary-based methods
 PNG: Uses a variant of LZ77 along with Huffman coding.

Transform based compression


Transform-based compression is a technique where an image is converted from the spatial domain
to a transform domain using mathematical transforms like DCT or Wavelets, to concentrate energy
in fewer coefficients. These coefficients are then quantized and encoded, achieving high compression
— especially effective for natural images.

⚫ A reversible linear transform (such as Fourier Transform) is used to map the


image into a set of transform coefficients
⚫ These coefficients are then quantized and coded.
⚫ The goal of transform coding is to decorrelate pixels and pack as much
information into small number of transform coefficients.
Compression is achieved during quantization not during the transform

• Two particular types of transform coding have been widely


explored:
1. Zonal coding
2. Threshold coding
Advantages

120
 High compression ratios
 Effective for natural, photographic images
 Supports both lossy and lossless methods (e.g., JPEG2000)

QUESTION BANKS:
1. What is the main goal of image compression?
a) Noise removal
121
b) Reduce storage and bandwidth ✔
c) Enhance brightness
d) Add noise

2. Which of the following is a lossless image compression technique?


a) JPEG
b) RLE ✔
c) DCT
d) Quantization

3. The ratio of uncompressed to compressed size is called:


a) PSNR
b) Entropy
c) Compression ratio ✔
d) Quantization level

4. Which metric is used to measure distortion in compressed images?


a) MSE ✔
b) CR
c) Entropy
d) Histogram

5. Which of the following is not a type of redundancy?


a) Spatial
b) Spectral
c) Perceptual
d) Logical ✔

6. Huffman coding is based on:


a) Repetition
b) Probability of symbols ✔
c) Color transformation
d) Block processing

7. Arithmetic coding represents a message as:


a) Binary string
b) ASCII code

122
c) A single floating-point number ✔
d) Frequency table

8. Which compression method uses a dictionary-based approach?


a) DCT
b) RLE
c) LZW ✔
d) DWT

9. Run-Length Encoding is best suited for:


a) Grayscale photos
b) Textured images
c) Binary images with large uniform regions ✔
d) Noisy images

10. In Huffman coding, frequently occurring symbols are assigned:


a) Longer codes
b) Random codes
c) Shorter codes ✔
d) Codes of equal length

11. Lossy compression allows:


a) No data loss
b) Full recovery
c) Some loss for better compression ✔
d) Image enhancement

12. JPEG uses which transform for compression?


a) DWT
b) FFT
c) DCT ✔
d) KLT

13. Quantization step in JPEG is:


a) Lossless
b) Reversible
c) Lossy ✔
d) Perfectly accurate
123
14. Blocking artifacts in JPEG are caused due to:
a) Large file size
b) Overcompression of DCT blocks ✔
c) Histogram equalization
d) Low PSNR

15. In JPEG compression, which component is typically compressed


more heavily?
a) Luminance
b) Chrominance ✔
c) Red
d) Green

16. The DCT transforms image data from:


a) Time to space
b) RGB to grayscale
c) Spatial to frequency domain ✔
d) Color to binary

17. Which transform is used in JPEG2000?


a) Fourier
b) DCT
c) Wavelet ✔
d) KLT

18. The Karhunen–Loève Transform (KLT) is:


a) Suboptimal
b) Data-independent
c) Optimal in energy compaction ✔
d) Lossy only

19. A key advantage of Wavelet Transform over DCT is:


a) Less computation
b) No need for quantization
c) Better at localizing edges ✔
d) Better for binary images

124
20. Zig-zag scanning in JPEG helps in:
a) Edge detection
b) PSNR improvement
c) Grouping low-frequency coefficients ✔
d) Color space conversion

21. Entropy is defined as:


a) Redundancy measure
b) Image size
c) Average information per symbol ✔
d) Pixel correlation

22. Which of the following decreases entropy?


a) Huffman coding ✔
b) Quantization
c) Increasing symbol variance
d) DCT

23. The main goal of transform coding is:


a) Color reduction
b) Pixel prediction
c) Energy compaction ✔
d) Bit plane slicing

24. Which type of redundancy is reduced by transform coding?


a) Coding
b) Temporal
c) Spatial ✔
d) Spectral

25. Spectral redundancy is significant in:


a) Binary images
b) RGB images ✔
c) Grayscale images
d) Edge images

26. JPEG uses:


a) LZW
125
b) Arithmetic coding
c) DCT and quantization ✔
d) Wavelet transform

27. JPEG2000 uses:


a) DCT
b) FFT
c) KLT
d) DWT ✔

28. The PNG format uses:


a) DCT
b) LZ77 ✔
c) DWT
d) Huffman only

29. TIFF format supports:


a) Only lossy compression
b) Only color images
c) Multiple compression methods ✔
d) Only grayscale images

30. GIF uses:


a) Arithmetic coding
b) Huffman coding
c) LZW ✔
d) DCT

31. Vector Quantization compresses by:


a) Removing noise
b) Converting to binary
c) Using a codebook for blocks ✔
d) Splitting into subbands

32. The main lossy step in JPEG is:


a) DCT
b) Zig-zag scanning

126
c) Quantization ✔
d) Huffman coding

33. Which metric indicates better quality after compression?


a) Lower MSE ✔
b) Lower PSNR
c) Higher e ntropy
d) Higher compression ratio

34. A code that is not a prefix of any other code is called:


a) Redundant
b) Self-decoding
c) Prefix code ✔
d) Fixed-length code

35. Arithmetic coding is more efficient than Huffman when:


a) All symbols are equally probable
b) Probabilities are very skewed ✔
c) Only 2 symbols exist
d) Using grayscale images

36. Which component of YCbCr is most sensitive to human eye?


a) Y ✔
b) Cb
c) Cr
d) All equal

37. Which compression is always lossless?


a) JPEG
b) JPEG2000
c) Huffman coding ✔
d) DCT

38. Compression ratio is inversely proportional to:


a) File size
b) Redundancy
c) Quality ✔
d) Bit rate
127
39. Which format supports both lossy and lossless modes?
a) JPEG
b) PNG
c) GIF
d) JPEG2000 ✔

40. Codebook is used in:


a) RLE
b) Huffman
c) Vector Quantization ✔
d) DCT

41. The main limitation of DCT is:


a) Low compression
b) Edge loss
c) Blocking artifacts ✔
d) Slowness

42. Quantization error leads to:


a) Blurring
b) Noise
c) Data loss
d) All the above ✔

43. Higher compression ratio usually results in:


a) Better image
b) Less data loss
c) More artifacts ✔
d) Less entropy

44. Which of the following is not used in JPEG compression?


a) Huffman coding
b) Quantization
c) DCT
d) LZW ✔

128
45. A transform that adapts based on data statistics:
a) FFT
b) DCT
c) KLT ✔
d) RLE

46. Higher PSNR indicates:


a) More distortion
b) Better quality ✔
c) Higher entropy
d) Greater compression

47. Which transform is non-linear?


a) DCT
b) Wavelet
c) KLT
d) None ✔

48. Which method breaks image into variable-size segments?


a) DCT
b) DWT
c) Vector quantization
d) Fractal compression ✔

49. Inter-frame redundancy is reduced by:


a) Huffman coding
b) Run-Length
c) Motion compensation ✔
d) DWT

50. Which compression is most suitable for satellite or medical


images?
a) JPEG
b) GIF
c) JPEG2000 ✔
d) BMP
5Mark Questions

129
1. Explain the different types of redundancies in image compression with suitable examples.
2. Compare Huffman Coding and Arithmetic Coding. Highlight their advantages and limitations..
3. What are the differences between lossless and lossy compression schemes? Give examples.
10Mark Questions

1. Explain the need for image compression in digital image processing. Describe the different
types of redundancy found in images.
2. Discuss the classification of images used in digital image compression. Explain the suitable
compression methods for each class.
3. Describe Huffman coding and Arithmetic coding as image compression techniques. Explain
the working of each with examples.

-----------------------------------------unit 5 completed---------------------------------------

130
131

You might also like