0% found this document useful (0 votes)
3 views

ETM4272 Lecture03 ImageProcessing

Original Presentation created by Ashan Weeraratne 2024

Uploaded by

Ashan Weeraratne
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

ETM4272 Lecture03 ImageProcessing

Original Presentation created by Ashan Weeraratne 2024

Uploaded by

Ashan Weeraratne
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

ETM 4272: Machine Vision

LECTURER : ASHAN WE ERARATN E

ASHAN WEERARATNE FOT:USJ 1


Tools & References
Tools Online Resources:
First Principles of Computer Vision - Colombia
OpenCV Computational Photography - Udacity

Github Copilot

Books:
Handbook of Machine Vision – Alexander Hornberg

ASHAN WEERARATNE FOT:USJ 2


Lecture 03: Image Processing

Lecture Outcomes: Be able to:

o Apply techniques for controlling image contrast


o Describe image filtering techniques and their effects

ASHAN WEERARATNE FOT:USJ 3


Histograms - Recap
Binary Image
175 Pixels with value of 0. 125 Pixels with value of 1.

Grayscale Image: Pixel intensities range from 0 to 255.


Smaller bucket size will yield more precise information.

RGB Color Image: Pixel intensities range from 0 to 255 across 3 colors.
Smaller bucket size will yield more precise information.

ASHAN WEERARATNE FOT:USJ 4


Contrast Control using Histograms Equalization
Histogram Equalization:

Spreads out the pixel intensities more evenly


across the range.

In cases where histogram of original image


is tightly concentrated, histogram equalization
will increase contrast.

ASHAN WEERARATNE FOT:USJ 5


1

Histograms for Image Segmentation


Histogram Back-projection: Classify regions of images into classes based on the histogram of the region
Advantage in image segmentation:
o Does not require manually specifying thresholds or bounds
o Simply requires the specification of a region with similar characteristics

ASHAN WEERARATNE FOT:USJ 6


Image Filtering
Requirement for filters:

o Extract information of images based on their surroundings : Feature Extraction


▪ Detect Edges & Corners
▪ Detect Texture
▪ Detect Features such as ORB, SURF, HOG
▪ Match Templates

o Modify images based on their surroundings : Enhancement/ Transformation


▪ Add / Remove Noise
▪ Make color adjustments
▪ Add / Remove geometric distortions

ASHAN WEERARATNE FOT:USJ 7


1, 2,

Convolution Operation
A kernel is:

A square matrix with odd numbered rows.

Convolution is:

Sliding the kernel across an image while


performing element-wise multiplication to
generate to a feature map.

Convolution is the foremost mathematical tool


Convolution extracts information based on the
used to apply filters and extract features from
surroundings of a pixel.
images.

ASHAN WEERARATNE FOT:USJ 8


Applications of Image Filtering - I
Detail: Variations within an area
Smoothing/Blurring: Reduction of detail

Box Blur: Simple averaging of the receptive field


Gaussian Blur: More weight given to close neighbors
Median Blur: Sime median of the receptive field.
Preserves edges.

Sharpening:

Making the variations


more noticeable
Opposite of blurring

ASHAN WEERARATNE FOT:USJ 9


Image Filters for Edge Detection
Sobel X Kernel

Sobel Y Kernel

Edge detection act as the first step in Hough transforms. Hence, the emphasis on edge detectors.
ASHAN WEERARATNE FOT:USJ 10
Canny Edge Detector Algorithm
Problem: Some edges might be missed due to them not being
sharp enough to be picked up by the Sobel algorithm alone.

Algorithm

1. Run Sobel Detector on image


2. Create a high threshold for sure edges (This
will prevent non-edges being picked up,
but also will not pick-up mildly strong
edges)
3. Evaluate the proximity and connectivity of
unsure edges to sure edges
4. If an unsure edge is close and connected to
a sure edge, the unsure edge will also be
picked up.

ASHAN WEERARATNE FOT:USJ 11


1, 2

Hough Transforms
Boundary Detection: Edge detection, followed by figuring out which edges are boundaries of an object
Another parameterization of a generic line
Hough Circles:

3 dimensional accumulator matrix


Hough Line Detection
with the parameters a, b, r
1. An accumulator matrix with all
Other Shapes:
elements zero is created.
2. One by one, the line-bits are selected,
Same algorithm, with n-dimensional
and the corresponding element in the
accumulator matrices, depending
accumulator matrix is incremented.
on the parameterization of the
3. Once all line-bits are exhausted, the
shape.
accumulator entry with the strongest
intensity are the strongest candidates
for line fits.

ASHAN WEERARATNE FOT:USJ 12


1, 2

Case Study: Lane Detection

1 2 3 4

5 6 7 8

ASHAN WEERARATNE FOT:USJ 13


Lane Detection Step by Step
1. The color image obtained from the dashboard
2. Upon converting to grayscale and thresholding
3. The region of interest to search for lanes
4. Upon running the AND operation between the results of 2 & the ROI mask
5. Upon running Canny edge detector on the results of 4
6. Upon running Hough transforms on the results of 5
7. Upon selecting the most suitable candidate lines
8. The most suitable line drawn on the original color image

ASHAN WEERARATNE FOT:USJ 14


Discussion
Using Morphological
Operations:
Image Closing

Using ML:
kNN based Clustering

Using ANN:
Semantic Segmentation ANN
How to get the non-detected pixel region
which is circled, to be classified as
belonging to the car?

ASHAN WEERARATNE FOT:USJ 15


Optional Activities:

- OpenCV Bootcamp
End of Lecture 03

Lecture 04:

- Morphological Operations

ASHAN WEERARATNE FOT:USJ 16

You might also like