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

Lecture- Fundamentals of Image Processing Using MATLAB

The lecture covers the fundamentals of image processing using MATLAB, focusing on various types of digital images, conversion between color spaces, and techniques for image enhancement and segmentation. Key topics include thresholding methods, edge detection using Sobel and Canny filters, and noise removal techniques. By the end of the lecture, students will be equipped to implement basic image processing operations in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views20 pages

Lecture- Fundamentals of Image Processing Using MATLAB

The lecture covers the fundamentals of image processing using MATLAB, focusing on various types of digital images, conversion between color spaces, and techniques for image enhancement and segmentation. Key topics include thresholding methods, edge detection using Sobel and Canny filters, and noise removal techniques. By the end of the lecture, students will be equipped to implement basic image processing operations in MATLAB.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

“Lecture: Fundamentals of Image Processing Using

MATLAB”

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 1 / 20
Learning Objectives
By the end of this lecture, students will be able to:
•Understand different types of digital images (RGB, Grayscale, Binary, HSV)

•Convert images between different color spaces in MATLAB

•Apply image thresholding techniques to segment images

•Enhance image quality through brightness and contrast adjustments

•Perform edge detection using Sobel and Canny methods

•Apply filtering techniques to remove noise from images

•Implement basic image processing operations using MATLAB code


Dr. Amr Hassan Universities of Canada in Egypt
Engineering Project II – ENGN 2220 2 / 20
Introduction to Image Processing

What is Image Processing?


•Image Processing is the technique of performing operations on digital images to enhance, analyze, or transform
them for various applications.

•It involves manipulating image pixels using algorithms to extract meaningful information, improve visual
appearance, or prepare images for further analysis.

Applications:
•Medical Imaging

•Object Detection

•Face Recognition

•Industrial Automation

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 3 / 20
Types of Images

•RGB (Truecolor) Image (Three channels: Red, Green, Blue)

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 4 / 20
Types of images
•Grayscale Image (Single-channel intensity values)

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 5 / 20
23
Types of Images
Binary (Thresholded) Image (Black & White)

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 6 / 20
Types of Images
HSV Image (Hue-Saturation-Value color model)

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 7 / 20
RGB Color Space
•Concept of RGB Colors
•3D Matrix Representation (Red, Green, Blue Channels)
•How images are stored in MATLAB (size, data type)
•Extracting & Manipulating Color Channels

MATLAB Demo:

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 8 / 20
Converting to Grayscale
In MATLAB, converting an RGB image to grayscale is typically done using the luminance formula, which accounts for
the human eye's sensitivity to different colors. The standard formula used is:

𝐼 = 0.2989. 𝑅 + 0.5870. 𝐺 + 0.1140. 𝐵

Explanation:
•The coefficients (𝟎. 𝟐𝟗𝟖𝟗, 𝟎. 𝟓𝟖𝟕𝟎, 𝟎. 𝟏𝟏𝟒𝟎) correspond to the perceived brightness contribution of the red,
green, and blue channels, respectively.

•The human eye is most sensitive to green, followed by red, and least sensitive to blue. That’s why the green
component has the highest weight.

•This formula is based on the luminance component (Y) of the YCbCr color model, used in image processing
and television broadcasting.

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 9 / 20
Converting to Grayscale
• Y (Luminance): Represents the perceived brightness of a pixel.
• Cb (Chrominance-Blue): Represents the difference between the blue component and the luminance.
• Cr (Chrominance-Red): Represents the difference between the red component and the luminance.

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 10 / 20
Image Thresholding & Binary Images
Thresholding is a segmentation technique used in image processing to convert a grayscale image into
a binary image (black and white). It works by selecting a threshold value (T) and converting all
pixels above this value to white (1)and all pixels below it to black (0).
Mathematically, thresholding is defined as:

1, 𝐼 𝑥, 𝑦 > 𝑇
𝐼𝑏𝑖𝑛𝑎𝑟𝑦 𝑥, 𝑦 = ቊ
0, 𝐼 𝑥, 𝑦 ≤ 𝑇

where:
• 𝐼 𝑥, 𝑦 is the grayscale intensity of a pixel.
• 𝑇 is the threshold value.
• 𝐼𝑏𝑖𝑛𝑎𝑟𝑦 (𝑥, 𝑦) is the output binary image.

- Thresholding is useful for object detection, edge detection, and noise reduction in images.

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 11 / 20
Global vs. Adaptive Thresholding
1. Global Thresholding
• A single threshold value 𝑻 is applied to the entire image.
• Works well when illumination is uniform.
• Common methods:
• Manual thresholding: The user selects 𝑇 based on the histogram.
• Otsu’s Method: Automatically determines an optimal threshold by minimizing the intra-class
variance of pixel intensities.

• Pros: Simple and Fast


• Cons: Fails when lightening conditions very across the image.

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 12 / 20
Adaptive Thresholding
• The threshold 𝑇(𝑥, 𝑦) varies across different regions of the image.
• Useful when lighting conditions are non-uniform (e.g., shadows, highlights).
• The threshold is computed based on a local neighborhood of each pixel.

Methods:
•Mean Thresholding: Uses the average intensity of the local neighborhood.
•Gaussian Thresholding: Uses a weighted Gaussian average for better smoothness.
•Otsu’s Adaptive Method: Applies Otsu’s thresholding in small image regions.

• Pros: Works well in non-uniform lighting conditions.


• Cons: Slower than global thresholding due to per-region computation.

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 13 / 20
HSV Color Space
Key Advantages of HSV over RGB:

1. Separates Color from Brightness


•In RGB, color and brightness are mixed, making color-based analysis difficult.
•In HSV, hue (H) represents the pure color, independent of brightness.
2. Better for Color-Based Segmentation
•If you want to detect a red object, the RGB values may vary due to lighting conditions.
•In HSV, you can isolate objects based on hue (H) alone, making it more robust to lighting changes.

HSV Color Model:

1. Hue (H) → "Color" (0° to 360°)


2. Saturation (S) → "Intensity" (0 to 1)
3. Value (V) → "Brightness" (0 to 1)

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 14 / 20
HSV Color Model

1. Hue (H) → "Color" (0° to 360°)


•Represents the color type (red, green, blue, etc.).
•Measured in degrees (°) on a color wheel:
• 0° = Red
• 120° = Green
• 240° = Blue

2. Saturation (S) → "Intensity" (0 to 1)


•Defines how pure the color is.
•1 (100%) = Full color
•0 (0%) = Shades of gray

3. Value (V) → "Brightness" (0 to 1)


•Defines the brightness level.
•1 (100%) = Fully bright
•0 (0%) = Completely black

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 15 / 20
Extract and Display Each HSV Channel

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 16 / 20
Basic Image Enhancements
• Adjusting Brightness & Contrast
• Histogram Equalization (Enhancing low-contrast images)

MATLAB Demo:

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 17 / 20
Edge Detection
Why detect edges? (Object detection, segmentation)
MATLAB Demo: Using Sobel & Canny filters

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 18 / 20
Edge Detection

Feature Sobel Canny


Gradient-Based Yes Yes
Noise Sensitive? Yes (No Smoothing) No (Uses Smoothing)
Edge Thickness Thick Thin & Precise
Yes (Hysteresis
Uses Thresholding? No
Thresholding)
Better for Complex
No Yes
Images?

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 19 / 20
Image Filtering & Noise Removal
• Types of Noise (Gaussian, Salt & Pepper)
• Mean, Median, Gaussian Filters

MATLAB Demo:

Dr. Amr Hassan Universities of Canada in Egypt


Engineering Project II – ENGN 2220 20 / 20

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy