Fip Notes
Fip Notes
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.
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.
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.
Image processing tasks can be categorized based on the complexity and purpose of the
operation:
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
Example:
o Deterministic: Applying a fixed sharpening filter.
o Stochastic: Using probabilistic models to detect faces with uncertain data.
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
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.
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.
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.
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.
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
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.
Color Images:
Typically stored as 3 channels (Red, Green, Blue) per pixel. Each channel has
intensity values.
a) Image Enhancement
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.
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
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.
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)
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.
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
3. Segmentation
5. Recognition
6. Interpretation
7. Knowledge Base
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)|
+-------------------+
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
3D Volume data with width, height, and depth Medical CT or MRI scans, 3D models
Grayscale Pixels represent intensity levels (0 to 255) Black & white photos, X-rays
Images with many narrow spectral bands Advanced remote sensing, mineral
Hyperspectral
(>100) exploration
Dynamic Image (Video) Sequence of images over time Movies, surveillance footage
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
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.
b) Security Systems
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.
Aliasing:
Distortion or artifacts (e.g., jagged edges) caused by insufficient sampling.
Anti-Aliasing:
Techniques to reduce aliasing by smoothing or filtering before sampling.
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
3. Compressed Formats
a) Lossless Compression
b) Lossy Compression
4. Importance of Compression
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
2. Image Metadata
📁 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
Using MATLAB:
matlab
CopyEdit
info = imfinfo('image.jpg'); % View metadata
img = imread('image.jpg'); % Read image
imshow(img);
image = Image.open('photo.jpg')
exif_data = image._getexif()
for tag, value in exif_data.items():
print(f"{TAGS.get(tag)}: {value}")
Unit: 2
Image Enhancement
Topics Covered:
🔎 Simple definition: "How good an image looks or how useful it is for a specific purpose
(e.g., diagnosis, surveillance, analysis)."
✅ a. Noise
✅ b. Blur
🎯 Goal of Enhancement: Improve these quality factors without losing important image
information.
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
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
✅ a. Medical Imaging
🛠 Example: Blurry or low-contrast images can mislead a face detection algorithm or produce
errors in license plate recognition.
Focus Local features, edges, smoothing Periodic patterns, textures, global features
📌 Example:
💡 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)]
✅ Types of Transformations T:
📌 4. Visual Illustration
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:
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
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
🔹 3. Negative Transformation
Purpose: Produces a photographic negative of the image; useful for enhancing white or gray
details in dark regions.
s=L−1−rs = L - 1 - rs=L−1−r
where:
These are non-linear transformations used to enhance details in different brightness ranges.
a. Log Transformation
Formula:
Contrast stretching
Gray-level slicing
Bit-plane slicing
Real-life applications of piecewise operations
🔹 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:
📊 Visual Representation:
✅ 2. Gray-Level Slicing
🔹 Types:
🔹 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
✅ Use Case:
✅ 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:
✅ Insights:
✅ Use Case:
Image compression
Steganography (hiding information in LSBs)
📸 4. Real-Life Applications of Piecewise Operations
Technique Real-World Application Benefit
Histogram generation
Histogram equalization: concept and procedure
Manual and automatic equalization
📊 Example:
🧮 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.
🎯 Goal:
Enhance contrast by spreading out the intensity values evenly across the histogram.
🔍 Concept:
🔢 Procedure:
📐 Mathematical Formula:
Where:
equalizeHist)
📸 Visual Example:
✅ What is AHE?
🧩 Key Steps:
📊 Pros:
⚠️Cons:
✅ 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:
📸 5. Practical Examples
Application Technique Used Reason
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)
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
📌 2. Convolution Basics
🔄 What is Convolution?
🧮 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:
🧩 Padding
🖼 Stride
The step size of the kernel across the image (usually 1 in basic filtering).
📌 Example Kernels:
Median filter
Minimum/maximum filter
Applications in impulse noise removal
Laplacian operator
Unsharp masking
High-boost filtering
Sobel operator
Prewitt operator
Roberts operator
Edge enhancement using gradients