CHAPTER-1
Introduction to Image Processing
Period 1: Overview of Image Processing
What is image processing?
History and evolution
Analog vs. digital image processing
Key goals: enhancement, analysis, restoration, compression, etc.
1. What is Image Processing?
Definition:
Image processing is a method to perform operations on an image to enhance it or
extract useful information. It involves converting images into digital form and
processing them using algorithms.
Why is it important?
Images carry valuable information; processing helps to improve visibility, analyze
content, and enable decision-making.
Example:
Improving the quality of a medical X-ray image for better diagnosis.
2. History and Evolution
Early days:
o Image processing started with analog techniques in the 1920s–30s, using
optical and chemical methods (e.g., photographic film).
Digital era:
o With the advent of computers in the 1960s, digital image processing (DIP)
emerged.
o First applications included satellite imaging and medical imaging.
o Growth accelerated with increased computing power and better sensors.
Current trends:
o Integration with machine learning and AI for advanced applications like
facial recognition, autonomous vehicles, and augmented reality.
3. Analog vs. Digital Image Processing
Aspect Analog Image Processing Digital Image Processing
Signal form Continuous Discrete (digital numbers)
Optical filters, photographic Mathematical algorithms, computer
Techniques
methods software
Flexibility Limited, hardware dependent Highly flexible and programmable
Noise handling Less effective Sophisticated noise reduction algorithms
Precision Lower precision High precision and reproducibility
Examples Traditional photo processing MRI, satellite image enhancement
4. Key Goals of Image Processing
Image Enhancement:
Improve the visual appearance (e.g., contrast adjustment, noise removal).
Image Restoration:
Recover original image quality by removing distortions or noise.
Image Compression:
Reduce data size for storage and transmission (lossless/lossy).
Image Analysis:
Extract meaningful information (e.g., object detection, pattern recognition).
Image Segmentation:
Divide an image into meaningful regions for further analysis.
🗓 Period 2: Nature of Image Processing
Types of image processing: low-level, mid-level, high-level
Examples of enhancement, segmentation, recognition
Deterministic vs. stochastic processing
Real-time vs. offline processing
1. Types of Image Processing
Image processing tasks can be categorized based on the complexity and purpose of the
operation:
Type Description Examples
Low-Level Operates directly on raw pixel data. Input Noise removal, contrast
Processing and output are images. enhancement, smoothing filters
Mid-Level Extracts attributes or features from Segmentation, edge detection,
Processing images. Output is data (not image). object recognition
Involves interpretation and understanding Scene understanding, face
High-Level
of images. Output is knowledge or recognition, autonomous
Processing
decisions. navigation
2. Examples of Each Type
Enhancement (Low-Level):
o Adjusting brightness/contrast
o Removing noise using filters
Segmentation (Mid-Level):
o Dividing an image into regions, such as separating objects from background
o Thresholding or clustering methods
Recognition (High-Level):
o Identifying and labeling objects (e.g., recognizing a face in a photo)
o Using machine learning or AI techniques
3. Deterministic vs. Stochastic Processing
Processing
Description Characteristics
Type
Output is fully determined by input Predictable and reproducible; no
Deterministic
and process rules. randomness.
Involves randomness or probabilistic Can handle uncertainties, noise, or
Stochastic
models. incomplete data.
Example:
o Deterministic: Applying a fixed sharpening filter.
o Stochastic: Using probabilistic models to detect faces with uncertain data.
4. Real-time vs. Offline Processing
Processing
Description Examples
Mode
Processing happens instantly or with minimal Video surveillance,
Real-Time
delay to support immediate decisions. autonomous vehicles
Processing is done after data acquisition, with no Photo editing, medical
Offline
immediate time constraint. image analysis
🗓 Period 3: Application Areas of Image Processing
Medical imaging (e.g., CT, MRI)
Satellite & remote sensing
Industrial inspection
Security/surveillance
Computer vision & AI
Artistic and photography filters
1. Medical Imaging
Description:
Use of image processing to analyze and enhance medical images for diagnosis and
treatment.
Examples:
o CT (Computed Tomography): Cross-sectional images of the body.
o MRI (Magnetic Resonance Imaging): High-contrast soft tissue images.
o X-ray enhancement: Noise removal, contrast adjustment.
Purpose:
Improve visibility of abnormalities, aid doctors in diagnosis, 3D reconstruction of
organs.
2. Satellite & Remote Sensing
Description:
Processing images captured by satellites or aerial vehicles to monitor earth's surface.
Examples:
o Land-use classification
o Weather forecasting
o Environmental monitoring (deforestation, pollution)
Purpose:
Extract useful data for agriculture, urban planning, disaster management.
3. Industrial Inspection
Description:
Automated visual inspection in manufacturing for quality control.
Examples:
o Detecting defects on assembly lines (scratches, missing parts)
o Measuring product dimensions
Purpose:
Ensure product quality, reduce human error, increase inspection speed.
4. Security and Surveillance
Description:
Use of image processing to monitor and analyze video feeds for safety and crime
prevention.
Examples:
o Face recognition
o Motion detection
o License plate recognition
Purpose:
Real-time threat detection, automated alerts, forensic analysis.
5. Computer Vision & Artificial Intelligence
Description:
Machines interpreting and understanding visual data using advanced algorithms.
Examples:
o Autonomous vehicles recognizing obstacles
o Gesture recognition
o Image captioning
Purpose:
Enable intelligent systems to interact with the environment visually.
6. Artistic and Photography Filters
Description:
Enhancing or creatively modifying images for artistic expression or improved
aesthetics.
Examples:
o Instagram filters (sepia, vintage)
o Portrait retouching
o Special effects (cartoonizing, oil painting)
Purpose:
Improve visual appeal, create stylized images for social media or art.
🗓 Period 4: Digital Image Representation
Pixels, intensity levels, resolution
Image dimensions (2D, 3D, multispectral)
Color vs grayscale vs binary images
Human vs computer vision: limitations and advantages
1. Pixels, Intensity Levels, Resolution
Pixel:
The smallest unit of a digital image, representing a single point.
Intensity Levels:
The brightness value of each pixel.
o For grayscale images, usually 0 (black) to 255 (white) — 8-bit depth.
o More bits mean more intensity levels (e.g., 16-bit images have 65,536 levels).
Resolution:
o Spatial resolution: Number of pixels in width × height (e.g., 1024×768).
o Determines the level of detail.
2. Image Dimensions
2D Images:
Standard flat images with width and height.
o Example: Photos, scanned documents.
3D Images:
Volume data with width, height, and depth (often used in medical imaging).
o Example: MRI or CT scans.
Multispectral Images:
Images captured at multiple wavelengths beyond visible light (e.g., infrared).
o Each spectral band adds a “layer” to the image data.
3. Color vs Grayscale vs Binary Images
Type Description Example
Black and white scanned
Binary Pixels have only two values (0 or 1)
text
Grayscale Pixels represent intensity levels Black to white photo
Pixels contain multiple color components (usually
Color Natural color photos
RGB)
Color Images:
Typically stored as 3 channels (Red, Green, Blue) per pixel. Each channel has
intensity values.
4. Human vs Computer Vision: Limitations and Advantages
Aspect Human Vision Computer Vision
Processing Parallel, real-time, intuitive Sequential or parallel, depends on
Aspect Human Vision Computer Vision
algorithms
Interpretation Highly flexible, contextual Limited by training data and models
Limited by eye anatomy (~576 Can be arbitrarily high depending on
Resolution
megapixels) sensor and memory
Color Sensitive to subtle colors and Can capture non-visible spectra (IR,
perception contrasts UV)
Fast for many tasks, but limited in
Speed Extremely fast for repetitive tasks
multitasking
🗓 Period 5: Digital Image Processing Operations
Types: Point, local (neighborhood), global
Categories:
o Image enhancement
o Image restoration
o Image compression
o Image analysis and understanding
1. Types of Image Processing Operations
Type Description Input/Output Example
Processing applied to each pixel
Brightness adjustment,
Point Operations individually based only on its own Image → Image
negative transformation
value.
Processing based on a pixel and its
Local (Neighborhood) Smoothing (blurring),
surrounding neighbors (small Image → Image
Operations edge detection filters
window).
Processing using the entire image Image → Image Histogram equalization,
Global Operations
information simultaneously. or Data Fourier transform
2. Categories of Image Processing Operations
a) Image Enhancement
Purpose: Improve visual quality for human interpretation.
Techniques:
o Contrast adjustment
o Noise reduction
o Sharpening filters
Example: Enhancing a dark photo to reveal hidden details.
b) Image Restoration
Purpose: Recover an image degraded by noise, blur, or other distortions.
Approach: Uses models of degradation to reverse effects.
Example: Removing motion blur from a shaky photo.
c) Image Compression
Purpose: Reduce file size for storage and transmission without unacceptable quality
loss.
Types:
o Lossless (e.g., PNG)
o Lossy (e.g., JPEG)
Example: Compressing photos to share on social media faster.
d) Image Analysis and Understanding
Purpose: Extract meaningful information and enable automated interpretation.
Processes include:
o Segmentation (dividing image into parts)
o Feature extraction (edges, shapes)
o Object recognition
Example: Automated tumor detection in medical images.
🗓 Period 6: Elements of a Digital Image Processing System
Basic components:
o Image sensors (input)
o Digitizer/ADC
o Processor (CPU/GPU/FPGA)
o Memory and storage
o Display and visualization tools
Software tools (MATLAB, OpenCV, Python)
1. Basic Components
a) Image Sensors (Input)
Devices that capture the real-world image and convert it into an electrical signal.
Common types:
o CCD (Charge-Coupled Device) sensors
o CMOS (Complementary Metal-Oxide Semiconductor) sensors
Used in cameras, scanners, medical imaging devices.
b) Digitizer / ADC (Analog-to-Digital Converter)
Converts the analog signals from the sensor into digital form (binary numbers).
Sampling (spatial discretization) and quantization (intensity discretization) happen
here.
c) Processor (CPU/GPU/FPGA)
CPU: General-purpose processor for executing image processing algorithms.
GPU: Highly parallel processors optimized for handling image data and matrix
operations efficiently.
FPGA: Programmable hardware used for custom, high-speed image processing tasks.
Processors perform filtering, enhancement, compression, and other operations.
d) Memory and Storage
Memory: Temporary storage (RAM) used during processing.
Storage: Long-term storage devices (HDD, SSD) to save images and processed
results.
Memory size and speed affect processing performance.
e) Display and Visualization Tools
Devices to show images to users:
o Monitors, projectors, VR headsets
Visualization software enables zoom, pan, and various display effects.
2. Software Tools
MATLAB:
Widely used for prototyping and academic research; offers extensive image
processing toolboxes.
OpenCV (Open Source Computer Vision Library):
Popular open-source library with extensive real-time image and video processing
capabilities.
Python Libraries:
o Pillow: Basic image processing tasks.
o scikit-image: Advanced algorithms.
o TensorFlow/PyTorch: For deep learning-based image analysis.
🗓 Period 7: Fundamental Steps in Digital Image Processing
1. Image acquisition
2. Preprocessing
3. Segmentation
4. Representation and description
5. Recognition
6. Interpretation
7. Knowledge base
1. Image Acquisition
Capturing the image from the real world through sensors (cameras, scanners,
satellites).
Converts physical signals into digital images.
Quality here affects all downstream processing.
2. Preprocessing
Preparing the image for further analysis.
Tasks include noise removal, contrast enhancement, resizing.
Goal: Improve image quality and remove distortions.
3. Segmentation
Dividing the image into meaningful regions or objects.
Essential for separating foreground from background.
Techniques: Thresholding, edge detection, clustering.
4. Representation and Description
Representing segmented regions in a form suitable for analysis.
Describing features like shape, texture, size, and boundary.
Enables further processing such as classification.
5. Recognition
Assigning labels or categories to detected objects.
Uses pattern recognition and machine learning.
Example: Identifying faces, letters, or tumors.
6. Interpretation
Making sense of recognized objects in context.
Deriving higher-level understanding or decisions.
Example: Interpreting traffic signs or medical images.
7. Knowledge Base
Repository of information and rules used for interpretation.
Includes databases, heuristics, or learned models.
Helps system improve over time or make smarter decisions.
🧠 Visual diagram of the pipeline included
Visual Diagram: Digital Image Processing Pipeline
sql
CopyEdit
+-------------------+
| 1. Image |
| Acquisition |
+---------+---------+
|
v
+-------------------+
| 2. Preprocessing |
| (Noise removal, |
| enhancement) |
+---------+---------+
|
v
+-------------------+
| 3. Segmentation |
| (Divide image |
| into regions) |
+---------+---------+
|
v
+------------------------------+
| 4. Representation & |
| Description |
| (Extract features like shape,|
| texture, boundary) |
+---------+--------------------+
|
v
+-------------------+
| 5. Recognition |
| (Label objects) |
+---------+---------+
|
v
+-------------------+
| 6. Interpretation |
| (Contextual |
| understanding) |
+---------+---------+
|
v
+-------------------+
| 7. Knowledge Base |
| (Rules, databases)|
+-------------------+
🗓 Period 8: Types of Images
Based on dimensions:
o 1D (signal), 2D (image), 3D (volume)
Based on pixel value:
o Binary, grayscale, color, multispectral, hyperspectral
Static vs dynamic images (video)
1. Based on Dimensions
Dimension Description Example
1D Signal varying along one axis Audio waveform, sensor readings
Dimension Description Example
2D Image with width and height Photographs, scanned documents
3D Volume data with width, height, and depth Medical CT or MRI scans, 3D models
2. Based on Pixel Value
Type Description Example
Pixels have two values: 0 or 1 (black and
Binary Text scanned documents, barcodes
white)
Grayscale Pixels represent intensity levels (0 to 255) Black & white photos, X-rays
Pixels have multiple components (RGB or
Color Natural images, videos
CMYK)
Images captured at a few specific Satellite images capturing visible + IR
Multispectral
wavelength bands bands
Images with many narrow spectral bands Advanced remote sensing, mineral
Hyperspectral
(>100) exploration
3. Static vs. Dynamic Images
Type Description Example
Static Image Single frame, fixed in time Photos, scanned images
Dynamic Image (Video) Sequence of images over time Movies, surveillance footage
🗓 Period 9: Overview of Digital Image Systems
Hardware setup:
o Cameras (CCD, CMOS), IR sensors
o Scanners, drones, telescopes
Real-world digital image processing systems:
o Medical imaging machines
o Security systems
o Industrial vision systems
1. Hardware Setup
a) Cameras
CCD (Charge-Coupled Device):
High-quality image capture, used in professional and scientific applications.
Known for low noise and good image quality.
CMOS (Complementary Metal-Oxide Semiconductor):
Cheaper, faster, and more power-efficient than CCDs. Common in smartphones and
webcams.
IR Sensors (Infrared):
Capture images based on infrared radiation, useful for night vision, thermal imaging.
b) Other Image Capture Devices
Scanners:
Convert physical documents and photos into digital images.
Drones:
Equipped with cameras and sensors for aerial imaging and remote sensing.
Telescopes:
Capture images from space or distant objects, sometimes equipped with multispectral
or hyperspectral sensors.
2. Real-World Digital Image Processing Systems
a) Medical Imaging Machines
Devices like MRI, CT scanners, ultrasound, X-ray machines.
Combine hardware and software to acquire and process images for diagnosis.
b) Security Systems
Surveillance cameras, biometric scanners (fingerprint, face recognition).
Often include real-time image processing for motion detection, identification.
c) Industrial Vision Systems
Automated inspection on production lines.
Use cameras and lighting setups to detect defects, measure dimensions, guide robots.
🗓 Period 10: Sampling and Quantization
Sampling: Converting a continuous image into discrete pixels
Quantization: Assigning intensity levels to sampled pixels
Concepts of:
o Spatial resolution
o Gray-level resolution
Aliasing and anti-aliasing
🧪 Hands-on: Showing effects of poor sampling and quantization
1. Sampling
Definition:
Process of converting a continuous image (analog) into discrete pixels by measuring
intensity at regular spatial intervals.
Goal:
Capture enough detail to accurately represent the image.
Sampling Rate:
Number of samples (pixels) per unit length; determines spatial resolution.
2. Quantization
Definition:
Assigning discrete intensity levels (gray-levels) to each sampled pixel.
Bit Depth:
Number of bits used to represent intensity; affects number of gray levels (e.g., 8 bits =
256 levels).
3. Key Concepts
Spatial Resolution:
Number of pixels in an image; higher means more detail.
Gray-Level Resolution:
Number of intensity levels; higher means finer brightness gradations.
4. Aliasing and Anti-Aliasing
Aliasing:
Distortion or artifacts (e.g., jagged edges) caused by insufficient sampling.
Anti-Aliasing:
Techniques to reduce aliasing by smoothing or filtering before sampling.
🗓 Period 11: Image Storage and Compression Basics
Bit depth and memory requirements
Uncompressed formats vs compressed formats
Introduction to:
o Lossless (PNG, BMP)
o Lossy (JPEG)
Importance of compression in storage/transmission
1. Bit Depth and Memory Requirements
Bit Depth:
Number of bits used to represent each pixel’s intensity/color (e.g., 8-bit grayscale, 24-
bit RGB).
Memory Calculation:
Memory = (Number of pixels) × (Bit depth)
Example: A 1024×768 image with 24-bit color requires about 2.36 MB
(1024×768×24/8 bytes).
2. Uncompressed Formats
Store raw pixel data without reduction.
Examples:
o BMP (Bitmap): Simple, widely supported, large files.
o RAW: Used in cameras, contains minimally processed data.
Pros: High quality, no loss of information.
Cons: Large file sizes, inefficient for storage/transmission.
3. Compressed Formats
a) Lossless Compression
Compress data without losing any image information.
Perfect reconstruction possible.
Examples:
o PNG: Popular for graphics with transparency and text.
o GIF: Limited to 256 colors, used for animations.
b) Lossy Compression
Compress data by discarding some information to achieve higher compression ratios.
Small loss in quality, often unnoticeable.
Example:
o JPEG: Widely used for photographs; allows adjustable quality settings.
4. Importance of Compression
Reduces storage space needed on disks and servers.
Enables faster transmission over networks (email, web, streaming).
Balances quality vs. file size depending on application needs.
🗓 Period 12: File Formats and Metadata
Common file formats:
o BMP, PNG, JPEG, TIFF, DICOM
Image metadata:
o Headers, color profiles, EXIF
Reading image formats using tools (MATLAB/OpenCV)
Choosing the right format for the right application
1. Common File Formats
Format Type Key Features Common Use Cases
BMP Uncompressed Simple structure, large file size Editing, lossless archival
Format Type Key Features Common Use Cases
PNG Lossless Supports transparency, no quality loss Web graphics, diagrams, screenshots
Adjustable compression, small size,
JPEG Lossy Photography, web sharing
quality trade-off
Supports both lossless/lossy, multi- High-quality publishing,
TIFF Flexible
layered medical/scientific imaging
Contains both image and patient
DICOM Specialized Medical imaging (MRI, CT, ultrasound)
metadata
2. Image Metadata
Metadata provides additional information about an image beyond pixel data.
📁 Types of Metadata:
Header Information:
o Image dimensions, color depth, compression type
Color Profiles:
o sRGB, Adobe RGB – define how colors should be interpreted
EXIF (Exchangeable Image File Format):
o Embedded in photos by cameras
o Includes camera settings, GPS location, date/time, orientation
🏥 DICOM Metadata Includes:
Patient ID, scan time, device info, diagnosis notes, etc.
3. Reading Image Formats with Tools
Using MATLAB:
matlab
CopyEdit
info = imfinfo('image.jpg'); % View metadata
img = imread('image.jpg'); % Read image
imshow(img);
Using OpenCV (Python):
python
CopyEdit
import cv2
img = cv2.imread('image.jpg') # Load image
print(img.shape) # Get dimensions
To read EXIF metadata in Python:
python
CopyEdit
from PIL import Image
from PIL.ExifTags import TAGS
image = Image.open('photo.jpg')
exif_data = image._getexif()
for tag, value in exif_data.items():
print(f"{TAGS.get(tag)}: {value}")
4. Choosing the Right Format
Need Recommended Format
High-quality archival TIFF, PNG
Web and photo sharing JPEG
Simple and fast image display BMP
Scientific/medical imaging DICOM, TIFF
Images with transparency PNG
Unit: 2
Image Enhancement
Topics Covered:
1. Image Quality and Need for Enhancement
2. Image Enhancement in Spatial Domain
o Point Operations
o Piecewise Linear Functions
3. Histogram-based Techniques
4. Spatial Filtering Concepts
o Image Smoothing Filters
o Image Sharpening Filters
🗓 Period 1: Introduction to Image Quality
Definition of image quality
Factors affecting image quality: noise, blur, contrast
Subjective vs. objective quality
Real-world examples
1. Definition of Image Quality
Image Quality refers to the perceived visual characteristics of an image, which
determine how useful or aesthetically pleasing the image is to a human observer or
machine.
It is measured in terms of:
o Clarity
o Detail visibility
o Contrast
o Color fidelity
o Noise levels
🔎 Simple definition: "How good an image looks or how useful it is for a specific purpose
(e.g., diagnosis, surveillance, analysis)."
📌 2. Factors Affecting Image Quality
✅ a. Noise
Unwanted random variations in brightness or color.
Causes: sensor errors, transmission faults, low light.
Types: Gaussian noise, Salt-and-pepper noise, Speckle noise.
✅ b. Blur
Loss of sharpness and detail.
Causes:
o Motion blur (camera/subject movement)
o Defocus blur (improper lens focus)
Makes edges and fine details indistinguishable.
✅ c. Contrast
Difference in intensity between pixels or regions.
Low contrast = dull/flat image
High contrast = more visual clarity
Affects object visibility and detail extraction.
🎯 Goal of Enhancement: Improve these quality factors without losing important image
information.
📌 3. Subjective vs. Objective Image Quality
Aspect Subjective Quality Objective Quality
Definition Based on human perception Based on mathematical/statistical metrics
Measured by Viewers, experts, surveys Formulas, models, algorithms
Examples "This image looks good to me" PSNR, SSIM, MSE, entropy
Use Case Aesthetics, art, consumer products Medical imaging, remote sensing, machine vision
📌 4. Real-World Examples
Domain Image Quality Challenge Enhancement Goal
Medical Low-contrast MRI/CT scans Enhance structures for diagnosis
Satellite Hazy or cloudy satellite images Improve clarity and object recognition
Surveillance Low-light and noisy video footage Clarify faces, license plates
Photography Motion blur and poor lighting Sharpen and balance exposure
🗓 Period 2: Need for Image Enhancement
What is Image Enhancement
Importance in medical, satellite, surveillance imagery
Pre-processing step for computer vision
Applications & case studies
1. What is Image Enhancement?
Image Enhancement refers to improving the visual appearance or making images
more suitable for analysis.
It focuses on highlighting important features and removing irrelevant data.
🎯 The goal is not to create a realistic image, but a useful one.
📌 2. Importance of Image Enhancement in Different Domains
✅ a. Medical Imaging
Problem: Low contrast in CT, MRI, X-rays.
Why important:
o Improve visibility of tissues, bones, and tumors.
o Assist in early diagnosis.
Common techniques: Histogram equalization, edge enhancement.
✅ b. Satellite & Aerial Imagery
Problem: Atmospheric effects, cloud cover, low resolution.
Why important:
o Highlight land features, water bodies, urban areas.
o Used in agriculture, mapping, climate analysis.
Techniques: Contrast stretching, false-color composites.
✅ c. Surveillance & Security
Problem: Low light, motion blur, camera noise.
Why important:
o Detect faces, license plates, intruders.
o Enhance low-quality CCTV footage.
Techniques: Denoising, sharpening, brightness adjustment.
📌 3. Enhancement as a Pre-processing Step in Computer Vision
Many AI and ML models need enhanced images for:
o Object detection
o Face recognition
o Text extraction (OCR)
Enhancement improves:
o Feature visibility
o Edge clarity
o Segmentation accuracy
🛠 Example: Blurry or low-contrast images can mislead a face detection algorithm or produce
errors in license plate recognition.
📌 4. Real-World Applications & Case Studies
🏥 Case Study: Medical Imaging
Context: Detecting early-stage tumors in mammograms.
Challenge: Tumors appear in low contrast.
Solution: Contrast-limited adaptive histogram equalization (CLAHE).
Result: Higher accuracy in early detection.
🛰️Case Study: Satellite Monitoring
Context: Monitoring crop health via NDVI.
Challenge: Cloud and haze reduce visibility.
Solution: Image enhancement + spectral filtering.
Result: Accurate vegetation mapping.
🎥 Case Study: Forensic Surveillance
Context: Enhancing a face from night-time CCTV footage.
Challenge: Low light, motion blur.
Solution: Denoising + sharpening + histogram correction.
Result: Recognizable facial features for identification.
🗓 Period 3: Introduction to Spatial Domain Techniques
Difference between spatial & frequency domain
Basic spatial enhancement model: g(x, y) = T[f(x, y)]
1. What is Spatial Domain?
Spatial domain refers to direct manipulation of pixels in an image.
Every pixel has an intensity value, and operations are performed using the pixel's
position (x, y) and its value f(x, y).
🆚 2. Spatial Domain vs. Frequency Domain
Feature Spatial Domain Frequency Domain
Definition Operations directly on pixels (x, y) Operations on Fourier-transformed image
Filters or functions applied in image Image is transformed, processed, then
Method
space inverted
Focus Local features, edges, smoothing Periodic patterns, textures, global features
Example DFT, FFT, high-pass/low-pass frequency
Histogram equalization, sharpening
Techniques filters
📌 Example:
Spatial domain: Blurring with a 3×3 averaging filter
Frequency domain: Removing high frequencies to blur
💡 Both domains aim for image enhancement but use different mathematical approaches.
📌 3. Basic Spatial Enhancement Model
The spatial enhancement model is based on applying a transformation T to the input image
f(x, y):
g(x,y)=T[f(x,y)]
f(x, y): Original image
T: Transformation function (can be linear or nonlinear)
g(x, y): Enhanced output image
✅ Types of Transformations T:
Point Operations: Modify a pixel independently.
o Example: Contrast stretching
Neighborhood Operations: Modify a pixel using surrounding pixels.
o Example: Smoothing filters
Geometric Transformations: Change position or orientation.
o Example: Rotation, scaling
📌 4. Visual Illustration
Original Image After Spatial Domain Operation
Blurred image Sharpened using Laplacian
Low contrast Enhanced using histogram equalization
🗓 Period 4: Point Operations – Basic Concepts
Contrast stretching
Thresholding
Negative transformation
Log and power-law transformations
🔹 1. Contrast Stretching
Purpose: Improves the contrast of an image by stretching the range of intensity values.
How it works: Linearly maps the pixel values from the input range to the full
dynamic range (usually 0 to 255 for 8-bit images).
Formula:
s=(r−rmin)(rmax−rmin)⋅(L−1)s = \frac{(r - r_{min})}{(r_{max} - r_{min})} \cdot (L - 1)s=(rmax
−rmin)(r−rmin)⋅(L−1)
where:
o r: original pixel value
o s: new pixel value
o rminr_{min}rmin, rmaxr_{max}rmax: minimum and maximum intensity in
the image
o LLL: number of gray levels (e.g., 256)
🔹 2. Thresholding
Purpose: Converts a grayscale image into a binary image.
How it works: Assigns each pixel a value of 0 or 255 based on a threshold.
Formula:
s={0if r<T255if r≥Ts = \begin{cases} 0 & \text{if } r < T \\ 255 & \text{if } r \geq T \
end{cases}s={0255if r<Tif r≥T
where TTT is the threshold value.
🔹 3. Negative Transformation
Purpose: Produces a photographic negative of the image; useful for enhancing white or gray
details in dark regions.
How it works: Inverts the pixel values.
Formula:
s=L−1−rs = L - 1 - rs=L−1−r
where:
o rrr: original pixel value
o sss: new pixel value
o LLL: number of gray levels (e.g., 256)
🔹 4. Log and Power-Law Transformations
These are non-linear transformations used to enhance details in different brightness ranges.
a. Log Transformation
Purpose: Enhances darker regions more than brighter ones.
Formula:
s=c⋅log(1+r)s = c \cdot \log(1 + r)s=c⋅log(1+r)
o ccc is a constant (usually chosen to scale sss properly)
o Emphasizes low-intensity values
b. Power-Law (Gamma) Transformation
Purpose: Adjusts brightness and contrast using a power curve.
Formula:
s=c⋅rγs = c \cdot r^\gammas=c⋅rγ
o γ<1\gamma < 1γ<1: enhances dark areas (brightens image)
o γ>1\gamma > 1γ>1: enhances bright areas (darkens image)
o Used in gamma correction for display systems
🗓 Period 5: Piecewise Linear Functions
Contrast stretching
Gray-level slicing
Bit-plane slicing
Real-life applications of piecewise operations
1. What Are Piecewise Linear Functions?
A piecewise linear function is composed of multiple linear segments, each applying
to a specific intensity range.
These functions allow flexible control over pixel transformation.
Used to enhance specific regions of intensity values in an image.
🔹 Techniques Under Piecewise Linear Functions
✅ 1. Contrast Stretching (Revisited as Piecewise)
Often implemented using a piecewise linear transformation.
Improves contrast by adjusting the range of gray levels.
🔹 Basic Transformation:
g(x)={0,x<r1s2−s1r2−r1⋅(x−r1)+s1,r1≤x≤r2255,x>r2g(x) = \begin{cases} 0, & x < r_1 \\ \frac{s_2 - s_1}
⋅(x−r1)+s1,255,x<r1r1≤x≤r2x>r2
{r_2 - r_1} \cdot (x - r_1) + s_1, & r_1 \le x \le r_2 \\ 255, & x > r_2 \end{cases}g(x)=⎩⎨⎧0,r2−r1s2−s1
Where:
r1, r2: Input intensity breakpoints
s1, s2: Output levels
📊 Visual Representation:
A graph with 3 segments:
1. Low values → set to black
2. Mid-range → stretched linearly
3. High values → pushed to white
✅ 2. Gray-Level Slicing
Highlights a specific range of intensities while leaving others unchanged or
suppressed.
🔹 Types:
With background: Enhances a range but retains other intensities.
Without background: Sets everything else to black (or low value).
🔹 Example:
g(x)={255,a≤x≤bf(x),otherwiseg(x) = \begin{cases} 255, & a \le x \le b \\ f(x), & \text{otherwise} \
end{cases}g(x)={255,f(x),a≤x≤botherwise
Where a and b define the range to enhance.
✅ Use Case:
Highlight tumors in medical images or roads in satellite images.
✅ 3. Bit-Plane Slicing
Separates the image into individual bit planes (0 to 7 for 8-bit images).
Each bit plane shows the contribution of a specific bit to the image's intensity.
🔹 Example:
8-bit image: Each pixel = 8 binary digits.
o Bit-plane 7 = most significant bit (MSB)
o Bit-plane 0 = least significant bit (LSB)
✅ Insights:
MSBs contain structural information (shapes, objects).
LSBs contain noise or finer texture.
✅ Use Case:
Image compression
Steganography (hiding information in LSBs)
📸 4. Real-Life Applications of Piecewise Operations
Technique Real-World Application Benefit
Contrast Stretching Enhancing faded photographs Improves overall visual clarity
MRI/CT scans to highlight specific tissue
Gray-Level Slicing Isolates diagnostic features
ranges
Data hiding / performance
Bit-Plane Slicing Digital watermarking or compression
optimization
Piecewise Linear Enhancing road features in satellite
Highlights relevant intensity ranges
Maps imagery
🗓 Period 6: Histogram Techniques – Basics
Histogram generation
Histogram equalization: concept and procedure
Manual and automatic equalization
1. What Is a Histogram in Image Processing?
A histogram is a graphical representation of the distribution of pixel intensities in
an image.
X-axis: Intensity values (0–255 for 8-bit images)
Y-axis: Frequency (number of pixels with each intensity)
📊 Example:
A bright image → histogram skewed to the right
A dark image → histogram skewed to the left
Low contrast image → narrow, centered histogram
✅ 2. Histogram Generation (Steps)
1. Read the image.
2. For each pixel, read its intensity value.
3. Count how many times each intensity value occurs.
4. Plot the intensity values vs frequency.
🧮 Pseudocode:
python
CopyEdit
hist = [0]*256
for pixel in image:
hist[pixel_value] += 1
📸 Visualization:
You can use tools like OpenCV or MATLAB to display image histograms.
📌 3. Histogram Equalization: Concept & Procedure
🎯 Goal:
Enhance contrast by spreading out the intensity values evenly across the histogram.
🔍 Concept:
Low-contrast images have pixel values concentrated in a narrow range.
Equalization redistributes these values to cover the full range (0–255), improving
contrast.
🔢 Procedure:
1. Compute the histogram of the image.
2. Normalize it to get the probability distribution.
3. Calculate cumulative distribution function (CDF).
4. Use the CDF to map old intensity values to new ones.
5. Create a new image using this mapping.
📐 Mathematical Formula:
T(rk)=(L−1MN)∑j=0kh(rj)T(r_k) = \left( \frac{L - 1}{MN} \right) \sum_{j=0}^{k} h(r_j)T(rk)=(MNL−1
)j=0∑kh(rj)
Where:
T(rk)T(r_k)T(rk): Output level
LLL: Number of intensity levels (e.g., 256)
MNMNMN: Total number of pixels
h(rj)h(r_j)h(rj): Number of pixels with intensity rjr_jrj
✅ 4. Manual vs. Automatic Histogram Equalization
Feature Manual Equalization Automatic Equalization
User applies equalization step-by-
Definition System/tool applies it internally
step
Control Full control over transformation Quick and often optimized
Flexibility Custom thresholds and adjustments Predefined operation (e.g., OpenCV's
Feature Manual Equalization Automatic Equalization
equalizeHist)
Use Case Teaching, understanding internals Real-time applications
📸 Visual Example:
Before Equalization Histogram (Narrow) After Equalization Histogram (Spread)
Dark/low-contrast Centered cluster Bright/clearer Uniform spread
🧪 Hands-On Tip: Try in OpenCV
python
CopyEdit
import cv2
img = cv2.imread('image.jpg', 0)
equalized = cv2.equalizeHist(img)
cv2.imshow("Original", img)
cv2.imshow("Equalized", equalized)
🗓 Period 7: Advanced Histogram Techniques
Adaptive Histogram Equalization (AHE)
CLAHE (Contrast Limited AHE)
Comparison with global techniques
1. Recap: Global Histogram Equalization
Applies one transformation to the entire image.
Assumes uniform lighting.
May fail in:
o Images with varying illumination
o Local detail enhancement
🔍 2. Adaptive Histogram Equalization (AHE)
✅ What is AHE?
A local enhancement technique.
The image is divided into small regions (tiles or blocks).
Histogram equalization is applied independently to each region.
🧩 Key Steps:
1. Divide image into non-overlapping tiles (e.g., 8×8).
2. Perform histogram equalization on each tile.
3. Interpolate between neighboring tiles to avoid artifacts at boundaries.
📊 Pros:
Reveals local contrast and details.
Better for non-uniform illumination images.
⚠️Cons:
May amplify noise in homogeneous areas.
Can produce unnatural-looking images.
🌟 3. CLAHE – Contrast Limited Adaptive Histogram Equalization
✅ What is CLAHE?
A refined version of AHE that limits contrast enhancement to prevent noise over-
amplification.
🔐 How it Works:
Before applying histogram equalization on each tile, clip the histogram at a specified
limit (called clip limit).
Redistribute the excess uniformly across the histogram.
🔢 Parameters in CLAHE:
Clip Limit: Controls contrast amplification (lower = less enhancement).
Tile Size: Size of local regions.
💡 Why CLAHE is better than AHE:
Prevents over-saturation and noise amplification.
Used in sensitive applications like medical imaging and license plate recognition.
🧪 4. Comparison Table: Global vs. AHE vs. CLAHE
Feature Global Equalization AHE CLAHE
Scope Whole image Local (tiles) Local (tiles)
Enhancement Control None High Controlled via clip limit
Noise Amplification Low High Low
Speed Fast Slower Moderate
Use Case Uniform lighting Non-uniform lighting Precision enhancement
Feature Global Equalization AHE CLAHE
📸 5. Practical Examples
Application Technique Used Reason
Medical imaging CLAHE Enhances tissue contrast, avoids noise
Night surveillance AHE or CLAHE Reveals faces/objects in low light
Satellite imagery CLAHE Enhances terrain features
🧪 Example in OpenCV (Python):
python
CopyEdit
import cv2
img = cv2.imread('image.jpg', 0)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(8, 8))
clahe_img = clahe.apply(img)
cv2.imshow("Original", img)
cv2.imshow("CLAHE", clahe_img)
cv2.waitKey(0)
🗓 Period 8: Introduction to Spatial Filtering
Concept of filtering (neighborhood processing)
Convolution basics
Filter kernel explanation
1. Concept of Filtering (Neighborhood Processing)
✅ What is Spatial Filtering?
Spatial filtering involves modifying a pixel based on its value and the values of its
neighbors.
It uses a small matrix (filter kernel) to slide across the image and apply a
mathematical operation at each position.
🧱 Neighborhood Processing
Operates on a local region (e.g., 3×3 or 5×5 window).
Two main types:
o Linear filtering (e.g., mean, Gaussian)
o Non-linear filtering (e.g., median)
📌 2. Convolution Basics
🔄 What is Convolution?
A mathematical operation used to apply a filter to an image.
Kernel slides over the image, computes a sum of products at each location.
🧮 Convolution Operation:
g(x,y)=∑i=−aa∑j=−bbw(i,j)⋅f(x+i,y+j)g(x, y) = \sum_{i=-a}^{a} \sum_{j=-b}^{b} w(i, j) \cdot f(x+i,
y+j)g(x,y)=i=−a∑aj=−b∑bw(i,j)⋅f(x+i,y+j)
Where:
f(x, y): Input image
g(x, y): Output (filtered) image
w(i, j): Kernel (filter mask)
a, b: Half the size of the kernel (e.g., 1 for a 3×3 filter)
🧩 Padding
To apply a kernel at the edges, padding is used (e.g., zero-padding, reflection).
🖼 Stride
The step size of the kernel across the image (usually 1 in basic filtering).
📌 3. Filter Kernel Explanation
🧊 What is a Kernel (or Mask)?
A small matrix used to apply filtering.
Usually 3×3, 5×5, or 7×7 in size.
Determines what operation is performed (e.g., blur, edge detection).
📌 Example Kernels:
🗓 Period 9: Image Smoothing – Linear Filters
Averaging (mean) filter
Weighted average filter
Gaussian filter
Use in noise reduction
🗓 Period 10: Image Smoothing – Non-Linear Filters
Median filter
Minimum/maximum filter
Applications in impulse noise removal
🗓 Period 11: Image Sharpening – High-pass Filters
Laplacian operator
Unsharp masking
High-boost filtering
🗓 Period 12: Image Sharpening – Gradient Methods
Sobel operator
Prewitt operator
Roberts operator
Edge enhancement using gradients