9/20/2023
Computer Vision
With Deep
Learning
Lecture 1: Introduction to Computer Vision
1. What’s Computer vision?
2. Image Representation
3. Color Spaces
Content 4. Image Transformations
5. Filters and Convolutions
6. Useful Libraries
7. Exercise 1: Loading and Pre-processing Images with
TensorFlow
ISITCOM 3DNI [Link]@[Link] 2023-2024 2
1
9/20/2023
1. What’s Computer
vision?
ISITCOM 3DNI [Link]@[Link] 2023-2024 3
What’s Computer Vision?
❑ “At an abstract level, the goal of computer
vision problems is to use the observed image
data to infer something about the world”.
Page 83, Computer Vision: Models,
Learning, and Inference, 2012.
❑ Computer vision is a field of artificial
intelligence (AI) that enables computers to
derive meaningful information from digital
images and videos and understand the
visual world.
ISITCOM 3DNI [Link]@[Link] 2023-2024 4
2
9/20/2023
Related Domains
❑Signal Processing: process electronic signals to
remove noise, extract information or prepare
them for further processing.
❑Image Processing: process digital images to
improve their quality, convert them into another
format or change them for further processing.
❑Machine Learning: help computers to
recognize patterns in images and understand
what they see.
❑Robot Vision and Machine Vision are
applications of computer vision in Robotics and
Industrial domains.
ISITCOM 3DNI [Link]@[Link] 2023-2024 5
Robot Vision
ISITCOM 3DNI [Link]@[Link] 2023-2024 6
3
9/20/2023
Machine Vision
Automatic Industrial Inspection
ISITCOM 3DNI [Link]@[Link] 2023-2024 7
Computer Vision Tasks
ISITCOM 3DNI [Link]@[Link] 2023-2024 8
4
9/20/2023
Advanced Computer Vision Tasks
ISITCOM 3DNI [Link]@[Link] 2023-2024 9
Computer Vision Applications
❑ Computer Vision has a many applications such as in retail, security, sports, healthcare,
automotive, manufacturing, and agriculture.
ISITCOM 3DNI [Link]@[Link] 2023-2024 10
10
5
9/20/2023
Computer Vision in Retail
ISITCOM 3DNI [Link]@[Link] 2023-2024 11
11
Computer Vision in Security
ISITCOM 3DNI [Link]@[Link] 2023-2024 12
12
6
9/20/2023
Computer Vision in Sports
ISITCOM 3DNI [Link]@[Link] 2023-2024 13
13
Computer Vision in Healthcare
ISITCOM 3DNI [Link]@[Link] 2023-2024 14
14
7
9/20/2023
Computer Vision in Automotive
ISITCOM 3DNI [Link]@[Link] 2023-2024 15
15
Computer Vision in Manufacturing
ISITCOM 3DNI [Link]@[Link] 2023-2024 16
16
8
9/20/2023
Computer Vision in Agriculture
ISITCOM 3DNI [Link]@[Link] 2023-2024 17
17
2. Image Representation
ISITCOM 3DNI [Link]@[Link] 2023-2024 18
18
9
9/20/2023
Grayscale Image Representation
A grayscale image
0 = black
2D matrix of pixels 255 = White
ISITCOM 3DNI [Link]@[Link] 2023-2024 19
19
RGB Image Representation
ISITCOM 3DNI [Link]@[Link] 2023-2024 20
20
10
9/20/2023
Pixel Grid System
ISITCOM 3DNI [Link]@[Link] 2023-2024 21
21
Image Coordinates
ISITCOM 3DNI [Link]@[Link] 2023-2024 22
22
11
9/20/2023
3. Color Spaces
ISITCOM 3DNI [Link]@[Link] 2023-2024 23
23
Color Spaces: Gray, RGB and HSV
In general, 3 color spaces are prevalent in modern
computer vision:
❑ GRAY: It eliminates color information by translating
to shades of gray: Y = 0.299xR + 0.587xG + 0.114xB.
❑ RGB: Each pixel is a three-element array, each value
representing the red, green, and blue colors.
❑ HSV: hue is a color tone, saturation is the intensity
of a color, and value represents its brightness.
ISITCOM 3DNI [Link]@[Link] 2023-2024 24
24
12
9/20/2023
Convert RGB to Grayscale
ISITCOM 3DNI [Link]@[Link] 2023-2024 25
25
Convert RGB to HSV
ISITCOM 3DNI [Link]@[Link] 2023-2024 26
26
13
9/20/2023
4. Image Transformations
ISITCOM 3DNI [Link]@[Link] 2023-2024 27
27
Image Resizing
❑ Various interpolation algorithms can be used to interpolate the new pixel values e.g., linear,
cubic, and nearest neighbor.
ISITCOM 3DNI [Link]@[Link] 2023-2024 28
28
14
9/20/2023
Image Cropping
❑ Cropping an image to get the region of interest (ROI) can be done easily by slicing the image
array and taking the new indices values.
ISITCOM 3DNI [Link]@[Link] 2023-2024 29
29
Geometric Transformation
Original Image
ISITCOM 3DNI [Link]@[Link] 2023-2024 30
30
15
9/20/2023
Thresholding
❑ In image processing, thresholding means to update the pixel’s value to either white or black
according to a threshold value.
ISITCOM 3DNI [Link]@[Link] 2023-2024 31
31
5. Filtering & Convolution
ISITCOM 3DNI [Link]@[Link] 2023-2024 32
32
16
9/20/2023
Image Filtering
❑ Image filtering is a fundamental concept in image
processing.
❑ Image filtering involves modifying each pixel's
value in an image based on the values of its
neighboring pixels.
❑ A filter (or kernel) is applied to an image to:
▪ Improve image quality
▪ Highlight specific details
▪ Remove noise and artifacts
▪ Detect edges and patterns
ISITCOM 3DNI [Link]@[Link] 2023-2024 33
33
Types of Image Filters
❑ Smoothing Filters (Low-Pass Filters)
▪ Examples: Gaussian, Mean, Median filters.
▪ Used for noise reduction and blurring.
❑ Sharpening Filters (High-Pass Filters)
▪ Examples: Laplacian, Sobel, Prewitt filters.
▪ Enhance edges and fine details.
ISITCOM 3DNI [Link]@[Link] 2023-2024 34
34
17
9/20/2023
Image Convolution
❑ Image convolution is a mathematical
operation that enhances, modifies, or extracts
features in an image by applying a filter or
kernel based on the values of neighboring
pixels.
ISITCOM 3DNI [Link]@[Link] 2023-2024 35
35
2D Convolution
ISITCOM 3DNI [Link]@[Link] 2023-2024 36
36
18
9/20/2023
6. Useful Libraries
ISITCOM 3DNI [Link]@[Link] 2023-2024 37
37
OpenCV
ISITCOM 3DNI [Link]@[Link] 2023-2024 38
38
19
9/20/2023
TensorFlow
❑ End-to-end open-source platform
for machine learning and artificial
intelligence.
❑ TensorFlow is used for the training
and inference of deep neural
networks.
❑ Multi OS (Windows, Linux, Android,
Mac OS) and multi processor (CPU,
GPU, TPU, Cloud).
ISITCOM 3DNI [Link]@[Link] 2023-2024 39
39
❑ Deep learning API written in Python and running on top of the machine learning
platform TensorFlow.
❑ User-friendly that is designed to enable easy and fast experimentation with DL.
❑ Reliable, modular, and extensible that works with multi-backend and multi-platform.
❑ Powerful that provides industry-strength performance and scalability.
ISITCOM 3DNI [Link]@[Link] 2023-2024 40
40
20
9/20/2023
Installation
❑ Step (1): Download the *.exe file from [Link] and
install Anaconda.
❑ Step (2): Lunch Anaconda’s CMD terminal and execute ‘conda create --name myenv’
to create a new environment myenv and active using ‘conda activate myenv’.
❑ Step (3): Install Tensorflow using ‘conda install -c conda-forge tensorflow-gpu’ for
NVIDA Graphic cards.
❑ Step (4): Install OpenCV using ‘conda install -c conda-forge opencv’.
ISITCOM 3DNI [Link]@[Link] 2023-2024 41
41
EX1: Loading and Pre-processing Images
with TensorFlow
ISITCOM 3DNI [Link]@[Link] 2023-2024 42
42
21
9/20/2023
Loading Built-in Image Dataset
ISITCOM 3DNI [Link]@[Link] 2023-2024 43
43
Image
Visualization
ISITCOM 3DNI [Link]@[Link] 2023-2024 44
44
22
9/20/2023
Image
Preprocessing
ISITCOM 3DNI [Link]@[Link] 2023-2024 45
45
Image Transformation
ISITCOM 3DNI [Link]@[Link] 2023-2024 46
46
23