Image Processing Rishavofficial
Image Processing Rishavofficial
📝 Detailed Explanation
Key Point 1: Procedure for Computing the Median of an n × n Neighbourhood
Step 1: Define the neighbourhood window of size n × n centred at pixel (x, y).
Step 4: Select the middle value from the sorted list. For n² values (which is always odd
when n is odd), the median is the value at position (n² + 1)/2.
Step 5: Replace the centre pixel (x, y) with this median value.
1 IP_1
Example: For a 3 × 3 neighbourhood with values {15, 20, 22, 18, 200, 19, 21, 17, 23},
sorted = {15, 17, 18, 19, 20, 21, 22, 23, 200}, median = 20 (5th value).
Key Point 2: Technique for Updating the Median (Sliding Window / Huang's Algorithm)
When the centre of the neighbourhood moves from pixel (x, y) to (x, y+1) (one column
to the right), the n × n window shifts by one column. This means:
• One column of n pixels is removed (the leftmost column of the old window).
• One column of n pixels is added (the rightmost column of the new window).
• Subtract the n pixels of the outgoing (leftmost) column from H. For each
removed pixel value v, if v ≤ current median, decrement ltmdn.
• Add the n pixels of the incoming (rightmost) column to H. For each added pixel
value v, if v ≤ current median, increment ltmdn.
• If ltmdn ≥ th, the new median may have shifted lower — scan H downward
from the current median until ltmdn < th.
• If ltmdn < th, the new median may have shifted higher — scan H upward until
ltmdn ≥ th.
This reduces the complexity from O(n² log n²) per pixel (full sort) to approximately
O(n) per pixel (only updating 2n values and scanning the histogram).
• Speed: The histogram update is O(n), and the median search is O(number of
grey levels), making it much faster than re-sorting.
Histogram Update:
H[a1]--, H[a4]--, H[a7]-- (decrement removed)
H[b1]++, H[b2]++, H[b3]++ (increment added)
Then adjust median pointer in histogram.
💡 Example
Consider a 3 × 3 window scanning a row of a 256-grey-level image. At position (5, 5),
the sorted neighbourhood is {10, 12, 14, 15, 18, 20, 22, 25, 30}, median = 18. Moving
to (5, 6), pixels {10, 15, 25} are removed and {11, 19, 28} are added. Histogram is
updated by decrementing bins 10, 15, 25 and incrementing bins 11, 19, 28. The count
ltmdn is adjusted, and the histogram is scanned to find the new median = 19.
🔚 Conclusion
The median filter is a powerful tool for noise removal in images, especially salt-and-
pepper noise. The naive approach of sorting all n² pixels for every pixel position is
computationally expensive. By using a histogram-based sliding window technique
(Huang's algorithm), we can efficiently update the median with only O(n) operations per
pixel move, making real-time median filtering practical even for large neighbourhood
sizes.
3 IP_3
📝 Detailed Explanation
Key Point 1: Pixel
A pixel at coordinates (x, y) in a digital image f has an intensity value f(x, y). For a
greyscale image, this value typically ranges from 0 (black) to 255 (white) for an 8-bit
image. For a colour image, each pixel stores multiple values (e.g., R, G, B channels).
The pixel is the fundamental building block of any digital image and determines its
spatial resolution.
These are also called the direct neighbours or Von Neumann neighbourhood. The set
of these four pixels is denoted as N₄(p). Note: Some of these neighbours may lie outside
the image boundary for edge/corner pixels.
• (x+1, y), (x−1, y), (x, y+1), (x, y−1) — direct neighbours
• (x+1, y+1), (x+1, y−1), (x−1, y+1), (x−1, y−1) — diagonal neighbours (Nᴅ)
(ii) q is in Nᴅ(p) (they are diagonally adjacent) AND the set N₄(p) ∩ N₄(q) has no
pixels with values from V.
This means: diagonal adjacency is allowed only when there is no 4-connected path
between the two pixels through V-valued pixels. This prevents the formation of
ambiguous multiple paths between pixels.
m-Adjacency Example:
┌───┬───┬───┐ V = {1}
│ 0 │ 1 │ 0 │
├───┼───┼───┤ p = (1,0), q = (0,1), r = (1,1)
│ 1 │ 1 │ 0 │
├───┼───┼───┤ 8-adjacency: p-q, p-r, q-r (ambiguous path)
│ 0 │ 0 │ 0 │ m-adjacency: p-r, q-r only (no p-q diagonal
└───┴───┴───┘ since N₄(p)∩N₄(q) contains r which ∈ V)
💡 Example
Consider a binary image region where pixels with value 1 are of interest (V = {1}). If
three pixels p(1,0)=1, q(0,1)=1, r(1,1)=1 are present, using 8-adjacency all three are
mutually adjacent, creating an ambiguous triangular path. Using m-adjacency, p and q
are NOT m-adjacent because their common 4-neighbour r has a value in V. This
eliminates the ambiguity and produces a clean single-pixel-wide path: p→r→q.
🔚 Conclusion
A pixel is the fundamental unit of a digital image. The 4-neighbourhood and 8-
neighbourhood define the spatial relationship between pixels, which is essential for
operations like connectivity analysis and region growing. m-adjacency resolves the
ambiguity problem of 8-adjacency by restricting diagonal connections, ensuring unique
paths between pixels and making algorithms more deterministic and reliable.
5 IP_5
📝 Detailed Explanation
Key Point 1: What are Image Sensors?
An image sensor is a device that detects and converts incoming electromagnetic energy
(visible light, X-rays, infrared, etc.) into an electrical signal. The most common image
sensors are:
Example: A flatbed scanner uses a single sensor (or a small sensor array acting as one)
that is moved across the document line by line.
Example: A flat-bed scanner typically uses a 1D CCD sensor strip that sweeps across
the page. Satellite imaging systems like pushbroom scanners use linear sensor arrays —
the satellite's orbital motion provides the second dimension.
Example: A digital camera uses a 2D CCD or CMOS sensor array (e.g., 4000 × 3000
pixels) to capture the full image at once. Each sensor element in the array corresponds
to one pixel of the output image.
Key Point 5: Image Acquisition Technique — Using a Sensor Array (Digital Camera)
The most common technique involves a 2D sensor array coupled with an illumination
source and optics:
3. Sensing: Each sensor element converts the photon energy into an electrical
voltage proportional to light intensity.
💡 Example
A digital camera is a practical example of sensor array-based acquisition. The CMOS
sensor array (e.g., 12 megapixels = 4000 × 3000) captures the entire scene in one shot.
Light passes through the lens, hits the Bayer filter (colour filter array with R, G, B
patterns), and each sensor converts photons to voltage. The ADC (Analog-to-Digital
Converter) quantizes these voltages into 8-bit or higher values, producing the final
digital image.
🔚 Conclusion
Image sensing and acquisition is the first and most critical step in digital image
processing. Single sensors offer precision but are slow; sensor strips provide line-by-
7 IP_7
line capture at moderate speeds; and sensor arrays capture the entire image instantly,
making them the standard in modern cameras. The choice of sensor arrangement
depends on the application's requirements for speed, resolution, and cost. Modern image
acquisition relies primarily on CCD and CMOS sensor arrays with integrated
digitization.
📝 Detailed Explanation
Key Point 1: Why Interpolation is Needed
When an image undergoes geometric transformations (scaling, rotation, translation), the
transformed pixel coordinates often fall at non-integer positions in the original image.
Since pixel values exist only at integer coordinates, we need to estimate (interpolate) the
value at the fractional location. Bilinear interpolation uses the four closest known pixels
to compute this estimate.
• f(x, y) = (1−b) × R₁ + b × R₂
8 IP_8
Combined Formula:
y₁ y₂
x₁ ●───────────●
│ f(x₁,y₁) │ f(x₁,y₂)
│ │
│ P(x,y) │ b = y - y₁
│ × │ a = x - x₁
│ │
x₂ ●───────────●
f(x₂,y₁) f(x₂,y₂)
Comparison Table:
┌─────────────────────┬──────────┬──────────┬──────────┐
│ Method │ Pixels │ Quality │ Speed │
│ │ Used │ │ │
├─────────────────────┼──────────┼──────────┼──────────┤
│ Nearest-Neighbour │ 1 │ Low │ Fastest │
│ Bilinear │ 4 │ Medium │ Moderate │
│ Bicubic │ 16 │ High │ Slowest │
└─────────────────────┴──────────┴──────────┴──────────┘
💡 Example
Suppose we want to find the intensity at point P(2.3, 4.7). The four nearest pixels are:
9 IP_9
• a = 0.3, b = 0.7
🔚 Conclusion
Bilinear interpolation is a widely used technique in image processing for estimating
pixel values at non-integer coordinates. By performing two successive linear
interpolations (first along one axis, then along the other), it produces smooth and
visually pleasing results. It strikes a good balance between the blockiness of nearest-
neighbour and the computational cost of bicubic interpolation, making it the default
choice for many real-time image transformation applications.
📝 Detailed Explanation
Key Point 1: Image Resolution
Resolution can be described in multiple ways:
• Spatial Resolution: The number of pixels per unit length (e.g., pixels per inch
— PPI or dots per inch — DPI). Higher spatial resolution means more detail.
• Pixel Resolution: Total pixel count, expressed as Width × Height (e.g., 640 ×
480 = 307,200 pixels).
Physical Size:
• The sampling rate determines the spatial resolution — higher sampling rate
gives more pixels and finer detail.
• According to the Nyquist theorem, the sampling rate must be at least twice the
highest spatial frequency in the image to avoid aliasing.
• The continuous range of intensity values at each pixel is mapped to a finite set of
L discrete levels (e.g., 256 levels for 8-bit quantization).
11 IP_11
• The number of quantization levels L = 2^k, where k is the number of bits per
pixel.
Continuous Image f(x,y) ──→ [SAMPLING] ──→ [QUANTIZATION] ──→ Digital Image
Size Calculation:
┌───────────────────────────────────────┐
│ Width = 640 pixels ÷ 240 PPI = 2.67"│
│ Height = 480 pixels ÷ 240 PPI = 2.00"│
│ Storage = 640 × 480 × 8 bits ≈ 300 KB│
└───────────────────────────────────────┘
💡 Example
A photograph taken by a digital camera with a 12-megapixel sensor produces an image
of 4000 × 3000 pixels (sampling) with each pixel stored as a 24-bit colour value (8 bits
× 3 channels — quantization). The resulting uncompressed image size is 4000 × 3000 ×
3 bytes ≈ 36 MB. When printed at 300 DPI, it produces a 13.3" × 10" print.
🔚 Conclusion
Image resolution defines the detail and quality of a digital image and is characterized by
spatial and intensity resolution. Digitization converts continuous images to digital form
through two essential steps: sampling (discretizing spatial coordinates) and
quantization (discretizing intensity values). The balance between sampling rate,
quantization levels, and storage requirements is a fundamental trade-off in digital
imaging systems.
12 IP_12
❓ Question 6: Write down the key stages in Digital Image
Processing (DIP) and explain them. Explain different types of
DIP processes.
✅ Answer:
📖 Definition / Introduction
Digital Image Processing (DIP) refers to the use of computer algorithms to perform operations on
digital images. The goal is to improve image quality, extract useful information, or transform
images for specific applications. DIP involves a systematic pipeline of stages, each performing a
specific function. Additionally, DIP processes can be categorized based on the level of abstraction
— from low-level pixel operations to high-level semantic understanding.
📝 Detailed Explanation
Key Point 1: Key Stages in Digital Image Processing
Stage 1 — Image Acquisition: The first stage involves capturing the image using
sensors (camera, scanner, satellite) and converting it to digital form. This includes
sensing and digitization (sampling + quantization).
Stage 3 — Image Restoration: Aims to recover an image that has been degraded by a
known or estimated degradation function. Unlike enhancement (subjective), restoration
is objective and model-based. Examples: Wiener filter, inverse filtering.
Stage 4 — Colour Image Processing: Deals with processing of colour images using
colour models (RGB, HSI, CMYK). Includes colour transformations, colour-based
segmentation, and pseudo-colouring.
💡 Example
In a medical X-ray analysis system: Image acquisition captures the X-ray (Stage 1).
Enhancement improves contrast (Stage 2). Restoration removes blur from patient
motion (Stage 3). Segmentation identifies regions of interest like tumours (Stage 8).
Feature extraction measures tumour size and shape (Stage 9). Finally, recognition
classifies the tumour as benign or malignant (Stage 10).
🔚 Conclusion
Digital Image Processing follows a well-defined pipeline of stages, from acquisition to
recognition. Each stage builds on the output of the previous one, progressively moving
from raw pixel data to high-level understanding. DIP processes can be classified into
low-level (image-to-image), mid-level (image-to-features), and high-level (features-to-
understanding) processing, each serving a distinct purpose in the image analysis
pipeline.
📝 Detailed Explanation
Key Point 1: 8-Bit Colour Image
In an 8-bit colour image, each pixel stores a single 8-bit value (0–255) that serves as an
index into a colour lookup table (CLUT) or palette. The palette contains up to 256
entries, where each entry specifies the actual colour (usually as 24-bit RGB values — 8
bits each for Red, Green, Blue).
• The pixel value does NOT directly represent colour; it is a pointer to the palette.
• The palette is chosen to best represent the colours in the image (using algorithms
like median-cut or octree quantization).
Note: An 8-bit greyscale image also uses 8 bits per pixel, but each value directly
represents intensity (0 = black, 255 = white) with no palette.
• Requires significantly less memory (8 bits vs. 24 bits per pixel — 3× less).
• Suitable for images with limited colour range (logos, icons, simple graphics).
Limitations:
• Binary Image (1-bit): Each pixel is either 0 (black) or 1 (white). Used for
documents, text recognition.
• Greyscale Image (8-bit): Each pixel has 256 intensity levels (0–255). Used for
medical imaging, document analysis.
16 IP_16
• Colour Image (24-bit / True Colour): Each pixel has 3 channels (R, G, B), 8
bits each = 16.7 million colours. Used for photography, display.
• 8-bit Colour (Indexed): 256 colours from a palette (as described above).
• High Dynamic Range (HDR): Uses 16-bit or 32-bit per channel for extended
dynamic range.
• Visible light images, infrared images, X-ray images, ultrasound images, satellite
images, etc.
Image Classification:
┌──────────────────┬────────────┬───────────────────┐
│ Type │ Bits/Pixel │ Distinct Values │
├──────────────────┼────────────┼───────────────────┤
│ Binary │ 1 │ 2 │
│ Greyscale │ 8 │ 256 │
│ 8-bit Colour │ 8 (indexed)│ 256 (from palette)│
│ True Colour │ 24 │ 16,777,216 │
│ HDR │ 32–96 │ Billions+ │
└──────────────────┴────────────┴───────────────────┘
💡 Example
The GIF image format uses 8-bit indexed colour. When a 24-bit photograph is
converted to GIF, the software selects the 256 most representative colours and creates a
palette. Each pixel is then mapped to the closest palette colour. This explains why GIF
17 IP_17
images often look "banded" or less smooth compared to JPEG images that use full 24-
bit colour.
🔚 Conclusion
An 8-bit colour image uses indexed colour representation where each pixel's 8-bit value
indexes into a palette of 256 colours. While memory-efficient, it is limited in colour
range compared to true-colour images. Image classification helps us categorize images
based on colour depth (binary, greyscale, indexed, true colour), dimensionality (2D,
3D), and application domain, enabling appropriate processing techniques to be applied.
📝 Detailed Explanation
Key Point 1: Aliasing in Image Sampling
When a continuous image is digitized through sampling, the sampling rate must be high
enough to capture all spatial frequencies present in the image. According to the
Nyquist-Shannon Sampling Theorem, the sampling frequency must be at least twice
the highest frequency component in the image.
Nyquist Theorem:
f_sampling ≥ 2 × f_max → No aliasing
f_sampling < 2 × f_max → Aliasing occurs
💡 Example
When photographing a person wearing a finely striped shirt with a digital camera, the
stripes may appear as wavy, shifting colour patterns (moiré) in the captured image. This
is aliasing — the spatial frequency of the stripe pattern exceeds the Nyquist limit of the
camera sensor. Many cameras include an optical low-pass (anti-aliasing) filter in front
of the sensor to mitigate this effect.
🔚 Conclusion
Aliasing is a fundamental sampling artefact that occurs when the sampling rate is
insufficient to represent the image's spatial frequencies accurately. It can be mitigated
through higher sampling rates or pre-filtering techniques. Image file formats define how
digital images are stored and vary in compression methods, colour support, and
intended applications. Choosing the right format depends on the trade-off between
quality, file size, and application requirements.
20 IP_20
❓ Question 9: Differentiate between an image and a scene.
Define a digital image and explain image pixels. What is
digitization of an image?
✅ Answer:
📖 Definition / Introduction
In image processing, the terms image and scene are related but distinct concepts. A scene is the
actual physical 3D environment, while an image is a 2D representation of that scene captured by a
sensor. A digital image is a numerical (discrete) representation of a 2D image, and its fundamental
building blocks are pixels. Digitization is the process of converting a continuous image into this
discrete digital form.
📝 Detailed Explanation
Key Point 1: Difference Between Image and Scene
• f(x, y) is the intensity or colour value at coordinates (x, y), also a discrete
quantity.
A digital image can be represented as: f(x, y) where x = 0, 1, 2, ..., M−1 and y = 0, 1,
2, ..., N−1 and f ∈ {0, 1, 2, ..., L−1} where L is the number of grey levels.
21 IP_21
Key Point 3: Image Pixels
A pixel (picture element) is the smallest individual element of a digital image. Key
properties:
• Each pixel has a specific spatial location (x, y) in the image grid.
After digitization: f(x, y) → a matrix of M × N pixels, each with an integer value from 0
to L−1.
💡 Example
When you stand in front of a garden (scene), your eyes perceive a continuous 3D world
with infinite colour variations. When you take a photograph with a 12MP digital
camera, the sensor samples this scene into 4000 × 3000 discrete pixels (sampling) and
converts each point's light intensity into one of 256 levels per colour channel
(quantization), producing a digital image — a 2D discrete representation of the original
3D scene.
🔚 Conclusion
A scene is the physical 3D world, while an image is its 2D projection captured by an
imaging device. A digital image is a discrete matrix of pixels, where each pixel
represents a sampled and quantized intensity value at a specific spatial location.
Digitization — the process of converting continuous images to digital form through
sampling and quantization — is the foundational step that makes computer-based image
processing possible.
📝 Detailed Explanation
Key Point 1: Poor Brightness Discrimination at Low Illumination
The human eye can perceive a vast range of23
illumination levels (from dim starlight to IP_23
bright sunlight — about 10^10 range). However, at any given adaptation level, the eye
can only discriminate a limited range of brightness (called the simultaneous dynamic
range, roughly 1:100 or ~1000 levels).
• The eye uses rod cells, which are more sensitive to light but cannot distinguish
colours and have low spatial resolution.
• The eye uses cone cells, which provide colour vision and higher resolution.
Where:
A small Weber ratio means the eye can discriminate fine differences in brightness
(good discrimination). A large Weber ratio means coarse discrimination (poor
sensitivity to differences).
Weber's Law states that ΔI_c / I ≈ constant over a wide range of illumination levels
(approximately 0.02 for well-adapted human vision in moderate-to-bright light).
However, this breaks down at very low illumination levels.
• Photochemical changes in rod and cone cells (slower but covers a wider range).
The total range of adaptation spans about 10 orders of magnitude (10^−6 to 10^4
candelas/m²), but at any single adaptation level, the eye can only discriminate about 100
–200 distinct intensity levels simultaneously.
(b) Full-colour processing: Processing images that are naturally acquired in colour
(e.g., RGB photographs). Operations include colour transformations, colour-based
segmentation, colour histogram analysis, and colour space conversions (RGB ↔ HSI ↔
CMYK).
Colour adds three independent channels of information, enabling operations that are
impossible with greyscale alone (e.g., separating objects by hue).
Weber Ratio
(ΔIc/I)
|
0.10 ┤ ● (Poor discrimination
| \ at low light)
0.08 ┤ \
| \
0.06 ┤ \
| \
0.04 ┤ \
| \
0.02 ┤--------●────────────────● (Good discrimination
| (Weber's Law region) in bright light)
0.00 ┤
└──┬──────┬──────┬──────┬──→ log(Intensity I)
25 IP_25
Low Medium High Very High
(Scotopic) (Photopic)
💡 Example
When driving at night (low illumination), it is difficult to distinguish between dark grey
and black objects on the road (high Weber ratio = poor discrimination). In daylight
(high illumination), the same objects are easily distinguishable (low Weber ratio). When
you walk from a dark movie theatre into bright sunlight, your eyes take several seconds
to adapt (brightness adaptation) — during this transition, your discrimination ability is
temporarily impaired.
🔚 Conclusion
The human eye's brightness discrimination ability varies with illumination level, being
poorest in dim conditions and best in moderate-to-bright light. The Weber ratio (ΔIc/I)
quantifies this behaviour and is approximately constant (~0.02) in the photopic range
but increases significantly in scotopic conditions. Brightness adaptation allows the eye
to operate across an enormous range of illumination levels, though only a limited range
is discriminable at any one adaptation level. Colour image processing leverages colour
information beyond greyscale to enable richer analysis and visualization.
❓ Question 11: What are the storage requirements for: (a) A 500
× 500 binary image? (b) A 1024 × 1024 binary image?
✅ Answer:
📖 Definition / Introduction
The storage requirement of a digital image depends on its spatial dimensions (number of pixels)
and its bit depth (number of bits used to represent each pixel). A binary image uses only 1 bit per
pixel, where each pixel is either 0 (black) or 1 (white). Calculating storage requirements is
fundamental to understanding image processing system design, memory allocation, and
transmission bandwidth.
26 IP_26
📝 Detailed Explanation
Key Point 1: Storage Formula
The storage required for an uncompressed digital image is given by:
Storage = M × N × k bits
Where:
┌──────────────────┬────────┬──────────────┬──────────────┬──────────┐
│ Image Size │ Bits/ │ Total Bits │ Total Bytes │ Approx. │
│ │ Pixel │ │ │ Size │
├──────────────────┼────────┼──────────────┼──────────────┼──────────┤
│ 500 × 500 │ 1 │ 250,000 │ 31,250 │ 30.52 KB │
│ (binary) │ │ │ │ │
├──────────────────┼────────┼──────────────┼──────────────┼──────────┤
│ 1024 × 1024 │ 1 │ 1,048,576 │ 131,072 │ 128 KB │
│ (binary) │ │ │ │ │
├──────────────────┼────────┼──────────────┼──────────────┼──────────┤
27 IP_27
│ For comparison: │ │ │ │ │
│ 1024 × 1024 │ 8 │ 8,388,608 │ 1,048,576 │ 1 MB │
│ (8-bit grey) │ │ │ │ │
├──────────────────┼────────┼──────────────┼──────────────┼──────────┤
│ 1024 × 1024 │ 24 │ 25,165,824 │ 3,145,728 │ 3 MB │
│ (24-bit colour) │ │ │ │ │
└──────────────────┴────────┴──────────────┴──────────────┴──────────┘
💡 Example
A fax machine transmits binary images of documents. A standard A4 page scanned at
200 DPI produces an image of approximately 1700 × 2340 pixels. Storage = 1700 ×
2340 × 1 = 3,978,000 bits ≈ 485 KB (uncompressed). Using Group 3 fax compression
(a form of run-length encoding), this can typically be compressed to 30–50 KB, making
transmission over phone lines feasible.
🔚 Conclusion
Storage requirements for digital images are directly determined by the image
dimensions and bit depth. A 500 × 500 binary image requires approximately 30.52 KB,
while a 1024 × 1024 binary image requires 128 KB of uncompressed storage. Binary
images are the most storage-efficient format but can only represent two intensity levels.
Understanding storage requirements is crucial for system design, particularly in
applications involving large volumes of images or real-time transmission.
🎓 Documen
28 IP_28
📘 [Link] 6th Semester — Exam Preparation
Author: Rishav Raj | Semester: 6th Sem | Subject: Image Processing — Digital Image Formation |
Marks per Answer: 5–10 Marks
📝 Detailed Explanation
Key Point 1: Image Sampling
A continuous image f(x, y) has values defined at every point in a continuous (x, y)
plane. Since a computer can only handle finite, discrete data, we must sample the image
— that is, measure f at discrete, uniformly spaced locations.
• At each grid point (xᵢ, yⱼ), the image value f(xᵢ, yⱼ) is recorded.
• The distance between adjacent sample points is called the sampling interval
(Δx, Δy).
• The sampling rate (or sampling frequency) = 1/Δx samples per unit length.
f_sampling ≥ 2 × f_max
• High saturation: The colour is vivid, pure, and intense (e.g., a bright red).
• Low saturation: The colour is washed out, dull, and closer to grey (e.g., a pastel
pink).
S = 1 − [3 × min(R, G, B)] / (R + G + B)
Saturation Scale:
┌──────────────────────────────────────────────┐
│ S = 0 S = 0.5 S = 1.0 │
│ (Grey) (Pastel) (Pure colour) │
│ ██████████ ██████████ ██████████ │
│ (no hue) (washed out) (vivid, rich) │
└──────────────────────────────────────────────┘
💡 Example
When scanning a photograph at 300 DPI (dots per inch), the scanner samples the
continuous image at 300 points per inch in both directions. If the photograph has fine
details with spatial frequency up to 100 cycles/inch, the 300 DPI sampling rate satisfies
Nyquist (300 > 2 × 100). A flower image with high saturation appears vivid and
colourful, while reducing saturation to zero converts it to a greyscale image where only
brightness variations remain.
🔚 Conclusion
Image sampling is the essential process of discretizing the spatial domain of a
continuous image into a finite set of pixel locations. The sampling rate must satisfy the
Nyquist criterion to avoid aliasing artefacts. Saturation, on the other hand, is a colour
attribute that measures the purity or vividness of a colour in a digital image. Together,
these concepts are fundamental to understanding how digital images are formed and
how colour information is represented and manipulated.
3 IP_31
📝 Detailed Explanation
Key Point 1: General Form of 2D Transforms
A general 2D transform can be expressed as:
where g(x, y, u, v) is the forward transform kernel (basis function), and the
summation is over all pixel coordinates (x, y). The inverse transform recovers the
original image:
┌────────────────┬──────────────────┬───────────────┬──────────────────┐
│ Transform │ Basis Functions │ Energy │ Primary │
│ │ │ Compaction │ Application │
├────────────────┼──────────────────┼───────────────┼──────────────────┤
│ DFT │ Complex exponent.│ Moderate │ Freq. filtering │
│ DCT │ Cosine functions │ High │ JPEG compression │
│ WHT │ Square waves │ Moderate │ Fast processing │
│ Haar │ Step functions │ Moderate │ Edge detection │
│ KLT (PCA) │ Eigenvectors │ Optimal │ Compression │
│ DWT │ Wavelets │ High │ JPEG 2000 │
│ Slant │ Sawtooth waves │ Good │ Image coding │
│ Hotelling │ Eigenvectors │ Optimal │ Decorrelation │
└────────────────┴──────────────────┴───────────────┴──────────────────┘
5 IP_33
💡 Example
In JPEG image compression, the image is divided into 8×8 blocks, and the 2D DCT is
applied to each block. Most of the energy is concentrated in the top-left corner (low-
frequency coefficients). The high-frequency coefficients (bottom-right) are quantized
more aggressively (set to zero), achieving compression with minimal visual quality loss.
🔚 Conclusion
2D transforms are indispensable tools in digital image processing. Each transform offers
unique properties — DFT provides frequency analysis, DCT excels in compression,
WHT offers computational simplicity, KLT achieves optimal energy compaction, and
DWT provides multi-resolution analysis. The choice of transform depends on the
application requirements, including computational cost, energy compaction, and the
nature of the image data being processed.
📝 Detailed Explanation
Key Point 1: Basic Steps in Image Geometrical Transformation
The process of geometrical transformation involves three main steps:
• Define the mathematical mapping that relates the coordinates of each pixel in the
output image to the corresponding coordinates in the input image.
• Assign the interpolated intensity value to the output pixel at position (x', y').
7 IP_35
• Image registration and alignment: Geometric transforms to align multi-modal
images.
• After applying a good transform (e.g., DCT, KLT), most energy is packed into a
few low-frequency coefficients.
• DCT has near-optimal energy compaction for natural images and is data-
independent, making it the preferred choice for standards like JPEG.
• Colour (RGB): Three matrices (one each for Red, Green, Blue channels), each
M × N.
• Storage formats: Raster formats (BMP, JPEG, PNG, TIFF, GIF) store pixel
data; vector formats (SVG) store mathematical descriptions of shapes.
• Header + Data: Most file formats have a header (metadata: dimensions, bit
depth, colour model) followed by pixel data (compressed or uncompressed).
8 IP_36
📊 Diagram / Table (if applicable)
Geometric Transformations in Homogeneous Coordinates:
💡 Example
To rotate an image by 30° and then translate it by (50, 100), we compute: T =
T_translate × T_rotate. For each output pixel (x', y'), we find the corresponding input
location via T⁻¹, use bilinear interpolation to find the intensity, and assign it to (x', y').
In JPEG compression, the 2D DCT achieves energy compaction — for a typical 8×8
image block, over 90% of the energy is concentrated in just 10–15 coefficients out of
64.
🔚 Conclusion
Geometrical transformations (translation, rotation, scaling, shearing) are essential
operations in image processing. Using homogeneous coordinates, all these
transformations can be represented as 3×3 matrix multiplications, enabling efficient
composition of multiple transforms. Image transforms like DCT, DFT, and KLT are
widely applied in compression, filtering, and recognition. Energy compaction — the
ability to concentrate image energy in few coefficients — is the key property that
enables effective image compression. Digital images are represented as 2D matrices
stored in various file formats with headers and pixel data.
9 IP_37
❓ Question 4: If an image is rotated by an angle of π/4, will
there be any change in the histogram of that image? Justify.
✅ Answer:
📖 Definition / Introduction
A histogram of a digital image is a graphical representation showing the frequency distribution of
pixel intensity values. It plots the number of pixels at each intensity level (0 to L−1). Image
rotation is a geometric transformation that changes the spatial positions of pixels. The question
examines whether rotating an image by π/4 (45°) affects its histogram — a fundamental relationship
between spatial and intensity transformations.
📝 Detailed Explanation
Key Point 1: Histogram is Intensity-Based, Not Position-Based
The histogram of an image depends only on the intensity values and their frequency of
occurrence — it does NOT depend on the spatial arrangement or positions of the
pixels. Whether a pixel with value 128 is at location (0, 0) or (100, 200) makes no
difference to the histogram. Therefore, any purely geometric transformation that only
rearranges pixel positions without altering intensity values should, in theory, leave the
histogram unchanged.
10 IP_38
• Bilinear and bicubic interpolation compute weighted averages of neighbouring
pixels, producing new intensity values that may not have existed in the original
image.
• This introduces subtle changes in the histogram (new intensity levels may
appear, some may disappear, distribution smooths out slightly).
• Rotation by 45° changes the image's bounding rectangle (the rotated square
becomes a larger diamond shape).
• New background pixels (usually black = 0 or white = 255) are added to fill the
corners of the new rectangular bounding box.
• These extra pixels add to the histogram count at the background intensity level.
Histogram Impact:
┌────────────────────────────────────────────────┐
│ Factor │ Effect on Histogram │
├───────────────────────┼─────────────────────────┤
│ Pure rotation (ideal) │ No change │
│ Interpolation │ Slight smoothing │
│ Background addition │ Spike at BG intensity │
│ Nearest-neighbour │ Minimal change │
│ Bilinear/Bicubic │ New intermediate values │
└───────────────────────┴─────────────────────────┘
💡 Example
Consider a small 4×4 image with only two intensity values: 100 and 200 (each
11 IP_39
appearing 8 times). After rotating by π/4 using bilinear interpolation, some pixel values
become weighted averages like 125, 150, 175 — values that did NOT exist in the
original image. The histogram now has additional bars at these intermediate levels, and
the counts at 100 and 200 decrease. Additionally, background (black = 0) pixels are
added at the corners, creating a new spike at intensity 0.
🔚 Conclusion
Theoretically, rotating an image by π/4 should NOT change its histogram, because
rotation is a spatial transformation that rearranges pixel positions without altering their
intensity values. However, in practice, the histogram DOES change slightly due to
three factors: (1) interpolation introduces new intermediate intensity values, (2)
background pixels are added to fill the rotated image's bounding box, and (3) the total
number of pixels may change. The extent of histogram change depends on the
interpolation method used — nearest-neighbour causes the least change, while bilinear
and bicubic cause more.
📝 Detailed Explanation
Key Point 1: RGB (Red, Green, Blue) Colour Model
The RGB model is an additive colour model based on combining red, green, and blue
light:
• (0, 0, 0) = Black (no light), (255, 255, 255) = White (full light).
12 IP_40
• Secondary colours: Yellow = R+G, Cyan = G+B, Magenta = R+B.
• The main diagonal (R=G=B) represents grey shades from black to white.
• Works by subtracting colours from white light (white paper reflects all light).
• Hue (H): The dominant wavelength / type of colour (0°–360°). Red = 0°, Green
= 120°, Blue = 240°.
13 IP_41
• Saturation (S): Purity of the colour (0 = grey, 1 = fully saturated pure colour).
The HSI model decouples colour information (H, S) from intensity (I), which is
extremely useful for:
The model is visualized as a double cone or cylinder with H as the angular dimension,
S as the radial dimension, and I as the vertical axis.
• This accounts for human eye sensitivity (most sensitive to green, least to blue).
• Grey = (R + G + B) / 3
• Convert to HSI and discard H and S; use only the I (Intensity) channel.
💡 Example
A digital photograph displayed on a monitor uses the RGB model. The sky appears as
approximately (135, 206, 235) in RGB — a light blue. To print this photo, the printer
converts it to CMYK: C = 0.43, M = 0.12, Y = 0, K = 0.08. For colour-based weather
analysis, the HSI model would be used: H ≈ 197° (blue hue), S ≈ 0.43 (moderately
saturated), I ≈ 0.75 (bright). To convert to greyscale: Grey = 0.299(135) + 0.587(206) +
0.114(235) ≈ 188.
🔚 Conclusion
The four major colour models serve different purposes: RGB is standard for electronic
displays (additive), CMY/CMYK for printing (subtractive), and HSI for perceptual
colour analysis. Each model has strengths — RGB is hardware-aligned, CMYK is print-
optimized, and HSI separates colour from intensity for more intuitive processing.
Colour-to-greyscale conversion is best done using the luminosity method (weighted
sum) that reflects human visual sensitivity to different colour channels.
📝 Detailed Explanation
Key Point 1: RGB to HSI Conversion
Given R, G, B values normalized to [0, 1]:
Intensity (I):
• I = (R + G + B) / 3
Saturation (S):
• S = 1 − [3 × min(R, G, B)] / (R + G + B)
• If R + G + B = 0, then S = 0
Hue (H):
• If B ≤ G: H = θ
• If B > G: H = 360° − θ
Alternatively:
• B = I × (1 − S)
• G = 3I − (R + B)
• H = H − 120°
16 IP_44
• R = I × (1 − S)
• B = 3I − (R + G)
• H = H − 240°
• G = I × (1 − S)
• R = 3I − (G + B)
• Disadvantage: Can cause colour shifts and unnatural results because the
channels are processed independently.
• Match the histogram of each channel (or intensity) to a desired target histogram.
💡 Example
For a pixel with RGB = (200, 100, 50) normalized to (0.784, 0.392, 0.196):
For histogram processing, converting this image to HSI, equalizing only the I channel,
and converting back preserves the orange hue while improving contrast.
🔚 Conclusion
RGB to HSI conversion separates the colour (H, S) from the brightness (I), enabling
independent processing. The forward conversion uses trigonometric formulas to
compute hue, a ratio for saturation, and a simple average for intensity. The inverse
conversion uses sector-based formulas to recover RGB from HSI. For histogram
processing of colour images, the preferred approach is to convert to HSI, apply
histogram equalization only to the Intensity channel, and convert back — this enhances
contrast while preserving the original colours.
18 IP_46
❓ Question 7: What is a CCD array? How is it related to image
quality?
✅ Answer:
📖 Definition / Introduction
A CCD (Charge-Coupled Device) array is a semiconductor-based image sensor consisting of a
2D grid of photosensitive elements (photosites or pixels) that convert incoming light into electrical
charge. CCD arrays are one of the most important technologies for image acquisition in digital
cameras, scanners, telescopes, and medical imaging devices. The characteristics of the CCD array
directly determine several aspects of the captured image's quality.
📝 Detailed Explanation
Key Point 1: Structure and Working of a CCD Array
• A CCD array consists of an M × N grid of photosites (metal-oxide-
semiconductor capacitors).
• After exposure, the accumulated charges are shifted row by row through the
array to an output amplifier using a precisely timed sequence of clock pulses
(charge coupling).
• The output amplifier converts the charge to a voltage, which is then digitized by
an ADC (Analog-to-Digital Converter) to produce pixel values.
• The entire process is highly orderly — charges are transferred without mixing,
preserving spatial accuracy.
• Trade-off: larger photosites mean fewer pixels for a given sensor size, reducing
resolution.
• Higher dynamic range = ability to capture both very dark and very bright details
simultaneously.
• Dark current noise: Charge generated by thermal effects (even without light).
• The quality of the colour filter array and demosaicing algorithm affect colour
accuracy.
• Alternatively, some high-end cameras use 3-CCD systems (one CCD per colour
channel) for superior colour.
• Higher fill factor → more light collected → better sensitivity and less aliasing.
💡 Example
A professional astronomical CCD camera like the KAF-16803 has a 4096 × 4096 array
with 9 μm photosites. The large photosites provide excellent sensitivity for capturing
faint stars. The sensor is cooled to −40°C to minimize dark current noise, enabling long
exposures (minutes to hours). The result is high-resolution, low-noise images of deep-
sky objects that would be impossible with smaller, noisier sensors.
🔚 Conclusion
The CCD array is a fundamental image sensing technology where photosites convert
light into electrical charge that is systematically read out and digitized. Image quality is
directly affected by CCD parameters: the number of photosites determines resolution,
photosite size affects sensitivity and noise, full-well capacity defines dynamic range,
and the colour filter arrangement impacts colour accuracy. Understanding these
relationships is essential for selecting appropriate imaging systems and optimizing
image quality for specific applications.
21 IP_49
❓ Question 8: What is image resampling? What is the purpose
of image denoising? When do we need image warping? What
is digital watermarking?
✅ Answer:
📖 Definition / Introduction
Digital image processing encompasses several important operations for transforming, cleaning, and
securing images. Image resampling changes the pixel grid of an image, denoising removes
unwanted noise, warping applies non-linear geometric distortions, and digital watermarking
embeds hidden information for copyright protection. Each of these operations serves a distinct
purpose in the image processing pipeline.
📝 Detailed Explanation
Key Point 1: Image Resampling
Image resampling is the process of transforming a digitized image from one coordinate
grid to another. It involves changing the number of pixels (resolution) or the spatial
arrangement of an image. Resampling is required whenever:
Methods:
The quality of resampled images depends on the interpolation method used and the
resampling ratio.
Purpose:
Common denoising methods: Mean filter, median filter, Gaussian filter, Wiener filter,
wavelet denoising, Non-Local Means (NLM), BM3D.
Applications:
Methods:
┌─────────────────┬──────────────────────┬──────────────────────────┐
│ Operation │ Purpose │ Key Application │
├─────────────────┼──────────────────────┼──────────────────────────┤
│ Resampling │ Change pixel grid │ Resizing, rotation │
│ Denoising │ Remove noise │ Medical imaging, photos │
│ Warping │ Non-linear distortion│ Registration, panoramas │
│ Watermarking │ Embed hidden info │ Copyright protection │
└─────────────────┴──────────────────────┴──────────────────────────┘
Image Warping:
Source Image Warped Image
┌──────────┐ ┌──╱──╲───┐
│ │ warp │╱ ╲│
│ Grid │ ───→ │ │
│ │ │╲ ╱ │
└──────────┘ └──╲──╱───┘
(regular grid) (distorted grid)
💡 Example
Resampling: Zooming into a 1024×1024 image to display it as 2048×2048 on a high-
resolution monitor requires upsampling with bilinear interpolation. Denoising: A photo
24 IP_52
taken in dim light has visible grain (Gaussian noise); applying a Wiener filter removes
the noise while preserving edges. Warping: Stitching two overlapping drone
photographs into a seamless panorama requires warping one image to align with the
other. Watermarking: A stock photo company embeds an invisible watermark in each
image; if a customer uses the image without a license, the watermark can be extracted to
prove ownership.
🔚 Conclusion
Image resampling, denoising, warping, and digital watermarking are four distinct but
important operations in digital image processing. Resampling enables resolution
changes and geometric transformations; denoising improves image quality by removing
unwanted noise; warping handles complex non-linear geometric corrections for
registration and alignment; and watermarking provides a means of embedding hidden
information for copyright protection and authentication. Together, these operations
address the practical challenges of image acquisition, processing, and distribution.
📝 Detailed Explanation
Key Point 1: What Thinning Does
Thinning iteratively peels away (erodes) pixels from the boundaries of foreground
objects, but unlike simple erosion, it ensures that:
The skeleton lies along the medial axis of the object — the set of centres of maximal
circles that fit within the object.
25 IP_53
Key Point 2: Role in Character Recognition
In OCR (Optical Character Recognition), thinning serves several important purposes:
• Normalization: Characters of different font sizes, styles, and stroke widths are
reduced to a uniform, single-pixel-wide representation. This removes variations
due to font weight (bold vs. thin).
• Stroke Analysis: The skeleton directly represents the pen strokes that form the
character, making it easier to match against character templates or models.
Thinning Properties:
┌──────────────────┬──────────────────────────┐
│ Property │ Preserved by Thinning? │
├──────────────────┼──────────────────────────┤
│ Connectivity │ ✓ Yes │
│ Topology │ ✓ Yes │
│ Shape structure │ ✓ Yes (approximately) │
│ Stroke width │ ✗ Normalized to 1 pixel │
│ Area │ ✗ Reduced significantly │
│ Endpoints/Junct. │ ✓ Yes │
└──────────────────┴──────────────────────────┘
💡 Example
In a handwriting recognition system, the word "Hello" is written with varying pen
pressure, resulting in strokes of different widths. Thinning reduces all strokes to single-
pixel width, normalizing the representation. From the skeleton of each character,
features are extracted: "H" has 4 endpoints, 2 branch points, 0 loops; "e" has 1 endpoint,
1 branch point, 1 loop; "l" has 2 endpoints, 0 branch points, 0 loops. These features are
then used by a classifier to identify each character.
🔚 Conclusion
Image thinning is an essential preprocessing step in character recognition that reduces
multi-pixel-wide character strokes to single-pixel-wide skeletons while preserving the
topological structure (connectivity, endpoints, branches, loops). This normalization
makes character recognition more robust to variations in font weight and writing style,
provides a compact representation for efficient feature extraction, and enables structural
analysis of character shapes. Algorithms like Zhang-Suen perform this iteratively by
carefully removing boundary pixels without breaking connectivity.
27 IP_55
❓ Question 10: Explain three different transformations used in
images. Give an example for each of them.
✅ Answer:
📖 Definition / Introduction
Image transformations are operations that modify an image's spatial coordinates, intensity values,
or domain representation for purposes like enhancement, analysis, compression, or geometric
correction. The three major categories are: Intensity (Point) Transformations, Spatial
(Geometric) Transformations, and Frequency (Domain) Transformations. Each operates on a
different aspect of the image.
📝 Detailed Explanation
Key Point 1: Intensity Transformation (Point Transformation)
An intensity transformation modifies the pixel values (grey levels) of an image
without changing their spatial positions. It operates on each pixel independently based
on a transfer function: s = T(r), where r is the input intensity and s is the output
intensity.
Types:
Types:
• Translation: Shifts the image by (tx, ty): x' = x + tx, y' = y + ty.
28 IP_56
• Scaling: Resizes: x' = sx × x, y' = sy × y.
Common transforms:
Example: In removing periodic noise from an image (e.g., interference patterns from
an electrical source), the image is converted to the frequency domain using DFT. The
periodic noise appears as distinct bright spots (spikes) in the frequency spectrum. A
notch-reject filter is applied to suppress these specific frequency components, and the
inverse DFT produces a clean, noise-free image.
1. INTENSITY TRANSFORMATION:
Input pixel r → T(r) → Output pixel s (Position unchanged)
Example - Rotation:
┌────┐ ╱╲
│ │ 30° → ╱ ╲
29 IP_57
│ │ ╱ ╲
└────┘ ╲ ╱
Comparison:
┌────────────────┬──────────────┬──────────────┬──────────────────┐
│ Transform Type │ What Changes │ What Stays │ Example │
├────────────────┼──────────────┼──────────────┼──────────────────┤
│ Intensity │ Pixel values │ Positions │ Log transform │
│ Spatial │ Positions │ Pixel values │ Rotation │
│ Frequency │ Domain repr. │ Information │ DFT filtering │
└────────────────┴──────────────┴──────────────┴──────────────────┘
💡 Example
(1) Intensity: A photograph taken in fog has very low contrast. Applying histogram
equalization (an intensity transformation) spreads the narrow range of grey levels
across the full 0–255 range, revealing hidden details in the fog.
(3) Frequency: An old scanned photo has regular horizontal line interference. After
applying DFT, the interference appears as vertical spikes in the frequency spectrum. A
band-reject filter removes these spikes, and the inverse DFT produces a clean image.
🔚 Conclusion
The three fundamental types of image transformations — intensity, spatial, and
frequency domain — each serve distinct purposes. Intensity transformations modify
pixel values for enhancement and contrast improvement. Spatial transformations modify
pixel positions for alignment, correction, and geometric operations. Frequency domain
transformations convert images into an alternate representation where certain operations
(like filtering periodic noise or compression) become more natural and efficient.
Together, they form the backbone of digital image processing.
30 IP_58
❓ Question 11: What do you mean by sampling and
quantization? Explain their functions in Digital Image
Processing (DIP).
✅ Answer:
📖 Definition / Introduction
Sampling and Quantization are the two fundamental steps in converting a continuous (analog)
image into a discrete (digital) image — a process called digitization. Sampling discretizes the
spatial coordinates, determining where we measure the image, while quantization discretizes the
amplitude (intensity) values, determining how precisely we record each measurement. Together,
they define the resolution and quality of a digital image.
📝 Detailed Explanation
Key Point 1: Sampling
Sampling is the process of selecting discrete spatial locations at which to measure the
image intensity. A continuous image f(x, y) — defined at every point in the x-y plane
— is converted into a discrete grid of M × N sample points.
Process:
• At each grid intersection (xᵢ, yⱼ), the image intensity f(xᵢ, yⱼ) is recorded.
• The distance between adjacent sample points is the sampling interval (Δx, Δy).
Function in DIP:
• Determines the spatial resolution of the digital image — more samples = more
pixels = finer detail.
• Must satisfy the Nyquist criterion: sampling rate ≥ 2 × f_max (highest spatial
frequency) to avoid aliasing.
31 IP_59
• Lower sampling rate → loss of fine detail, potential aliasing, smaller file size.
Process:
• The continuous intensity range [f_min, f_max] is divided into L discrete levels
(typically L = 2^k, where k is the number of bits per pixel).
Function in DIP:
• For a fixed storage budget, increasing spatial resolution (more samples) requires
reducing intensity resolution (fewer bits), and vice versa.
32 IP_60
• Images with smooth gradients benefit from more quantization levels.
• ISO preference studies show that for natural images, increasing spatial
resolution (sampling) generally has more visible impact than increasing
quantization levels beyond 6–8 bits.
Sampling Effect:
High Sampling Rate Low Sampling Rate
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ● ● ● ● ●
● ● ● ● ● ● ● ●
(Fine detail preserved) (Detail lost, aliasing possible)
Quantization Effect:
8-bit (256 levels) 3-bit (8 levels) 1-bit (2 levels)
┌────────────────┐ ┌────────────────┐ ┌────────────────┐
│ Smooth gradient│ │ Visible steps │ │ Black or White │
│ ░░▒▒▓▓██████ │ │ ░░ ▒▒ ▓▓ ██ │ │ ░░░░ ████████ │
└────────────────┘ └────────────────┘ └────────────────┘
(No visible banding) (False contouring) (Binary image)
💡 Example
Consider scanning a photograph at two settings:
• Setting A: 600 DPI (high sampling), 4-bit quantization (16 grey levels) —
captures fine spatial detail but shows visible banding in smooth sky regions.
• Setting B: 150 DPI (low sampling), 8-bit quantization (256 grey levels) —
smooth tonal gradations but blurry details like individual leaves on a tree.
33 IP_61
Both produce similar file sizes but with different quality trade-offs. For most
photographs, Setting C: 300 DPI, 8-bit provides the best balance — adequate spatial
detail and smooth tonal transitions.
🔚 Conclusion
Sampling and quantization are the two pillars of image digitization. Sampling converts
the continuous spatial domain into a discrete grid of pixel locations, determining spatial
resolution and the ability to capture fine detail. Quantization converts continuous
intensity values into discrete levels, determining tonal quality and smoothness. Both
steps introduce potential artefacts — aliasing (from under-sampling) and false
contouring (from coarse quantization). The choice of sampling rate and quantization
levels involves a trade-off between image quality and storage/bandwidth requirements,
and must be tailored to the application's needs.
🎓 Documente
34 IP_62
📘 [Link] 6th Semester — Exam Preparation
Author: Rishav Raj | Semester: 6th Sem | Subject: Image Processing — Mathematical
Preliminaries | Marks per Answer: 5–10 Marks
📝 Detailed Explanation
Key Point 1: What is DFT?
The DFT transforms a finite sequence of equally-spaced samples of a function into a
same-length sequence of equally-spaced samples of the discrete-time Fourier transform
(DTFT), which is a complex-valued function of frequency. The DFT is the most
important discrete transform because:
1 IP_63
For a discrete sequence f(x) of length N, the 1D DFT is:
Forward Transform: F(u) = (1/N) Σ[x=0 to N−1] f(x) · e^(−j2πux/N), for u = 0, 1, ...,
N−1
Inverse Transform: f(x) = Σ[u=0 to N−1] F(u) · e^(j2πux/N), for x = 0, 1, ..., N−1
Where:
• u = frequency variable
• j = √(−1)
Where:
2 IP_64
Feature 1D DFT 2D DFT
Application Audio, 1D signal analysis Image processing, filtering
Spectrum 1D plot of magnitude vs. 2D magnitude spectrum (bright
frequency spots)
Symmetry F(u) = F*(N−u) (conjugate F(u,v) = F*(M−u, N−v)
symmetry)
2D DFT:
f(x,y) = ┌──────────────┐ F(u,v) = ┌──────────────┐
│ Image │ DFT │ Frequency │
│ (M × N) │ ────→ │ Spectrum │
│ │ │ (M × N) │
└──────────────┘ └──────────────┘
💡 Example
1D DFT: A 1D signal f(x) = {2, 3, 4, 4} (N=4). F(0) = (1/4)(2+3+4+4) = 3.25 (DC
component = average). F(1), F(2), F(3) capture the frequency content at harmonics 1, 2,
3.
3 IP_65
🔚 Conclusion
The DFT is a cornerstone of signal and image processing that reveals the frequency
content of discrete data. The 1D DFT handles one-dimensional signals with a single
frequency variable, while the 2D DFT extends to images with two frequency variables.
The 2D DFT is separable — it can be computed efficiently using successive 1D DFTs
along rows and columns. Both are made computationally practical by the FFT algorithm
and are fundamental to frequency-domain filtering, compression, and image analysis.
📝 Detailed Explanation
Key Point 1: Fourier Transform
The continuous Fourier Transform of a function f(x) is defined as:
4 IP_66
• Convolution theorem: Convolution in spatial domain = multiplication in
frequency domain
Process:
3. Compute the DFT of s(k): a(u) = (1/N) Σ[k=0 to N−1] s(k) · e^(−j2πuk/N), for
u = 0, 1, ..., N−1
• Low-frequency descriptors (a(1), a(2), ...) capture the overall shape (coarse
boundary).
These properties make Fourier Descriptors powerful for shape recognition regardless
of position, size, orientation, or starting point.
5 IP_67
📊 Diagram / Table (if applicable)
Fourier Transform Domains:
Fourier Descriptors:
💡 Example
Consider recognizing the shape of a leaf. The leaf boundary is traced as 256 coordinate
pairs and converted to a complex sequence s(k). The DFT produces 256 Fourier
Descriptors. Using only the first 15 descriptors, the leaf shape can be reconstructed with
sufficient accuracy for species identification. The magnitudes |a(u)| / |a(1)| provide a
scale-invariant, rotation-invariant, translation-invariant shape signature that can be
compared against a database of known leaf shapes using Euclidean distance.
🔚 Conclusion
The Fourier Transform is a fundamental mathematical tool that converts signals and
images from the spatial/time domain to the frequency domain, enabling frequency-
based analysis, filtering, and compression. Fourier Descriptors extend this concept to
shape representation — encoding a boundary's geometry as frequency-domain
coefficients. By using only a few low-frequency descriptors, shapes can be compactly
represented and compared with invariance to translation, rotation, and scaling, making
Fourier Descriptors ideal for pattern recognition and shape matching applications.
6 IP_68
❓ Question 3: Show that the Fourier Transform of the
autocorrelation function of f(x) is the power spectrum |F(ω)|².
✅ Answer:
📖 Definition / Introduction
The relationship between the autocorrelation function and the power spectrum is one of the most
important results in signal processing, known as the Wiener-Khinchin theorem. It states that the
Fourier Transform of the autocorrelation of a function f(x) equals the power spectral density
(power spectrum) |F(ω)|², where F(ω) is the Fourier Transform of f(x). This theorem bridges
time/spatial domain correlation analysis with frequency domain energy distribution.
📝 Detailed Explanation
Key Point 1: Definitions
Fourier Transform of f(x): F(ω) = ∫[−∞ to +∞] f(x) · e^(−j2πωx) dx
7 IP_69
(This is the complex conjugate of the Fourier Transform)
= F*(ω) · F(ω)
Step 8: Therefore:
• This theorem allows us to compute the power spectrum either directly from F(ω)
or indirectly through the autocorrelation — whichever is more convenient.
Proof Flow:
R(τ) = ∫ f(x)·f*(x-τ) dx
FT{R(τ)} = ∫∫ f(x)·f*(x-τ)·e^(-j2πωτ) dx dτ
= ∫ f(x)·e^(-j2πωx) dx · ∫ f*(u)·e^(j2πωu) du
╰──────────────────╯ ╰──────────────────╯
= F(ω) = F*(ω)
8 IP_70
💡 Example
Consider a simple signal f(x) = cos(2πf₀x). Its Fourier Transform has impulses at ±f₀:
F(ω) = ½[δ(ω−f₀) + δ(ω+f₀)]. The power spectrum |F(ω)|² = ¼[δ(ω−f₀) + δ(ω+f₀)],
showing energy concentrated at frequency f₀. The autocorrelation R(τ) = ½cos(2πf₀τ),
and its Fourier Transform indeed gives the same power spectrum, confirming the
theorem.
🔚 Conclusion
The Wiener-Khinchin theorem establishes that the Fourier Transform of the
autocorrelation function of f(x) equals the power spectrum |F(ω)|². This fundamental
result connects the temporal/spatial self-similarity of a signal (autocorrelation) with its
frequency-domain energy distribution (power spectrum). The proof uses the
convolution-correlation properties of the Fourier Transform and the substitution
technique. This theorem is widely used in spectral analysis, noise characterization, and
image texture analysis.
📝 Detailed Explanation
Key Point 1: What is DCT?
The 1D DCT of a sequence f(x) of length N is defined as:
F(u) = α(u) Σ[x=0 to N−1] f(x) · cos[(2x+1)uπ / 2N], for u = 0, 1, ..., N−1
9 IP_71
The 2D DCT for an M × N image:
Key Properties:
• For typical natural images, the DCT concentrates most of the signal energy into
a few low-frequency coefficients (top-left corner of the coefficient matrix).
• The high-frequency coefficients are typically very small and can be quantized to
zero with minimal visual impact.
• Unlike DFT which produces complex numbers, DCT output is purely real,
simplifying storage and computation.
10 IP_72
• DCT implicitly assumes the signal is even-symmetric at boundaries, reducing
discontinuity artefacts (Gibbs phenomenon) that occur with DFT's periodic
extension.
11 IP_73
DCT Basis Functions (8×8):
u=0: [constant — DC]
u=1: [one half-cycle cosine — lowest frequency]
u=2: [one full-cycle cosine]
...
u=7: [3.5 cycles cosine — highest frequency]
💡 Example
In JPEG compression of a photograph: An 8×8 pixel block with pixel values averaging
around 128 is DCT-transformed. The DC coefficient F(0,0) ≈ 128 (average). Most
energy is in F(0,0), F(0,1), F(1,0), and a few others. The remaining ~55 coefficients are
very small. After quantization (dividing by a quantization matrix and rounding), these
small coefficients become zero. Storing only the non-zero coefficients (about 10–15 out
of 64) achieves roughly 75–85% compression with imperceptible quality loss.
🔚 Conclusion
The Discrete Cosine Transform is one of the most practically important transforms in
image processing. Its superior energy compaction for natural images, real-valued
output, and minimal boundary effects make it ideal for lossy image compression
(JPEG). The DCT is also fundamental to video compression (MPEG, H.264), audio
compression (MP3), and various image analysis tasks. Its role as the core of the JPEG
standard alone makes it arguably the most widely deployed transform in digital media.
📝 Detailed Explanation
Key Point 1: Basic Concept — Hough Transform for Lines
A straight line in the image space (x-y plane) can be represented in normal (polar)
form:
12 IP_74
ρ = x cos θ + y sin θ
where ρ is the perpendicular distance from the origin to the line, and θ is the angle of
the perpendicular with the x-axis.
Key Idea: Each point (xᵢ, yᵢ) in the image space maps to a sinusoidal curve in the
parameter space (ρ-θ plane). All points on the same straight line in the image will
produce sinusoidal curves that intersect at a single point (ρ₀, θ₀) in the parameter
space. This point identifies the line.
• Increment A(ρ, θ) by 1
4. Peak Detection: Find the cells in A(ρ, θ) with the highest values. Each peak
corresponds to a detected line.
5. Line Extraction: Map the peak (ρ₀, θ₀) back to the image space to draw the
detected line.
If the radius r is known, the parameter space is 2D (a, b), and each edge point votes for a
circle of potential centres.
13 IP_75
• Medical imaging: Detecting circular structures (cells, blood vessels).
Points on the same line → sinusoids pass through the same (ρ₀, θ₀)
💡 Example
In an autonomous vehicle system, a camera captures a road scene. After edge
detection, the Hough Transform is applied to detect straight lines. The accumulator
shows strong peaks at approximately θ = 30° and θ = 150° (corresponding to the left
and right lane markings converging toward the vanishing point). Despite occlusions by
other vehicles and imperfect edges, the Hough Transform reliably detects the lanes
because it uses a global voting mechanism that tolerates gaps in the edge data.
🔚 Conclusion
The Hough Transform is a powerful and robust technique for detecting parameterized
shapes (lines, circles, ellipses) in images. Its voting-based approach makes it resilient to
noise, gaps, and partial occlusions. For line detection, it uses the polar representation (ρ,
θ) and finds peaks in the 2D accumulator array. For circles and more complex shapes,
the parameter space dimensionality increases. The Hough Transform is widely applied
14 IP_76
in autonomous driving, document analysis, medical imaging, and industrial inspection,
making it one of the most practically important algorithms in computer vision.
📝 Detailed Explanation
Key Point 1: Global Processing via Hough Transform
The Hough Transform performs global processing because it considers all edge pixels
in the image simultaneously through a voting mechanism in the parameter space:
• Each edge pixel independently votes for all possible shapes (lines) passing
through it.
• The final result depends on the collective votes of all edge pixels, not just local
neighbourhood information.
• Can detect lines/shapes even when they are broken, noisy, or partially
occluded.
Disadvantage:
15 IP_77
• Peak detection can be challenging in noisy accumulator arrays.
Algorithm:
4. Update the region statistics (mean, variance) with the newly added pixel.
5. Repeat steps 2–4 until no more pixels can be added to any region.
16 IP_78
Q₂, Q₃, Q₄).
Split and Merge (combined approach): After splitting, adjacent sub-regions that
satisfy the homogeneity predicate when combined are merged to produce larger,
meaningful regions. This is the split-and-merge algorithm.
Region Growing:
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ S │ │ ░░░S░░ │ │ ░░░░░░░ │
│ │ → │ ░░░░░░ │ → │ ░░░░░░░ │
│ │ │ │ │ ░░░░░░░ │
└──────────────┘ └──────────────┘ └──────────────┘
S = seed pixel Grow from seed Region complete
(add similar (no more similar
neighbours) neighbours)
Comparison:
┌──────────────────┬────────────────┬────────────────┐
│ Feature │ Region Growing │ Region Splitting│
├──────────────────┼────────────────┼────────────────┤
│ Approach │ Bottom-up │ Top-down │
│ Starting point │ Seed pixels │ Entire image │
│ Direction │ Aggregation │ Subdivision │
│ Seed required? │ Yes │ No │
│ Region shape │ Irregular │ Rectangular │
│ Data structure │ Label map │ Quadtree │
└──────────────────┴────────────────┴────────────────┘
17 IP_79
💡 Example
Hough: In a satellite image, roads appear as broken straight lines due to tree cover. The
Hough Transform's global voting detects the roads despite gaps by finding peaks in the
accumulator.
Region Growing: In a medical ultrasound image, a seed is placed inside the liver. The
algorithm grows outward, adding pixels with similar grey levels, until the entire liver
region is segmented.
Region Splitting: In a landscape image, the entire image is split into quadrants. The sky
quadrant is homogeneous (uniform blue) and is not split further. The ground quadrant
has mixed textures and is split recursively until sub-regions contain homogeneous
patches (grass, road, buildings).
🔚 Conclusion
The Hough Transform provides global shape detection by accumulating evidence from
all edge pixels into a parameter space, making it robust to noise and gaps. Region
growing and region splitting offer complementary approaches to image segmentation —
region growing is a bottom-up approach that aggregates similar pixels from seeds, while
region splitting is a top-down approach that recursively subdivides the image. The
combined split-and-merge algorithm leverages the strengths of both, producing accurate
segmentations with clean boundaries.
18 IP_80
📝 Detailed Explanation
Key Point 1: Connectivity
Connectivity between pixels is fundamental to defining regions, boundaries, and
components in a digital image. Two pixels are connected if:
2. Their intensity values satisfy some similarity criterion (both belong to a set of
values V).
A connected component is a maximal set of pixels such that any two pixels in the set
can be connected by a path of adjacent, similar-valued pixels.
4-adjacency defines the strictest connectivity — only horizontal and vertical neighbours
count.
(ii) q is in Nᴅ(p) (diagonal neighbour) AND the set N₄(p) ∩ N₄(q) contains no pixels
with values from V.
19 IP_81
Feature 8-Connectivity m-Connectivity
Definition Uses 8-adjacency (all 8 Uses m-adjacency (4-adj +
neighbours) restricted diagonal)
Ambiguity Can create ambiguous multiple Eliminates ambiguity — unique
paths paths
Diagonal links Always allowed Allowed only when no V-
valued 4-neighbours exist in
common
Path thickness Can produce thick (multi-pixel Produces thin (single-pixel
wide) paths wide) paths
Components May merge separate Correctly separates components
components
Example A 2×2 block of 1s: all 4 pixels Same block: only 4 m-
are mutually 8-connected connections (eliminating
(4×3/2=6 links) redundant diagonals)
(x-1,y) (x-1,y-1)(x-1,y)(x-1,y+1)
│ \ | /
(x,y-1)─p─(x,y+1) (x,y-1)── p ──(x,y+1) Same as 8-adj BUT
│ / | \ diagonals only if
(x+1,y) (x+1,y-1)(x+1,y)(x+1,y+1) no V-valued common
4-neighbour exists
💡 Example
In a binary image with V = {1}, consider pixels p(1,0)=1, q(0,1)=1, r(1,1)=1:
20 IP_82
• 8-adjacency: p and q are 8-adjacent (diagonally). p and r are 4-adjacent. q and r
are 4-adjacent. All three are mutually connected, forming a triangle with
multiple paths: p→q, p→r→q.
• m-adjacency: Check p and q: they are diagonal neighbours. But N₄(p) ∩ N₄(q)
= {r}, and r has value 1 ∈ V. So p and q are NOT m-adjacent. The only path
from p to q is p→r→q (through r). This eliminates the ambiguous diagonal
connection and produces a clean, single path.
🔚 Conclusion
Adjacency and connectivity are foundational concepts in digital image processing. 4-
adjacency is the most restrictive (only horizontal/vertical neighbours), 8-adjacency is
the most permissive (includes diagonals), and m-adjacency (mixed) provides a middle
ground by allowing diagonal connections only when they don't create ambiguity. m-
connectivity eliminates the multiple-path problem of 8-connectivity, producing unique,
unambiguous paths between pixels, which is essential for consistent region labelling,
boundary tracing, and component analysis.
📝 Detailed Explanation
Key Point 1: Properties of a Distance Function (Metric)
A function D(p, q) is a valid distance measure (metric) if for any pixels p, q, r:
Example: D_E between p(1, 2) and q(4, 6): D_E = √[(1−4)² + (2−6)²] = √[9 + 16] =
√25 = 5
• Computationally simple.
22 IP_84
diagonal moves (e.g., 1 for 4-adj, √2 for diagonal).
Relationship: D₈ ≤ Dₑ ≤ D₄ (always)
💡 Example
In a morphological dilation operation with a structuring element of radius 3:
• Dₑ = √(9+16) = 5.0
• D₄ = 3 + 4 = 7
• D₈ = max(3, 4) = 4
🔚 Conclusion
The three fundamental distance measures in digital images — Euclidean, City-block,
and Chessboard — each produce different distance values and equidistant contour
shapes (circles, diamonds, and squares respectively). The choice of distance measure
affects the results of many image processing operations including morphological
processing, region growing, and distance transforms. The relationship D₈ ≤ Dₑ ≤ D₄
always holds. Euclidean distance is most geometrically accurate, while City-block and
Chessboard distances are computationally simpler and produce integer results.
📝 Detailed Explanation
Key Point 1: Unitary Transform
A transform matrix A of size N × N is unitary if:
A · Aᴴ = Aᴴ · A = Iₙ
1D Unitary Transform: Given a vector f = [f(0), f(1), ..., f(N−1)]ᵀ, the forward
transform is:
F=A·f
f = Aᴴ · F = A⁻¹ · F
In element form: F(u) = Σ[x=0 to N−1] a(u, x) · f(x), where a(u, x) are elements of A.
F = A · f · Bᵀ
where A (M×M) and B (N×N) are unitary matrices. The inverse is:
f = Aᴴ · F · (Bᵀ)ᴴ = Aᴴ · F · B*
Then: F(u) = (1/√N) Σ[x=0 to N−1] f(x) · e^(−j2πux/N), for u = 0, 1, ..., N−1
Inverse 1D DFT: Since A is unitary (A⁻¹ = Aᴴ), the inverse kernel is:
[Aᴴ · A](x₁, x₂) = (1/N) Σ[u=0 to N−1] W^(−ux₁) · W^(ux₂) = (1/N) Σ[u] W^(u(x₂−x₁))
25 IP_87
Key Point 3: 2D Fourier Transform (Derivation)
For an image f(x, y) of size M × N, the 2D DFT is derived as a separable extension of
the 1D DFT.
Forward 2D DFT:
= 1D DFT along columns (inner sum), then 1D DFT along rows (outer sum).
Inverse 2D DFT:
where A_M and A_N are the M×M and N×N DFT matrices respectively.
Separability of 2D DFT:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ f(x,y) │ → │ 1D DFT │ → │ 1D DFT │ → F(u,v)
│ (Image) │ │ along │ │ along │
└──────────┘ │ columns │ │ rows │
└──────────┘ └──────────┘
Summary Table:
┌──────────────────┬────────────────────────────┬────────────────────────────┐
│ Transform │ Forward │ Inverse │
├──────────────────┼────────────────────────────┼────────────────────────────┤
│ 1D Unitary │ F = A·f │ f = Aᴴ·F │
│ 2D Unitary │ F = A·f·Bᵀ │ f = Aᴴ·F·B* │
│ 1D DFT │ F(u)=(1/√N)Σf(x)W^(ux) │ f(x)=(1/√N)ΣF(u)W^(-ux) │
│ 2D DFT │ Separable: rows then cols │ Separable: rows then cols │
└──────────────────┴────────────────────────────┴────────────────────────────┘
26 IP_88
💡 Example
For N = 4, the DFT matrix is:
Verify unitarity: A · Aᴴ = I₄ ✓
🔚 Conclusion
A unitary transform is characterized by its transformation matrix satisfying A⁻¹ = Aᴴ,
which ensures energy preservation (Parseval's theorem). The Fourier Transform is the
most important unitary transform in image processing, with its kernel being complex
exponentials. The 1D DFT transforms N-point signals with O(N²) operations (or O(N
log N) with FFT), and the 2D DFT extends this to images through separability —
applying 1D DFTs sequentially along rows and columns. The inverse transforms use
conjugated kernels to recover the original signal/image.
📝 Detailed Explanation
Key Point 1: Hadamard Transform
The Hadamard Transform is a non-sinusoidal, orthogonal transform that uses a square
wave basis functions with values of +1 and −1 only.
27 IP_89
H₁ = [1]
Properties:
28 IP_90
Key Point 3: Piecewise Linear Transformation
Piecewise linear transformation is an intensity transformation technique where the
transfer function T(r) is composed of multiple straight-line segments rather than a
single mathematical function.
The input intensity range [0, L−1] is divided into segments, and each segment has its
own linear mapping:
Common types:
Steps:
4. Form the transformation matrix A = [e₁, e₂, ..., eₙ]ᵀ (eigenvectors as rows).
5. Transform: y = A · (x − m)
Properties:
29 IP_91
• The transformed components are uncorrelated (covariance matrix becomes
diagonal).
• Keeping only the first P components (P << n) gives the best P-dimensional
approximation.
Hotelling Transform:
Original Data Transformed Data
(correlated) (decorrelated)
y₂ ↑ ●●● y₂' ↑
│ ●●●● │ ●
│●●●●●● PCA │ ● ● ●
│●●●●● ────→ │ ● ● ● ● ●
│●●●● │ ● ● ●
│●●● │ ●
└──────→ y₁ └──────────→ y₁'
(Tilted cloud) (Aligned to axes)
Comparison:
┌──────────────────┬──────────────┬──────────────────┐
│ Transform │ Basis │ Key Feature │
├──────────────────┼──────────────┼──────────────────┤
│ Hadamard │ +1, -1 waves │ Fast, no multiply│
│ Walsh │ +1, -1 waves │ Sequency ordered │
│ Piecewise Linear │ Line segments│ Flexible mapping │
30 IP_92
│ Hotelling (PCA) │ Eigenvectors │ Optimal compaction│
└──────────────────┴──────────────┴──────────────────┘
💡 Example
Hadamard/Walsh: Transform a 4-pixel row [150, 100, 80, 120] using H₄ — the result
separates average (DC) from detail components using only additions/subtractions.
Piecewise Linear: An under-exposed photograph has most pixels in range [30, 80]. A
piecewise linear function maps [0, 30]→[0, 10], [30, 80]→[10, 245], [80, 255]→[245,
255], stretching the useful range dramatically.
Hotelling: In face recognition (Eigenfaces), a dataset of 100 face images (each 100×100
= 10,000 pixels) is treated as 10,000-dimensional vectors. PCA finds the top 50
eigenvectors (eigenfaces) that capture 95% of the variance, reducing each face to just 50
numbers while preserving recognition accuracy.
🔚 Conclusion
The Hadamard and Walsh Transforms provide computationally efficient frequency
analysis using rectangular basis functions (+1, −1), differing only in row ordering.
Piecewise linear transformation offers flexible, user-defined intensity mapping for
image enhancement through multiple linear segments. The Hotelling Transform
(PCA/KLT) provides statistically optimal decorrelation and dimensionality reduction by
projecting data onto eigenvectors of the covariance matrix. Each serves a distinct
purpose: Hadamard/Walsh for fast transform-based processing, piecewise linear for
targeted enhancement, and Hotelling for optimal compression and feature extraction.
31 IP_93
📝 Detailed Explanation
Key Point 1: What is Contrast Stretching?
Contrast stretching works by applying a linear or piecewise linear transformation that
maps the existing intensity range [r_min, r_max] to the full range [0, L−1]:
where r is the input intensity, s is the output intensity, and L = 256 for 8-bit.
Piecewise Linear Contrast Stretching: Uses breakpoints (r₁, s₁) and (r₂, s₂) to define
three segments:
The result: pixel values are clustered in a narrow band, and the image appears washed
out, flat, or dull.
Output (s)
255 ┤ ╱─────────
│ ╱
│ ╱ ← slope > 1 (stretching)
│ ╱
│ ╱
s₂ ┤ - - - - - - - -╱
│ ╱
│ ╱
s₁ ┤ - - - - - -╱
│ ╱╱ ← slope < 1 (compression)
0 ┤────────╱╱
└──┬────┬─────┬──────→ Input (r)
0 r₁ r₂ 255
Histogram Comparison:
33 IP_95
💡 Example
A photograph taken in heavy fog has all pixel values in the range [80, 160] — the image
looks uniformly grey with no discernible details. Applying contrast stretching:
The stretched image now uses the full 0–255 range, revealing details previously hidden
in the narrow grey band. Trees, buildings, and roads that were barely visible in the
foggy image become clearly distinguishable.
🔚 Conclusion
Contrast stretching is a simple but effective intensity transformation that maps a narrow
range of pixel values to the full dynamic range, dramatically improving the visual
quality of low-contrast images. Low-contrast images have narrow histograms and
appear flat and dull, while enhanced images have spread-out histograms and display
vivid, clearly distinguishable details. The technique preserves the image's information
content while improving its presentation, making it one of the most commonly used
enhancement operations in digital image processing.
🎓 Documen
34 IP_96
📘 [Link] 6th Semester — Exam Preparation
Author: Rishav Raj | Semester: 6th Sem | Subject: Image Processing — Image Enhancement |
Marks per Answer: 5–10 Marks
📝 Detailed Explanation
Key Point 1: Image Enhancement vs. Image Restoration
Image Enhancement: The process of manipulating an image so that the result is more
suitable for a specific application than the original. It is subjective — there is no unique
"correct" output. Techniques include contrast stretching, histogram equalization,
sharpening, and smoothing.
Image Restoration: The process of recovering an image that has been degraded by a
known or estimated degradation function. It is objective — based on
mathematical/statistical models of the degradation process. Techniques include inverse
filtering, Wiener filtering, and constrained least-squares filtering.
1 IP_97
Feature Image Enhancement Image Restoration
Goal Improve visual quality Recover original image
Approach Subjective, heuristic Objective, model-based
Knowledge needed None about degradation Degradation model required
Evaluation Visual (human judgement) Mathematical (MSE, PSNR)
Techniques Histogram eq., sharpening Wiener filter, inverse filter
Result May not look like original Approximates the original
s = (L − 1) − r
Algorithm:
1. Define a window (typically 3×3, 5×5, or 7×7) centred on pixel (x, y).
4. Replace the centre pixel with the middle value (median) of the sorted list.
Properties:
2 IP_98
• Does NOT blur edges (unlike mean/averaging filters).
• The output value is always an existing pixel value (no new values created).
• For an n×n window, the median is at position (n²+1)/2 in the sorted list.
┌─────┬─────┬─────┐
│ 10 │ 15 │ 20 │
├─────┼─────┼─────┤
│ 25 │ 200 │ 30 │ ← centre pixel = 200 (noise spike)
├─────┼─────┼─────┤
│ 22 │ 18 │ 28 │
└─────┴─────┴─────┘
Sorted values: {10, 15, 18, 20, 22, 25, 28, 30, 200}
Median = 5th value = 22
The noisy pixel 200 is replaced by 22 — noise effectively removed!
Key Point 5: Grey-Level Slicing
Grey-level slicing (intensity-level slicing) highlights a specific range of grey levels in
an image. Two approaches:
Application: Highlighting specific features like water bodies (specific grey range) in
satellite imagery, or specific tissue types in medical images.
3 IP_99
Median Filter vs. Mean Filter:
┌──────────────┬───────────────────┬───────────────────┐
│ Feature │ Median Filter │ Mean Filter │
├──────────────┼───────────────────┼───────────────────┤
│ Type │ Non-linear │ Linear │
│ Noise type │ Salt & pepper │ Gaussian noise │
│ Edge preserv.│ Good │ Poor (blurs edges)│
│ New values? │ No │ Yes (averages) │
│ Speed │ Slower (sorting) │ Faster │
└──────────────┴───────────────────┴───────────────────┘
Grey-Level Slicing:
(a) Without background: (b) With background:
s ↑ s ↑
L ┤ ████ L ┤ ████
│ ████ │ ╱████╲
│ ████ │ ╱ ████ ╲
0 ┤────── ────── 0 ┤───╱ ╲───
└──┬───A──B─┬───→ r └──┬───A──B──┬──→ r
💡 Example
A chest X-ray image has low contrast in the lung region. Applying the image negative
makes subtle white lesions in the dark lung fields more visible. A median filter (5×5)
removes salt-and-pepper noise from a scanned document without blurring the text
edges. Grey-level slicing with range [100, 150] on a satellite image highlights water
bodies that have grey levels in this range.
🔚 Conclusion
Image enhancement and restoration are two complementary approaches —
enhancement improves visual quality subjectively, while restoration recovers degraded
images objectively. The median filter is the preferred tool for salt-and-pepper noise
removal due to its edge-preserving property. Image negatives reverse intensities using s
= (L−1) − r, useful for revealing details in dark regions. Grey-level slicing highlights
specific intensity ranges for targeted analysis, available with or without background
preservation.
4 IP_100
❓ Question 2: Discuss the limiting effect of repeatedly applying
a 3×3 spatial filter to a digital image. What is the equation of
the Wiener filter used to reconstruct an image blurred by this
type of degradation? What is Wiener filtering?
✅ Answer:
📖 Definition / Introduction
When a 3×3 spatial averaging (smoothing) filter is applied repeatedly to a digital image, it
produces progressively greater blurring that eventually converges to a uniform (constant) image.
The Wiener filter (also called the minimum mean square error filter) is the optimal linear filter for
restoring images degraded by such blurring in the presence of noise. It balances noise reduction
against deblurring.
📝 Detailed Explanation
Key Point 1: Limiting Effect of Repeated 3×3 Filtering
When a 3×3 averaging filter (each weight = 1/9) is applied once, each pixel becomes
the average of its 9 neighbours — moderate smoothing/blurring occurs.
Repeated application:
• 2nd application: More blur. Effective neighbourhood = 5×5 (each output pixel
is influenced by a 5×5 region of the original).
Key insight: Each application of the 3×3 filter is equivalent to a convolution in the
spatial domain (multiplication in the frequency domain). The k-th application gives an
effective filter H_eff(u,v) = [H(u,v)]^k, which approaches zero for all non-DC
frequencies.
5 IP_101
finds the estimate f̂ of the original image that minimizes the mean square error E{|f −
f̂|²}.
Or equivalently:
Where:
• When noise dominates (S_η >> S_f · |H|²): Wiener filter acts as a smoothing
filter, suppressing noise.
• It never amplifies noise as the inverse filter does at frequencies where |H| is
small.
6 IP_102
📊 Diagram / Table (if applicable)
Repeated Application of 3×3 Averaging Filter:
In frequency domain:
|H_eff(u,v)| = |H(u,v)|^k → 0 for (u,v) ≠ (0,0) as k → ∞
Wiener Filter:
F̂ (u,v) = H*(u,v) · G(u,v) ← combines inverse filtering
───────────────── and noise suppression
|H|² + S_η/S_f
💡 Example
An image blurred by 5 repeated applications of a 3×3 averaging filter has an effective
PSF approximately equal to an 11×11 Gaussian. To restore it, the Wiener filter is
applied in the frequency domain: G(u,v) is computed via FFT, the known H(u,v) =
[H₃ₓ₃(u,v)]⁵ is used, and the NSR K is estimated (e.g., K = 0.01). The result F̂ = H*G/(|
H|²+0.01) recovers most of the lost detail while keeping noise amplification under
control.
🔚 Conclusion
Repeated application of a 3×3 spatial averaging filter progressively blurs the image,
with the effective neighbourhood growing as (2k+1)×(2k+1), until the image converges
to a uniform constant (the mean grey level). The Wiener filter is the optimal linear
restoration filter that minimizes mean square error by balancing deblurring against noise
amplification. Its equation F̂ (u,v) = H*G/(|H|²+S_η/S_f) elegantly reduces to inverse
filtering when noise is absent and to smoothing when noise dominates.
7 IP_103
❓ Question 3: Explain unsharp masking and high-boost
filtering. What is the expression of the Laplacian operator for
an image of two variables?
✅ Answer:
📖 Definition / Introduction
Unsharp masking and high-boost filtering are image sharpening techniques that enhance edges
and fine details by emphasizing high-frequency components. The Laplacian operator is a second-
order derivative operator used for edge detection and image sharpening, defined as the sum of
second partial derivatives.
📝 Detailed Explanation
Key Point 1: Unsharp Masking
Unsharp masking sharpens an image by subtracting a blurred (smoothed) version from
the original:
Step 1: Blur the original image f(x,y) to get f̄ (x,y) (using a Gaussian or averaging filter).
Step 2: Subtract the blurred image from the original to get the mask (detail/high-
frequency component): g_mask(x,y) = f(x,y) − f̄ (x,y)
Step 3: Add the mask back to the original: g(x,y) = f(x,y) + k · g_mask(x,y)
The "unsharp" in the name refers to the blurred image used in the process — it is the
"unsharp" version.
Special cases:
8 IP_104
• A >> 1: Result approaches the original image (little enhancement).
High-boost filtering provides more control over the sharpening level than simple
unsharp masking.
[ 0 1 0] or including diagonals: [ 1 1 1]
[ 1 -4 1] (8-neighbour Laplacian) [ 1 -8 1]
[ 0 1 0] [ 1 1 1]
Image sharpening using Laplacian: g(x,y) = f(x,y) − ∇²f(x,y) (if centre coefficient is
negative) g(x,y) = f(x,y) + ∇²f(x,y) (if centre coefficient is positive)
High-Boost Filtering:
f(x,y) ──→ × A ──→ (−) ──→ g(x,y) = A·f − f̄
↑
f(x,y) ──→ [Blur] ──→ f̄ (x,y)
Laplacian Kernels:
4-neighbour: 8-neighbour: Negative centre:
[ 0 1 0] [ 1 1 1] [ 0 -1 0]
[ 1 -4 1] [ 1 -8 1] [-1 4 -1]
[ 0 1 0] [ 1 1 1] [ 0 -1 0]
Comparison:
┌─────────────────┬─────────────────┬──────────────────┐
│ Technique │ Formula │ Control Parameter│
├─────────────────┼─────────────────┼──────────────────┤
│ Unsharp masking │ g = f + k(f−f̄ ) │ k (mask weight) │
9 IP_105
│ High-boost │ g = Af − f̄ │ A (amplification)│
│ Laplacian │ g = f − ∇²f │ None (fixed) │
└─────────────────┴─────────────────┴──────────────────┘
💡 Example
A blurry photograph is sharpened using unsharp masking: a 5×5 Gaussian blur creates f̄ ,
the mask g_mask = f − f̄ contains edges and details, and adding k=1.5 times the mask
back produces a noticeably sharper image. The Laplacian ∇²f of the same image reveals
all edges (positive and negative intensity transitions), and adding f + ∇²f enhances edge
contrast.
🔚 Conclusion
Unsharp masking enhances details by subtracting a blurred version and adding the high-
frequency mask back. High-boost filtering generalizes this by introducing an
amplification factor A for more control. The Laplacian operator ∇²f = ∂²f/∂x² + ∂²f/∂y²
provides isotropic (direction-independent) second-order edge detection and can be
implemented as a 3×3 kernel with centre coefficient −4 or −8. All three techniques serve
the common purpose of image sharpening by emphasizing high-frequency content.
📝 Detailed Explanation
Key Point 1: Spatial Filtering
Spatial filtering operates directly on the pixel values of an image by moving a filter
mask (kernel) across the image and computing a new pixel value at each position based
on the mask coefficients and the neighbourhood pixel values.
Process:
10 IP_106
1. A mask (kernel) of size m × n is placed over each pixel (x, y).
2. The mask coefficients are multiplied with the corresponding pixel values.
3. The products are summed (for linear filters) to produce the output at (x, y).
Types:
(b) Weighted Averaging Filter: Centre pixel gets more weight than neighbours:
(1/16) × [1 2 1; 2 4 2; 1 2 1]
Properties:
• Computationally simple (O(m×n) per pixel, or O(1) with integral images for box
filters).
11 IP_107
• Bit 7 (MSB — Most Significant Bit): Carries the most visual information.
Contains the coarse structure of the image.
• Bit 0 (LSB — Least Significant Bit): Contains the least visual information.
Appears as random noise.
Extraction: Bit plane i of pixel value v = (v >> i) & 1 (bitwise shift and AND).
Applications:
• Image compression: Discard lower bit planes (e.g., keeping only top 4–5
planes).
Smoothing Kernels:
Box Filter: Weighted Average: Gaussian (approx):
┌───┬───┬───┐ ┌───┬───┬───┐ ┌───┬───┬───┐
│1/9│1/9│1/9│ │1 │ 2 │ 1 │ ×1/16 │ 1 │ 2 │ 1 │ ×1/16
├───┼───┼───┤ ├───┼───┼───┤ ├───┼───┼───┤
│1/9│1/9│1/9│ │2 │ 4 │ 2 │ │ 2 │ 4 │ 2 │
├───┼───┼───┤ ├───┼───┼───┤ ├───┼───┼───┤
│1/9│1/9│1/9│ │1 │ 2 │ 1 │ │ 1 │ 2 │ 1 │
└───┴───┴───┘ └───┴───┴───┘ └───┴───┴───┘
12 IP_108
Visual Contribution:
Plane 7 > Plane 6 > ... > Plane 1 > Plane 0
(Coarse) (Fine/Noise)
💡 Example
A noisy medical image is filtered using a 5×5 Gaussian smoothing filter (σ=1.0). The
noise is significantly reduced, though edges become slightly blurred. Bit-plane slicing
of a portrait image shows: Plane 7 captures the face outline and major features, Planes 5
–6 add medium details, and Planes 0–2 appear as random noise. A watermark is
embedded in Plane 0 (LSB) — changing the least significant bit by 1 produces an
imperceptible change (intensity changes by at most 1 out of 255).
🔚 Conclusion
Spatial filtering applies kernels directly to pixel neighbourhoods — smoothing filters
reduce noise through averaging while blurring edges. The Gaussian filter provides the
smoothest results among linear smoothing filters. Bit-plane slicing decomposes an
image into its binary components, revealing that the MSB planes carry most visual
information while LSB planes appear noise-like. These concepts are fundamental to
understanding noise reduction, image compression, and data hiding in digital images.
📝 Detailed Explanation
Key Point 1: Spatial Domain Representation
In the spatial domain, a digital image is represented as a 2D function f(x, y), where:
13 IP_109
• f(x, y) is the intensity/grey level at that location.
The image is a matrix of M rows × N columns, with each element being a pixel value.
Key Observation: The IDFT can be computed using the forward DFT as follows:
Derivation:
Algorithm:
14 IP_110
3. Conjugate the result
4. Divide by N
This means we can use the same FFT routine for both forward and inverse transforms!
F(u) ──→ [Conjugate] ──→ F*(u) ──→ [Forward DFT/FFT] ──→ G(x)
│
[Conjugate + ÷N]
│
↓
f(x)
Proof Summary:
IDFT{F(u)} = f(x) = Σ F(u)·e^(j2πux/N)
Conjugate:
f*(x) = Σ F*(u)·e^(-j2πux/N) = N · DFT{F*(u)}
Therefore:
f(x) = (1/N) · [DFT{F*(u)}]*
💡 Example
Given F(u) = {4, 1−j, 0, 1+j} for N=4:
4. Divide by N = 4
This gives f(x) = {1, 2, 1, 0} — the original sequence, computed entirely using the
forward FFT algorithm.
15 IP_111
🔚 Conclusion
The spatial domain represents images as matrices of pixel values at discrete coordinates,
and spatial domain operations work directly on these values. The elegant relationship
between forward and inverse DFT allows the IDFT to be computed using the same FFT
algorithm: f(x) = (1/N)[DFT{F*(u)}]*. This saves implementation effort and memory,
as only one FFT routine is needed for both directions of transformation.
📝 Detailed Explanation
Key Point 1: Spatial-Domain Techniques
Operations performed directly on the pixel values f(x, y) of the image.
Types:
Application: The mask is centred on each pixel (x, y). Each mask coefficient is
multiplied by the corresponding image pixel, and all products are summed to produce
the output at (x, y):
Common kernels:
17 IP_113
Feature Spatial Domain Frequency Domain
Filter design Specify kernel coefficients Specify frequency response
curve
Intuition Direct — see effect on pixels Indirect — think in frequencies
Computation (small kernel) Fast (O(m×n per pixel)) Slower (FFT overhead)
Computation (large kernel) Slow (O(m×n grows) Fast (always O(N log N))
Flexibility Non-linear filters possible Primarily linear filters
Visualization Kernel coefficients Magnitude spectrum
Best for Small kernels, non-linear ops Large kernels, freq. analysis
Frequency-Domain Filtering:
f(x,y) ──→ [DFT] ──→ F(u,v) ──→ [× H(u,v)] ──→ G(u,v) ──→ [IDFT] ──→ g(x,y)
|H(u,v)|
1 ┤ ╱───── High-pass
│ ╱
│───────╱
0 ┤ → D(u,v)
💡 Example
Spatial domain: A 3×3 averaging kernel is convolved with a noisy image — simple,
fast, direct. Frequency domain: The same smoothing can be achieved by computing
the FFT of the image, multiplying by a Gaussian low-pass filter H(u,v) = e^(−D²/2D₀²),
and computing the IFFT. For large kernels (e.g., 51×51), the frequency-domain
approach is much faster because FFT complexity O(N²logN) doesn't depend on kernel
size.
🔚 Conclusion
Spatial-domain techniques operate directly on pixels using kernels (masks), offering
18 IP_114
simplicity and supporting non-linear operations. Frequency-domain techniques
transform the image, multiply by a filter function, and transform back, offering
computational advantages for large kernels and intuitive frequency-based filter design.
The Convolution Theorem guarantees equivalence: spatial convolution equals frequency
multiplication. The choice between them depends on kernel size, filter type (linear/non-
linear), and computational requirements.
📝 Detailed Explanation
Key Point 1: Quad-tree
A Quad-tree is a tree data structure in which each internal node has exactly four
children, representing the four quadrants (NW, NE, SW, SE) of a 2D region.
Construction:
Depth of the tree depends on image size: for a 2^n × 2^n image, maximum depth = n.
Characteristics:
• PDF: p(z) = P_a for z = 0 (pepper), P_b for z = 255 (salt), 0 otherwise.
• Best filter: Median filter (not mean filter — mean would blur the entire image).
Characteristics:
• High frequency: Regions where intensity changes rapidly (edges, fine details,
textures, noise). Found far from the centre of the frequency spectrum.
20 IP_116
• Measured in pixels per unit length (PPI, DPI) or line pairs per unit distance.
Grey-Level Resolution:
• Determined by the number of bits per pixel (k): L = 2^k grey levels.
Noise Types:
Salt-and-Pepper: Gaussian:
┌──────────────┐ ┌──────────────┐
│ · ● · · ○ │ │ ~ ~ ~ ~ ~│
│ · · · ● · │ ● = salt │ ~ ~ ~ ~ ~│ ~ = slight random
│ ○ · · · · │ ○ = pepper │ ~ ~ ~ ~ ~│ perturbation on
│ · · ○ · ● │ │ ~ ~ ~ ~ ~│ ALL pixels
└──────────────┘ └──────────────┘
Image Frequency:
Low freq. (smooth) High freq. (edges/detail)
░░░░░░░░░░░░░░░ ░█░█░█░█░█░█
░░░░░░░░░░░░░░░ █░█░█░█░█░█░
░░░░░░░░░░░░░░░ ░█░█░█░█░█░█
(Slowly changing) (Rapidly changing)
💡 Example
A scanned document with transmission errors has salt-and-pepper noise — random
black and white dots. A 3×3 median filter removes them effectively. A low-light
photograph has Gaussian noise — a grainy appearance over the entire image. A
21 IP_117
Gaussian smoothing filter (σ=1.5) reduces this noise. In the frequency spectrum of a
landscape photo, the sky region contributes low frequencies (smooth) while tree
branches contribute high frequencies (edges).
🔚 Conclusion
Quad-trees provide an efficient hierarchical representation for subdividing images. Salt-
and-pepper noise consists of isolated extreme-value pixels best removed by median
filtering, while Gaussian noise affects all pixels and is best reduced by averaging or
Gaussian filtering. Image frequency describes how quickly intensity values change
spatially. Spatial resolution (pixels per inch) and grey-level resolution (bits per pixel)
together define the quality of a digital image, with a fundamental trade-off between the
two for a fixed storage budget.
📝 Detailed Explanation
Key Point 1: Illumination-Reflectance Model
An image f(x, y) can be modelled as:
where:
The challenge: i and r are multiplied, not added, so they cannot be separated by linear
22 IP_118
filtering directly.
s(x,y) = IDFT{S(u,v)}
g(x,y) = e^(s(x,y))
Filter function:
23 IP_119
Homomorphic Filter Transfer Function:
H(u,v)
γ_H ┤ ─────────────── (enhance reflectance)
│ ╱
│ ╱
│ ╱
γ_L ┤──────╱ (compress illumination)
│
└──────┬──────────────→ D(u,v) (frequency distance)
D₀
💡 Example
A photograph taken in a room with a bright window: the area near the window is over-
exposed while the room interior is dark. Applying homomorphic filtering with γ_L =
0.3 and γ_H = 1.5: the logarithm separates illumination (slowly varying bright/dark)
from reflectance (object details). The filter attenuates the low-frequency illumination
variations (making brightness more uniform) and enhances high-frequency reflectance
(making interior objects clearer). The result shows both the window view and interior
details clearly.
Applications:
• Correcting uneven illumination in photographs and microscopy images.
🔚 Conclusion
Homomorphic filtering elegantly handles the multiplicative nature of the illumination-
reflectance model by applying a logarithm (converting multiplication to addition),
filtering in the frequency domain to separately control low frequencies (illumination)
and high frequencies (reflectance), and exponentiating the result. The filter
24 IP_120
simultaneously compresses dynamic range (γ_L < 1) and enhances local contrast (γ_H >
1), making it invaluable for images with uneven lighting conditions.
📝 Detailed Explanation
Key Point 1: Image Histogram
An image histogram h(rₖ) plots the number of pixels nₖ at each intensity level rₖ (k = 0,
1, ..., L−1).
Histogram characteristics:
25 IP_121
• To produce images that are perceptually better for human viewers.
5. Apply the mapping: Replace each pixel with intensity rₖ by the new value sₖ.
The result: the histogram of the output image is approximately uniform (flat), meaning
all intensity levels are approximately equally represented.
Steps:
This allows specific histogram shapes (e.g., bimodal, Gaussian) to be imposed on the
image.
F(0,0) = (1/MN) Σ[x] Σ[y] f(x,y) = mean intensity × MN (with appropriate scaling)
1 2 3 4
5 6 7 8
1 3 5 7
2 4 6 8
26 IP_122
Sum = 1+2+3+4+5+6+7+8+1+3+5+7+2+4+6+8 = 72
F(0,0) = (1/16) × 72 = 4.5 (mean intensity)
or with different DFT convention: F(0,0) = 72 (the raw sum).
Histogram Specification:
Input Image → T(r) → CDF_input → G⁻¹() → Matched Output
Target Histogram → G(z) → CDF_target ──────┘
DC Component:
F(0,0) = (1/MN) Σ Σ f(x,y) = Mean intensity of the image
💡 Example
Numerical — Histogram Equalization (3-bit, L=8):
rₖ nₖ p(rₖ) CDF sₖ =
round(7×CDF)
0 790 0.19 0.19 1
1 1023 0.25 0.44 3
2 850 0.21 0.65 5
3 656 0.16 0.81 6
4 329 0.08 0.89 6
5 245 0.06 0.95 7
6 122 0.03 0.98 7
7 81 0.02 1.00 7
27 IP_123
Mapping: 0→1, 1→3, 2→5, 3→6, 4→6, 5→7, 6→7, 7→7. The equalized histogram is
more spread out across levels 1, 3, 5, 6, 7.
🔚 Conclusion
Image histograms are fundamental tools for understanding intensity distributions.
Histogram equalization uses the CDF as a transformation function to redistribute
intensities uniformly, maximizing contrast. Histogram specification extends this by
allowing any desired output distribution. The DC component F(0,0) directly represents
the average image intensity. These techniques are essential for image enhancement,
normalization, and as preprocessing steps for further analysis.
📝 Detailed Explanation
Key Point 1: Prewitt Operator
The Prewitt operator uses two 3×3 kernels to compute the gradient in the x and y
directions:
Gx (horizontal edges):
[-1 0 1]
[-1 0 1]
[-1 0 1]
Gy (vertical edges):
[-1 -1 -1]
[ 0 0 0]
[ 1 1 1]
Gx:
[-1 0 1]
[-2 0 2]
[-1 0 1]
Gy:
[-1 -2 -1]
[ 0 0 0]
[ 1 2 1]
Smoothing in Sobel:
• Gx = [-1 0 1]ᵀ × [1 2 1] (derivative along x, weighted averaging along y)
• Gy = [1 2 1]ᵀ × [-1 0 1] (derivative along y, weighted averaging along x)
• The weighted average [1 2 1] is a Gaussian-like smoothing filter (more weight to the centre
pixel), providing better noise reduction than the uniform [1 1 1] in Prewitt.
• This gives the Sobel operator a slight advantage over Prewitt in noisy conditions.
Key Point 3: How Smoothing Reduces Noise Effect
• Noise creates random, isolated intensity variations.
• Simple finite differences (e.g., [−1 0 1]) amplify noise because derivatives
enhance high-frequency content.
• Result: More robust edge detection with fewer false edge detections due to
noise.
💡 Example
Consider a noisy horizontal edge. Without smoothing, the derivative [−1 0 1] applied to
a single row detects the edge but also responds strongly to noise. The Sobel Gx kernel
averages 3 rows with weights [1 2 1] before differencing, so if one row has a noise
spike (e.g., value 250 instead of 100), the averaged value across 3 rows dilutes this
spike to approximately (100+250+100)/4 = 137.5, significantly reducing its impact on
the gradient computation.
🔚 Conclusion
Both Prewitt and Sobel operators achieve noise reduction through their inherent design:
each kernel is separable into a derivative component (for edge detection) and a
smoothing component (for noise reduction). The smoothing is applied perpendicular to
the gradient direction. Sobel's weighted average [1 2 1] provides better noise
suppression than Prewitt's uniform average [1 1 1] because it approximates a Gaussian
weighting. This built-in smoothing makes these operators significantly more robust than
simple finite difference operators for edge detection in noisy images.
30 IP_126
The logarithmic (log) transformation is used to compress the wide dynamic range of certain types
of data into a displayable range, particularly useful for images with large variations in intensity like
Fourier spectra and astronomical images.
📝 Detailed Explanation
Key Point 1: Intensity-Level Slicing
Purpose: To highlight specific features that appear in a particular intensity range while
deemphasizing others.
Two approaches:
Applications:
s = c × log(1 + r)
31 IP_127
1. Large dynamic range problem: Some image data (e.g., Fourier spectrum
magnitudes) have values ranging from 0 to millions. Directly displaying this
would result in all values appearing as either black (low values are
comparatively tiny) or white (high values saturate).
• Maps the range [0, 10⁶] to approximately [0, 6c] — a manageable range.
4. Fourier spectrum display: |F(u,v)| can range from 0 to millions. Without log:
only the DC component (F(0,0)) is visible as a bright dot, everything else
appears black. With log: s = c × log(1 + |F|), the spectrum reveals meaningful
patterns (edges → directional lines, periodic patterns → dots).
Log Transformation:
s ↑
│ ─────────── (compressed high values)
│ ╱╱
│ ╱╱
│ ╱╱
│ ╱╱ (expanded low values)
0 ┤╱
└──────────────────→ r
0 10^6
s = c × log(1 + r)
32 IP_128
(Only DC visible) (Full spectrum visible)
💡 Example
In a satellite image, water bodies have grey levels in the range [50, 80]. Applying
intensity-level slicing with [A, B] = [50, 80] highlights all water bodies in white (255)
while keeping the rest (land, vegetation, buildings) as background.
For Fourier spectrum display: An image's |F(u,v)| has DC component = 10⁶ and other
values ranging 0 to 1000. Without log: only DC is visible. With s = 30 × log(1 + |F|):
DC → 30 × log(10⁶+1) ≈ 415, while a value of 100 → 30 × log(101) ≈ 139. Both are
now in a displayable range, revealing the full spectrum structure.
🔚 Conclusion
Intensity-level slicing is a targeted enhancement technique that highlights specific
intensity ranges, available with or without background preservation. The logarithmic
transformation compresses wide dynamic ranges into displayable ranges by expanding
low values and compressing high values. The log transform is essential for visualizing
Fourier spectra and other data with extreme dynamic ranges, and its behaviour aligns
with human brightness perception, making transformed images more intuitive to
interpret.
📝 Detailed Explanation
Key Point 1: Image Averaging
If multiple images g₁, g₂, ..., gₖ are captured of the same static scene, each corrupted by
independent additive noise:
Properties:
• E[ḡ(x,y)] = f(x,y) — the expected value equals the original (noise has zero
mean).
Limitation: Requires multiple images of the same static scene — not applicable for
moving scenes.
• Histogram is concentrated in a narrow range (neither fully left nor right, but
compressed in the middle or any portion).
34 IP_130
Key Point 3: Numerical — Histogram Equalization
Given: A 3-bit image (L = 8, levels 0–7), size 64 × 64 = 4096 pixels.
Histogram Characteristics:
Dark Image: Bright Image: Low-Contrast:
│█ │ █ │ ██
│██ │ ██ │ ████
│████ │ ████ │ ██████
│██████ │ ██████ │ ████████
└──────────→ └──────────────→ └───────────→
0 128 255 0 128 255 0 128 255
(Left-shifted) (Right-shifted) (Narrow, middle)
35 IP_131
💡 Example
A security camera captures 100 frames of a static lobby. Each frame has Gaussian noise
(σ = 20). Averaging all 100 frames reduces noise standard deviation to σ/√100 = 2,
producing a nearly noise-free image. The averaged image's histogram is initially
concentrated (low contrast). After histogram equalization using the CDF mapping, the
histogram spreads across 0–255, producing a vivid, high-contrast result.
🔚 Conclusion
Image averaging reduces noise by a factor of √K when K images of the same scene are
averaged, making it effective for static scene noise reduction. Histogram characteristics
reveal image quality: dark images have left-shifted histograms, bright images have
right-shifted histograms, and low-contrast images have narrow histograms. Histogram
equalization transforms the histogram toward a uniform distribution using the CDF as a
mapping function, maximizing contrast and improving visual quality.
📝 Detailed Explanation
Key Point 1: Edge Detection Operators
Edges are regions of sharp intensity change. Edge detection uses derivative-based
operators:
36 IP_132
• Gx = [−1 0 1; −1 0 1; −1 0 1]
s = T(r)
where T depends only on the input pixel value r, not on its location or neighbours.
• High-boost filtering: g = Af − f̄ .
At each pixel (x, y), compute local mean mₛ and local variance σₛ² from an n×n
neighbourhood. Apply enhancement based on conditions:
This allows enhancement of regions with specific local properties (e.g., dark, low-
37 IP_133
contrast areas) while leaving other regions unchanged.
┌─────┬─────┬─────┐
│ 10 │ 20 │ 30 │
├─────┼─────┼─────┤
│ 25 │ 200 │ 15 │ ← centre pixel = 200 (possible noise)
├─────┼─────┼─────┤
│ 35 │ 40 │ 45 │
└─────┴─────┴─────┘
Values: {10, 20, 30, 25, 200, 15, 35, 40, 45}
(a) Arithmetic Mean Filter: f̂ = (1/9)(10+20+30+25+200+15+35+40+45) = 420/9 = 46.67 ≈ 47
(b) Harmonic Mean Filter: f̂ = 9 / (1/10 + 1/20 + 1/30 + 1/25 + 1/200 + 1/15 + 1/35 + 1/40 +
1/45) = 9 / (0.1 + 0.05 + 0.0333 + 0.04 + 0.005 + 0.0667 + 0.0286 + 0.025 + 0.0222) = 9 / 0.3708 =
24.27 ≈ 24
(c) Max Filter: f̂ = max{10, 20, 30, 25, 200, 15, 35, 40, 45} = 200
(d) Min Filter: f̂ = min{10, 20, 30, 25, 200, 15, 35, 40, 45} = 10
Observation: Arithmetic mean (47) includes noise effect. Harmonic mean (24) is less affected by
the outlier 200. Max (200) preserves the noise. Min (10) removes the noise spike entirely.
💡 Example
In a surveillance image with Gaussian noise, an arithmetic mean filter (3×3) is applied
38 IP_134
to reduce the overall noise level. For an image with salt noise (random white pixels), the
harmonic mean filter is effective because it gives less weight to very large values. The
min filter removes salt noise by selecting the smallest value (ignoring the white spikes),
while the max filter removes pepper noise by selecting the largest value (ignoring the
black dots).
🔚 Conclusion
Edge detection operators use first-order (Sobel, Prewitt) or second-order (Laplacian)
derivatives to identify intensity transitions. Point processing transforms pixels
independently using transfer functions. Sharpening filters emphasize high-frequency
content through derivative-based operations or unsharp masking. Local enhancement
adapts processing to neighbourhood statistics for targeted improvement. Different mean
and order-statistic filters serve different noise types: arithmetic mean for Gaussian
noise, harmonic mean for salt noise, max for pepper noise, min for salt noise, and
median for impulse noise.
📝 Detailed Explanation
Key Point 1: Image Enhancement Using Arithmetic Operators
(a) Addition (Image Averaging): g(x,y) = (1/K) Σ fᵢ(x,y) — averages K noisy images
of the same scene.
39 IP_135
• Applications: Change detection, motion detection, background subtraction, mask
subtraction (digital subtraction angiography).
(d) Division (Ratio imaging): g(x,y) = f₁(x,y) / f₂(x,y) — ratio of two images.
• Image resizing (scaling up/down) — new pixel locations don't align with
original grid.
0 1 2 3
4 5 6 7
0 2 4 6
1 3 5 7
Interpolation Need:
Original grid: After rotation:
● ● ● ● ● ○ ○ ○ ○ ○ ○ = new pixel positions
● ● ● ● ● ↗ (non-integer in original)
● ● ● ● ● ○ ○ ○ ○ ○ Must interpolate from
● ● ● ● ● nearest ● values
● ● ● ● ●
Entropy Formula:
H = −Σ p(rₖ) × log₂(p(rₖ)) bits/pixel
Max entropy = log₂(L) when all levels equally probable
💡 Example
Digital Subtraction Angiography (DSA): A pre-contrast X-ray (f₁) is subtracted from
a post-contrast X-ray (f₂): g = f₂ − f₁. The difference image shows only the blood
vessels filled with contrast agent, removing all background bone and tissue structures.
The computed entropy of 3.0 bits/pixel means the image requires at least 3 bits per pixel
for lossless compression (equivalent to 16 × 3 = 48 bits total for this 4×4 image).
🔚 Conclusion
Arithmetic operators (addition, subtraction, multiplication, division) provide
fundamental image enhancement capabilities: addition for noise reduction, subtraction
for change detection, multiplication for masking, and division for normalization.
Interpolation techniques are essential whenever geometric transformations produce non-
integer pixel coordinates. Image mean and entropy are key statistical measures — mean
indicates average brightness, while entropy (measured in bits/pixel) quantifies the
information content and determines the theoretical minimum for lossless compression.
41 IP_137
❓ Question 15: Describe the algorithm for image sharpening
using DFT and IDFT. Explain the model of the image
restoration process in the presence of noise.
✅ Answer:
📖 Definition / Introduction
Image sharpening using DFT/IDFT is a frequency-domain approach that enhances edges and fine
details by applying a high-pass filter to the image's frequency representation. The image
restoration model describes how an original image is degraded by a combination of a degradation
function and additive noise, and how restoration attempts to recover the original.
📝 Detailed Explanation
Key Point 1: Image Sharpening Algorithm Using DFT and IDFT
Algorithm:
Step 1: Pre-processing
• Multiply the input image f(x,y) by (−1)^(x+y) to centre the DFT spectrum.
• g'(x,y) = IDFT{G(u,v)}
Step 6: Post-processing
42 IP_138
Key Point 2: Image Restoration Model
The degradation model in the presence of noise:
Where:
Restoration goal: Estimate f̂ (x,y) from g(x,y), given knowledge (or estimates) of h and
noise statistics.
Restoration methods:
• Constrained Least Squares: Minimizes ||∇²f̂||² subject to ||g − Hf̂ ||² = ||η||².
Degradation/Restoration Model:
43 IP_139
Original f ──→ [Degradation h] ──→ (+) ──→ Degraded g ──→ [Restoration] ──→ f̂
↑
Noise η
In Frequency Domain:
G(u,v) = H(u,v)·F(u,v) + N(u,v)
Restoration Attempts:
┌──────────────┬──────────────────────────────────┐
│ Method │ Formula │
├──────────────┼──────────────────────────────────┤
│ Inverse │ F̂ = G / H │
│ Wiener │ F̂ = H*G / (|H|² + K) │
│ Constrained │ F̂ = H*G / (|H|² + γ|P|²) │
└──────────────┴──────────────────────────────────┘
💡 Example
A blurry photograph (degraded by motion blur h and Gaussian noise η) is restored using
the Wiener filter. The FFT of the degraded image G(u,v) is computed. The known
motion blur PSF H(u,v) and estimated NSR K=0.01 are used. The restored image F̂ =
H*G/(|H|²+0.01) recovers significant detail from the blur while keeping noise
amplification under control.
🔚 Conclusion
Image sharpening using DFT/IDFT involves transforming to the frequency domain,
applying a high-pass filter to enhance edges and details, and transforming back. The
image restoration model g = h∗f + η describes how images are degraded by blurring (h)
and noise (η). Restoration methods — from simple inverse filtering to the optimal
Wiener filter — aim to recover the original image by estimating and reversing the
degradation process while controlling noise amplification.
44 IP_140
📝 Detailed Explanation
Key Point 1: Image Convolution — Process
Convolution of an image f(x,y) with a kernel w(s,t) of size m×n is:
Steps:
1. Flip the kernel 180° (both horizontally and vertically). For symmetric kernels
(most smoothing/Laplacian filters), flipping has no effect.
2. Slide the flipped kernel across the image, one pixel at a time.
3. At each position, multiply each kernel element with the corresponding pixel
underneath.
4. Sum all products to get the output pixel value at that position.
5. Handle boundaries: Pad the image (zero padding, replicate padding, mirror
padding).
Note: Convolution (flip kernel + slide) vs. Correlation (slide without flip). For
symmetric kernels, both give the same result.
0 0 0 0 0
0 100 100 100 0
0 100 100 100 0
0 100 100 100 0
0 0 0 0 0
[ 0 1 0]
[ 1 -4 1]
[ 0 1 0]
∇²f(1,1) = 0×50 + 1×50 + 0×50 + 1×50 + (−4)×100 + 1×50 + 0×50 + 1×50 + 0×50 = 50 + 50 +
(−400) + 50 + 50 = −200
The large negative value indicates the centre pixel is a bright spot (local maximum) surrounded by
lower values.
Isotropic Gaussian smoothing kernel (5×5, σ=1):
1 4 7 4 1
4 16 26 16 4
1/ 7 26 41 26 7 ×(1/273)
4 16 26 16 4
1 4 7 4 1
This is isotropic because it is circularly symmetric — the response is the same in all directions.
Isotropic Property:
Isotropic filter produces Non-isotropic filter:
circular response: directional response:
╱ ○ ╲ ──────
○ ○ ──────
╲ ○ ╱ ──────
46 IP_142
(Same in all directions) (Stronger in one direction)
Isotropic Kernels:
┌──────────────────┬───────────────────────────────┐
│ Filter │ Kernel │
├──────────────────┼───────────────────────────────┤
│ Box (averaging) │ All 1/9 (3×3) │
│ Gaussian │ Bell-curve weights (symmetric) │
│ Laplacian (4-N) │ [0 1 0; 1 -4 1; 0 1 0] │
│ Laplacian (8-N) │ [1 1 1; 1 -8 1; 1 1 1] │
└──────────────────┴───────────────────────────────┘
💡 Example
A 3×3 Gaussian kernel (isotropic) applied to a photograph smooths it equally in all
directions — horizontal, vertical, and diagonal edges are blurred equally. Applying the
isotropic 4-neighbour Laplacian to a text image: at the edge of a letter, ∇²f produces a
large positive or negative response (highlighting the edge), while in flat regions ∇²f ≈ 0
(no response). The isotropy ensures edges in all orientations are detected equally.
🔚 Conclusion
Image convolution is the core operation of spatial filtering — it slides a flipped kernel
across the image, computing weighted sums at each position. The process handles
boundary pixels through padding. Isotropic filters like the Laplacian and Gaussian
produce direction-independent responses, making them fundamental to smoothing
(Gaussian) and edge detection (Laplacian). Understanding convolution — both its
mathematical definition and practical computation — is essential for all spatial-domain
image processing operations.
🎓 Documen
47 IP_143
📘 [Link] 6th Semester — Exam Preparation
Author: Rishav Raj | Semester: 6th Sem | Subject: Image Processing — Image Restoration |
Marks per Answer: 5–10 Marks
📝 Detailed Explanation
Key Point 1: Various Geometric Transformations & Linear vs Non-Linear
Geometric transformations change the spatial layout of an image (coordinate
transformations).
1 IP_144
• Rotation: Turning the image around a pivot point.
Non-Linear Transformations: Do not preserve straight lines; they cause local warping
or distortion.
• Method: Minimizes the error between the observed image and the degraded
estimate.
Constrained Restoration: Incorporates prior knowledge about the image (e.g., images
are generally smooth) by adding mathematical constraints to the minimization problem.
2 IP_145
Key Point 3: Region Growing Technique and Its Problems
Region Growing is a bottom-up image segmentation method.
Algorithm:
1. Select a set of seed points (pixels) based on some criteria (e.g., highest
intensity).
4. The new pixel acts as a new seed. Repeat until no more pixels can be added.
Problems / Limitations:
• Seed Selection: The final segmentation heavily depends on the initial choice of
seed points. Poor seed selection leads to incorrect segmentation.
• Stopping Criteria: Difficult to formulate robust rules for when to stop growing.
💡 Example
If a document image is photographed at an angle, a perspective (non-linear)
transformation corrects the keystoning effect so the page looks flat. If an image is
3 IP_146
blurry, an unconstrained inverse filter might amplify sensor noise to the point where
the text is illegible, whereas a constrained least squares filter will restore the text
edges while keeping noise suppressed. To extract the text from the background, region
growing could start at dark seed points (ink) and grow to cover whole characters.
🔚 Conclusion
Geometric transformations adjust spatial coordinates, with linear methods preserving
lines and non-linear methods enabling complex warping. In restoration, constrained
methods significantly outperform unconstrained methods by incorporating prior
knowledge to prevent noise amplification that plagues inverse filtering. Region growing
is a classic segmentation approach that builds regions from seed points but struggles
with noise and seed selection sensitivity.
📝 Detailed Explanation
Key Point 1: Image Degradation Model
The degradation process models how physical phenomena (like motion blur, out-of-
focus lenses, or atmospheric turbulence) and sensor noise corrupt an ideal image.
Let:
• h(x, y) = Degradation function (also known as the Point Spread Function, PSF)
4 IP_147
The Model Equation (Spatial Domain): g(x, y) = h(x, y) ∗ f(x, y) + η(x, y) (where ∗
denotes spatial convolution)
The goal of restoration is to obtain an estimate, f̂ (x, y), of the original image f(x, y),
such that f̂(x, y) is as close as possible to f(x, y).
Let f(α, β) be a continuous, 2D object space (the real world). Let g(x, y) be the
continuous image plane.
The degradation function h(x, y, α, β) represents the response of the imaging system at
image coordinates (x, y) to a point source located at (α, β) in the object plane.
Substituting this back into the integral yields the continuous convolution integral: g(x,
y) = ∫∫ f(α, β) · h(x - α, y - β) dα dβ + η(x, y)
5 IP_148
Degradation Function h(x,y)
[System H]
│
Original Image ───────→ │ ───────→ + ───────→ Degraded Image
f(x,y) │ g(x,y)
↑
Noise η(x,y)
│
▼
[Restoration]
[Filter]
│
▼
Estimated Image
f̂ (x,y)
💡 Example
Consider taking a photograph of a fast-moving car. The original scene is f(x,y). During
the exposure time, the car moves, acting as a continuous degradation function h(x,y)
(motion blur). The camera sensor also adds random continuous noise η(x,y). The
resulting continuous signal is sampled by the camera's pixels to form the discrete
degraded image g(x,y). To restore the image, an algorithm estimates the blur direction
and length to model H(u,v), and applies a Wiener filter to recover the car's license plate
f̂(x,y).
🔚 Conclusion
The image degradation model elegantly represents physical corruption as a combination
of convolution with a Point Spread Function and additive noise. The continuous model
uses integral calculus to describe the precise optical physics, which simplifies to the
convolution integral under the assumption of position invariance. The restoration
process uses this model to mathematically estimate the original, undegraded image from
the corrupted observation using frequency-domain filtering techniques.
6 IP_149
effectively.
📝 Detailed Explanation
Key Point 1: Threshold Coding Implementation
Threshold coding is a technique commonly used in transform-based image
compression (like DCT in JPEG).
Process:
1. Transform the image into the frequency domain (e.g., via Discrete Cosine
Transform).
2. Energy Compaction ensures that most visual information is packed into a few
coefficients, while many high-frequency coefficients are near zero.
Result: Significant compression is achieved because long runs of zeros can be highly
compressed (using Run-Length Encoding). It is a lossy compression method, as the
discarded small coefficients cannot be recovered perfectly.
Taking the derivative and setting it to zero yields the unconstrained least-squares
estimate, which mathematically evaluates to the Inverse Filter: F̂ (u,v) = G(u,v) /
H(u,v)
7 IP_150
Using Lagrange multipliers, this minimization leads to the Constrained Least Squares
Filter:
Where:
💡 Example
When compressing a satellite image to send over a slow connection, threshold coding
discards minor high-frequency details (setting small DCT coefficients to zero), allowing
a 10MB image to be transmitted as 1MB with little visible loss. If this image was taken
out of focus, using unconstrained least-squares would result in a screen full of static
8 IP_151
(noise amplification). Using constrained least-squares, the algorithm minimizes the
Laplacian (keeping the image looking natural and smooth) while enforcing the blur
model, successfully revealing the ground details without noise explosion.
🔚 Conclusion
Threshold coding provides efficient lossy image compression by aggressively
discarding low-magnitude transform coefficients. In image restoration, the
unconstrained least-squares approach fails practically due to massive noise
amplification at frequencies where the degradation function is close to zero. The
constrained least-squares restoration solves this by incorporating the mathematical
constraint of image smoothness (minimizing the Laplacian), resulting in a stable,
optimal restoration that gracefully handles both blur and noise.
📝 Detailed Explanation
Key Point 1: The Multiplicative Degradation Model
Standard image restoration techniques (like Inverse or Wiener filtering) assume the
degradation and noise are additive: g = h ∗ f + η.
However, some degradations are multiplicative. The most classic example is the
Illumination-Reflectance model of image formation, but it also applies to
multiplicative noise (like speckle noise in ultrasound or radar images).
Let the observed degraded image be modeled as: f(x, y) = i(x, y) × r(x, y)
Where:
9 IP_152
• r(x, y) is the reflectance component (the actual object details we want to see). It
varies rapidly across the image, characterized by high frequencies.
Because they are multiplied together, we cannot simply use a linear high-pass or low-
pass filter to separate them directly.
Step 2: Fourier Transform Convert the log-image into the frequency domain. Z(u, v)
= F_i(u, v) + F_r(u, v)
Step 3: Linear Filtering in Frequency Domain Apply a carefully designed filter H(u,
v). We want to suppress the low-frequency illumination (to correct uneven lighting) and
boost the high-frequency reflectance (to enhance details). S(u, v) = H(u, v) · Z(u,
v) S(u, v) = H(u, v) · F_i(u, v) + H(u, v) · F_r(u, v)
Filter Design: H(u,v) is designed to have a value < 1 for low frequencies (attenuation)
and > 1 for high frequencies (amplification).
Step 4: Inverse Fourier Transform Convert back to the spatial domain. s(x, y) =
IDFT{S(u, v)}
10 IP_153
f(x,y)=i×r → [Logarithm] → z = In(i)+In(r) → [Transform] → Z(u,v) →
[ H(u,v) ]
│
Restored Additive Filtered Additive
▼
Image [Exponential] Output [ Inverse ] Frequency
S(u,v)
g(x,y) ← [ exp() ] ← s(x,y) ← [ Fourier ]
←──────────────────────────┘
💡 Example
A radiologist is examining an X-ray where the lighting source was faulty, resulting in
the left side of the film being brightly blown out and the right side being completely
dark (a multiplicative low-frequency degradation). By applying homomorphic filtering,
the algorithm takes the log of the image, applies a filter that heavily attenuates the low
frequencies (removing the bright-to-dark gradient), and takes the exponential. The
restored image now has perfectly uniform lighting across the whole X-ray, revealing
previously hidden bone fractures.
🔚 Conclusion
Homomorphic filtering is a powerful restoration and enhancement technique
specifically designed for multiplicative image models, such as illumination-reflectance
or speckle noise. By mapping the image into the log domain, it elegantly converts
multiplicative components into additive ones, allowing standard frequency-domain
filters to suppress illumination variations and amplify structural details simultaneously,
before returning the image to the spatial domain via an exponential function.
🎓 Documented
11 IP_154
📘 [Link] 6th Semester — Exam Preparation
Author: Rishav Raj | Semester: 6th Sem | Subject: Image Processing — Image Segmentation &
Compression | Marks per Answer: 5–10 Marks
📝 Detailed Explanation
Key Point 1: Image Segmentation & Its Usefulness
Image Segmentation is the process of subdividing an image into its constituent regions
or objects. The level of subdivision depends on the problem being solved (segmentation
stops when the objects of interest have been isolated).
Usefulness:
1 IP_155
• Object recognition: Identifying faces, vehicles, or medical anomalies.
• Feature extraction: Analyzing the shape, size, and texture of isolated objects.
Local (Adaptive) Thresholding: The threshold value T(x,y) varies across the image
depending on the local neighbourhood properties (like local mean or variance).
Region Growing (Bottom-Up): Starts with a set of "seed" pixels and grows regions by
appending adjacent pixels that share similar properties (like intensity).
Split-and-Merge (Top-Down + Bottom-Up): Starts with the entire image. If the image
is non-homogeneous, it splits it into four quadrants. This repeats recursively (quadtree).
After splitting, adjacent regions that are homogeneous when combined are merged.
2 IP_156
Basic Difference: Region growing builds up from tiny seeds, making it highly
dependent on seed selection. Split-and-merge breaks down the whole image
systematically before combining, requiring no initial seeds but resulting in blockier
boundaries before merging.
Global: Local:
Same T everywhere. T varies based on local area.
s(x,y) = 1 if f(x,y)>T s(x,y) = 1 if f(x,y)>T(x,y)
💡 Example
To extract text from a scanned document with a shadow across it, global thresholding
fails (half the page turns black). Local thresholding computes a moving average and
successfully segments all text. The text boundaries are found using a Canny edge
detection algorithm. Otsu's optimum thresholding automatically calculates the best
threshold for uniformly lit regions without manual guessing.
🔚 Conclusion
Segmentation isolates objects of interest. Edge detection finds boundaries via
derivatives, while thresholding separates objects by intensity. Global thresholding is fast
but fails with poor lighting, where local thresholding succeeds. Optimum thresholding
automates threshold selection statistically. Region-based methods like growing (seed-
based) and split-and-merge (quadtree-based) offer alternative ways to define uniform
objects.
3 IP_157
contour. A Fourier descriptor is a robust boundary descriptor that uses the frequency domain to
represent shapes. Region extraction is the process of isolating and labeling these segmented
components so they can be analyzed individually.
📝 Detailed Explanation
Key Point 1: Boundary Descriptor
A boundary descriptor evaluates the outline (contour) of a segmented object to extract
quantitative features that describe its shape.
• Diameter / Major Axis: Maximum distance between any two points on the
boundary.
• Eccentricity: Ratio of the major axis to the minor axis (measures elongation).
Concept:
Advantages:
4 IP_158
After a segmentation algorithm (like thresholding) produces a binary image, we must
extract the individual regions. This is done using Connected Component Analysis
(CCA).
Process:
3. Label Assignment:
• If all neighbors are background, assign a new label to the current pixel.
• If one neighbor has a label, assign that same label to the current pixel.
• If multiple neighbors have different labels, assign one of them and record
an equivalence (they are part of the same object).
4. Resolve Equivalences: Perform a second pass to unify all equivalent labels into
a single unique ID per connected region.
💡 Example
To recognize different types of leaves on a white background: First, Otsu's thresholding
segments the image. Region extraction (connected component labeling) isolates each
leaf and assigns it an ID (Leaf 1, Leaf 2). The boundary of Leaf 1 is traced. A simple
boundary descriptor like eccentricity might fail if two different leaves are both long
and thin. However, computing the Fourier Descriptors of the boundary provides a
highly unique shape signature that remains the same even if the leaf is rotated or scaled.
5 IP_159
🔚 Conclusion
Region extraction transforms a raw segmented image into distinctly labeled individual
objects using connected component analysis. Boundary descriptors quantify the shape
of these extracted objects. While simple descriptors like perimeter or chain codes are
useful, Fourier descriptors provide a mathematically elegant, compact, and
transformation-invariant representation of shape, making them highly effective for
pattern recognition.
📝 Detailed Explanation
Key Point 1: Pattern Fitting Approach
Pattern Fitting (or Template Matching) is a technique used to find specific structures
or shapes within an image.
Advanced fitting: Includes techniques like the Hough Transform (fitting lines and
circles) or Active Contours/Snakes (fitting a parametric curve to object boundaries).
6 IP_160
4. Repeat recursively for each quadrant until all resulting sub-regions are
homogeneous. (Usually followed by a "merge" step to combine adjacent
homogeneous regions).
• Produces a zero-crossing at the exact centre of an edge (used for precise edge
localization).
[-1 -1 -1]
[-1 8 -1]
[-1 -1 -1]
Process: Apply this mask to the image. If the absolute response |R| at a pixel exceeds a high
threshold T, the pixel is classified as an isolated point. The centre weight '8' ensures that if the pixel
is surrounded by identical values, the sum is zero (no point detected).
7 IP_161
2nd Derivative: 0 - + 0 + - 0 (Zero-crossing at edge centre;
huge spike at isolated point)
💡 Example
Pattern Fitting: Finding a specific company logo in a document by cross-correlating a
template of the logo across the page. Region Splitting: Dividing a landscape photo
until uniform patches of sky and grass are isolated in quadtree blocks. Derivative
Detection: Applying the Sobel operator (1st derivative) to an image of a cube highlights
all the outer thick edges. Applying the Laplacian operator (2nd derivative) to a night sky
image causes the isolated points (stars) to produce massive intensity spikes, allowing
them to be instantly identified via thresholding.
🔚 Conclusion
Pattern fitting searches for known structures using templates or mathematical models.
Region splitting segments images systematically from the top down. Fundamentally,
feature detection relies on calculus: first derivatives (like Sobel) measure the gradient to
find thick edges, while second derivatives (like the Laplacian) find exact zero-crossings
for edges and are extremely sensitive to isolated points, making them perfect for point
detection.
📝 Detailed Explanation
Key Point 1: The Object Recognition Process
Object recognition transforms raw pixel data into semantic understanding. It generally
follows a structured pipeline:
8 IP_162
2. Preprocessing: Noise removal, contrast enhancement, or resizing to prepare the
image.
3. Segmentation: Partitioning the image to isolate the objects of interest from the
background (e.g., using thresholding, split-and-merge, or edge detection).
The Algorithm: Let R represent the entire image, and P be a homogeneity predicate
(e.g., "variance < T").
• Recursively apply this step to each new quadrant until every block satisfies P, or
a minimum block size is reached. (This forms a quadtree).
Result: A segmentation that respects the natural boundaries of objects rather than being
constrained to the artificial square grid of the quadtree.
9 IP_163
Split-and-Merge Visualization:
Initial: Split: Split More: Merge:
+-------+ +---+---+ +---+---+ +---+---+
| | | | | | +-|-+ | | | |
| Obj | → |---+---| → |-+-|-+-| → |---+---|
| | | | | | +-|-+ | | |
+-------+ +---+---+ +---+---+ +-------+
(Not homog) (Blocks) (Quadtree) (Final Object)
💡 Example
Split-and-Merge: Segmenting a brain MRI. The image is split into squares until
squares contain either only white matter, grey matter, or background. Then, adjacent
white matter squares are merged together to form the complete white matter
structure. Object Recognition: To recognize a handwritten digit '7', the image is
preprocessed and segmented to extract the digit. Features like the number of straight
lines, intersections, and loops are extracted. A classifier compares these features to a
database and recognizes the object as class '7'.
🔚 Conclusion
The object recognition process is a multi-step pipeline moving from raw data to
semantic labels, relying heavily on segmentation and feature extraction. The split-and-
merge algorithm is a powerful tool in the segmentation step, elegantly combining the
systematic top-down approach of quadtree splitting with the bottom-up aggregation of
merging to accurately isolate objects regardless of shape or size.
📝 Detailed Explanation
Key Point 1: The Confusion Matrix in Segmentation
For binary segmentation (Foreground vs. Background), every pixel is classified into one
of four categories:
10 IP_164
• True Positive (TP): Pixel correctly predicted as foreground.
2. Dice Coefficient (F1-Score) Very similar to IoU but gives twice the weight to the
intersection. Widely used in medical image segmentation.
3. Pixel Accuracy The percentage of pixels correctly classified in the entire image.
• Precision: Of the pixels predicted as foreground, how many actually are? (TP /
(TP + FP)).
• Recall (Sensitivity): Of the actual foreground pixels, how many were found?
(TP / (TP + FN)).
11 IP_165
[ A (Prediction) ]
[ Overlap ]
[ B (Ground Truth) ]
Metric Comparison:
| Metric | Best Used For | Flaw |
|----------|-------------------------------|-------------------------------|
| Accuracy | Balanced classes | Fails badly with class imbalance|
| IoU | Object detection/segmentation | Strictly penalizes minor errors|
| Dice | Medical imaging | Less intuitive geometric meaning|
💡 Example
A tumor (100 pixels) in an MRI (10,000 pixels) is segmented. The algorithm finds 80
pixels of the tumor (TP), misses 20 (FN), and falsely highlights 10 background pixels
(FP).
• Pixel Accuracy: (80 + 9870) / 10000 = 99.5% (Looks amazing, but misleading).
🔚 Conclusion
Assessing segmentation performance requires metrics that evaluate spatial overlap.
While Pixel Accuracy is easily calculated, it is fundamentally flawed for images with
severe class imbalance (large backgrounds). The Intersection over Union (IoU) and the
Dice Coefficient are the industry standards because they directly measure the overlap
between the prediction and the ground truth, ignoring the vast True Negative
background entirely.
12 IP_166
entirely missing or corrupted local regions based on surrounding context.
📝 Detailed Explanation
Key Point 1: Image Deblur
Deblurring (or Deconvolution) deals with images where information is present but
spread out/smeared.
• Solution: Requires estimating the Point Spread Function (PSF) 'h', and then
applying an inverse process (like Wiener filtering or Richardson-Lucy
deconvolution) to mathematically reverse the spread and sharpen the edges.
• Model: There is a known "hole" mask in the image. The pixel data inside the
hole is considered irretrievable.
13 IP_167
Feature Image Deblurring Image Inpainting
Goal Restore sharpness and edges Seamlessly fill holes to fool the
human eye
Inpainting:
[ Good ][ Hole ][ Good ] → (Texture Synthesis) → [ Good ][ Good ][ Good ]
(Information is generated/cloned from neighbors to fill the void)
💡 Example
If you take a photo of a moving race car, the car appears streaked. You apply image
deblurring to reverse the motion blur and read the sponsor logo. If you have an old
family photo that was physically scratched, leaving a white line across someone's face,
you apply image inpainting. The algorithm looks at the skin texture surrounding the
scratch and seamlessly clones it inward to fill the gap.
🔚 Conclusion
While both techniques restore image quality, their methodologies differ drastically.
Image deblurring is an inverse mathematical problem aiming to unscramble smeared
pixels using deconvolution. Image inpainting is a generative problem aiming to
hallucinate missing pixels by smoothly propagating surrounding textures and structures
into a void.
14 IP_168
📝 Detailed Explanation
Key Point 1: What is a Feature?
A raw 100x100 image contains 10,000 pixels. Feeding all 10,000 pixels into a classifier
is computationally expensive and sensitive to noise, translation, and scale. A feature is
a measurable property or characteristic of the image. Good features are highly
discriminatory (different objects have different features) and robust (they don't change if
the object is rotated or scaled).
4. Feature Vector Formulation: The extracted values are concatenated into a 1D array
called the Feature Vector. Example: V = [Area, Eccentricity, Contrast, Entropy] =
[4500, 0.85, 12.4, 3.2]
[ Segmented Image ]
│
├─→ Shape Extractor ──→ [ Area: 50, Circ: 0.9 ]
│
├─→ Color Extractor ──→ [ Mean Red: 120, Mean Blue: 45 ]
│
15 IP_169
└─→ Texture Extractor ─→ [ Entropy: 2.1 ]
│
(Concatenation)
│
▼
Feature Vector: [50, 0.9, 120, 45, 2.1]
│
[ Classifier ]
💡 Example
To build a system that sorts apples from bananas on a conveyor belt. The raw images
are segmented to isolate the fruit. Feature extraction computes two values: the major-
to-minor axis ratio (shape) and the average hue value (color). The apple produces a
feature vector of [1.05, Red_Hue] (round and red), while the banana produces [4.20,
Yellow_Hue] (elongated and yellow). A simple classifier can now easily separate them
based on these two numbers rather than processing thousands of pixels.
🔚 Conclusion
Feature extraction acts as an information bottleneck, stripping away redundant pixel
data and retaining only the semantic essence of an object. By calculating shape, texture,
and color metrics and packing them into a feature vector, it transforms complex visual
data into structured numerical data that is highly optimized for machine learning and
pattern recognition algorithms.
📝 Detailed Explanation
Key Point 1: The Need for Edge Linking
Ideally, applying an edge detector (like Sobel) to an object should yield a perfect, closed
contour. In reality, noise and lighting variations cause the resulting edge map to have
gaps. To extract a meaningful boundary, these gaps must be bridged through edge
linking.
16 IP_170
Key Point 2: Edge Linking via Local Processing
Local processing connects edge pixels based on the similarity of their properties within
a small local neighborhood (typically a 3x3 or 5x5 window).
The Linking Algorithm: Let (x,y) be a known edge pixel, and (x', y') be a neighboring
pixel in its local window. They are linked (connected) if both of the following criteria
are met:
If the neighbour qualifies, it is marked as a valid edge pixel and added to the contour.
The window then moves to the newly added pixel, and the process repeats, tracing out
the boundary.
💡 Example
A Sobel operator is applied to detect the outline of a stop sign. The output shows mostly
17 IP_171
straight lines, but there is a 2-pixel gap due to a glare on the sign. Using local
processing, the algorithm looks at the pixel at the end of the broken line. It searches a
3x3 window, finds a pixel in the gap that has a weak magnitude (missed by the initial
threshold) but the exact same gradient angle (pointing outward). The algorithm links
them, successfully closing the boundary of the octagon.
🔚 Conclusion
Edge linking using local processing bridges small gaps in edge maps by leveraging the
local continuity of object boundaries. By enforcing constraints on gradient magnitude
and gradient direction within a small neighborhood, it successfully traces and connects
fragmented edge pixels into continuous, meaningful contours, essential for subsequent
shape analysis.
📝 Detailed Explanation
Key Point 1: The Two Components of Morphing
True morphing consists of two simultaneous processes:
18 IP_172
parameter 't' from 0.0 to 1.0.
3. Interpolation of Feature Points: For any frame 't', the intermediate position of the
features is calculated using linear interpolation: P_intermediate(t) = (1 - t) × P_source +
t × P_target
4. Geometric Warping:
5. Cross-Dissolving: The final pixel values for frame 't' are a weighted average of the
two warped images: Result(t) = (1 - t) × Warped_Source + t × Warped_Target
💡 Example
Morphing is famously used in cinema (e.g., the liquid metal T-1000 in Terminator 2, or
the music video for Michael Jackson's "Black or White"). To morph a car into an SUV,
points are mapped on the wheels, roof, and headlights. At t=0.5, the roof geometrically
stretches upward (warping) while the paint color gradually shifts from red to blue
(cross-dissolving), producing seamless intermediate frames of a crossover vehicle.
19 IP_173
🔚 Conclusion
Image morphing is a powerful visual effect that combines geometric spatial warping
with photometric cross-dissolving. By defining corresponding feature points and
interpolating their positions and colors over a time parameter, morphing produces a
fluid, realistic shape-shifting transition between two completely different images,
preventing the ghosting artifacts inherent in simple fading.
📝 Detailed Explanation
Key Point 1: Lossless Compression
Concept: Reduces file size by eliminating statistical redundancy in the data without
discarding any actual information.
• Best Use Cases: Medical imaging (where modifying a pixel could hide a tumor),
text documents, line drawings, and archiving original source files.
• Compression Ratio: Highly adjustable and generally very high (10:1 up to 50:1
or more).
• Best Use Cases: Digital photography, web images, video streaming, and
situations where storage space/bandwidth is critical and minor quality loss is
acceptable.
💡 Example
You take a high-resolution photograph of a landscape. If you save it as a PNG
(lossless), the algorithm finds repeating patterns in the blue sky and compresses them,
yielding a 10MB file that retains every exact pixel value. If you save it as a JPEG
(lossy), the algorithm completely deletes very fine, high-frequency details in the grass
that your eye barely notices anyway, yielding a 1MB file. However, if you zoom in
closely on the JPEG, you will see "blocky" artifacts that don't exist in the PNG.
21 IP_175
🔚 Conclusion
The choice between lossy and lossless compression is a trade-off between file size and
data integrity. Lossless compression uses statistical algorithms to reduce size without
altering a single pixel, essential for medical and technical imaging. Lossy compression
utilizes human visual limitations to discard imperceptible data, achieving massive file
size reductions that make modern digital photography and internet media possible.
❓ Question 11: What is the full form of JPEG? Define the JPEG
compression algorithm.
✅ Answer:
📖 Definition / Introduction
JPEG stands for Joint Photographic Experts Group, the committee that created the standard. The
JPEG compression algorithm is a standardized, lossy image compression method specifically
designed for continuous-tone photographic images. It achieves high compression ratios by
transforming the image into the frequency domain and quantizing high-frequency data.
📝 Detailed Explanation
The JPEG Compression Algorithm Pipeline
JPEG compression is not a single equation, but a sequence of distinct steps:
• The image is converted from the RGB color space to the YCbCr color space.
• Why? The human eye is much more sensitive to brightness than to color.
• This discards 50% of the data almost immediately with negligible visual impact.
22 IP_176
• The image is divided into non-overlapping 8 × 8 pixel blocks. Each block is
processed independently from here on.
• The 2D DCT is applied to each 8×8 block, converting spatial pixel values into
64 frequency coefficients.
• The top-left coefficient is the DC (average brightness), and the others are AC
(high frequencies). Energy is compacted into the top-left corner.
• This is where compression and data loss occur. Each of the 64 coefficients is
divided by a corresponding number in a Quantization Table and rounded to the
nearest integer.
• Lower quality settings use larger numbers in the quantization table, producing
more zeros.
• The 8×8 matrix is rearranged into a 1D array using a zig-zag pattern starting
from the top-left.
[RGB Image]
↓ (Color Conversion)
[YCbCr Image]
↓ (Subsampling)
[Divide into 8x8 Blocks]
↓
[2D DCT] → Generates Frequency Coefficients
↓
[Quantization] → Divides by Q-Table & Rounds (Creates Zeros) *LOSSY STEP*
↓
23 IP_177
[Zig-Zag Scan] → Groups zeros together
↓
[RLE & Huffman Coding] → Lossless binary compression
↓
[ .JPG File ]
💡 Example
In an 8x8 block of blue sky, pixel values change very slowly. The DCT transforms this
block into a large DC coefficient and extremely small high-frequency coefficients.
During Quantization, these small coefficients are divided and rounded exactly to 0. The
Zig-zag scan organizes the data as [DC, small_number, 0, 0, 0...0]. Run-length encoding
records this as "DC, small_number, End of Block". 64 numbers are reduced to 3,
achieving massive compression.
🔚 Conclusion
The JPEG algorithm is a masterclass in exploiting human visual perception. By
converting to YCbCr to discard color data, using the DCT to isolate high frequencies,
aggressively quantizing those frequencies into zeros, and finally packing the remaining
data with Huffman coding, JPEG transforms massive bitmaps into tiny files while
retaining photographic realism, establishing it as the standard for internet imagery.
📝 Detailed Explanation
Key Point 1: Compression Ratio
Compression Ratio (CR) measures how much smaller the compressed file is compared
to the original, uncompressed data.
• A CR of 10 means the compressed file is 1/10th the size of the original (a 10:1
24 IP_178
ratio).
Note: While higher CR saves space, in lossy compression, it comes at the direct cost of
image quality.
• DPCM (Differential Pulse Code Modulation): Since error values are usually
small, they require fewer bits to store.
6. Vector Quantization (Lossy): Groups pixels into blocks (vectors) and replaces each
block with an index pointing to the closest matching block in a predefined "codebook".
25 IP_179
📊 Diagram / Table (if applicable)
Summary of Compression Techniques:
|-------------------|---------------------------|------------|------------------
--|-------------|
| Entropy Coding | Huffman, Arithmetic | Lossless | Coding
| ZIP, PNG |
| Mapping | Run-Length Encoding (RLE) | Lossless | Spatial
| BMP, Fax |
| Dictionary | LZW | Lossless | Spatial
| GIF, TIFF |
| Predictive | DPCM | Both | Spatial
| Audio/Video |
| Frequency Domain | DCT, Wavelets | Lossy | Psychovisual
| JPEG, WebP |
💡 Example
A simple fax machine uses Run-Length Encoding (RLE) to compress documents. A
blank white line of 800 pixels is compressed into just two numbers (800, White),
achieving a massive compression ratio losslessly. A modern smartphone uses
Transform Coding (DCT) to compress a 12-megapixel photo. The raw sensor data is
36 MB, but the resulting JPEG is only 3.6 MB, yielding a compression ratio of 10:1 by
utilizing lossy psychovisual reduction.
🔚 Conclusion
Compression ratio is the definitive metric for evaluating compression efficiency. The
landscape of compression techniques offers a spectrum of solutions depending on the
requirement: Entropy, RLE, and LZW coding provide exact lossless preservation by
targeting statistical data redundancies, whereas Transform and Predictive coding utilize
mathematical transformations and human visual limitations to achieve the massive lossy
compression ratios required by modern digital media.
🎓 Documented by
26 IP_180