SlideShare une entreprise Scribd logo
1  sur  45
Practical 5 - Digital Image
Processing
Aly Osama
‫اﻟﻣﺗﻧﺑﻰ‬
Stages of Computer Vision
Agenda
1. Stereo Images
2. Optical Flow
3. Machine Learning
a. Classification ( KNN - SVM )
b. Clustering ( K-means )
4. Practical Demo
5. Project
6. Assignment
7. AI Companies
Stereo Vision
Depth Map from Stereo Images
https://www.youtube.com/watch?v=O7B2vCsTpC0
Stereo Vision Idea
The diagram contains equivalent triangles. Writing their
equivalent equations will yield us following result:
x and x′ are the distance between points in image plane corresponding
to the scene point 3D and their camera center. B is the distance
between two cameras (which we know) and f is the focal length of
camera (already known).
above equation says that the depth of a point in a scene is
inversely proportional to the difference in distance of
corresponding image points and their camera centers. So
with this information, we can derive the depth of all pixels
in an image.
Depth Map from Stereo Images
Optical Flow
Optical Flow
Optical flow is the pattern of apparent motion of
image objects between two consecutive frames
caused by the movement of object or camera. It is
2D vector field where each vector is a displacement
vector showing the movement of points from first
frame to second.
Optical flow works on several assumptions:
1. The pixel intensities of an object do not change
between consecutive frames.
2. Neighbouring pixels have similar motion.
Consider a pixel I(x,y,t) in first frame It moves by distance (dx,dy) in next frame taken after
dt time. So since those pixels are the same and intensity does not change, we can say,
I(x,y,t)=I(x+dx,y+dy,t+dt)
Then take taylor series approximation:
fx u+fy v+ft=0
where:
fx=∂f/∂x ; fy=∂f/∂y
u=dx/dt ; v=dy/dt
Above equation is called Optical Flow equation. In it, we can find fx and fy, they are image
gradients. Similarly ft is the gradient along time.
But we cannot get u and v from one equation?!
Optical Flow Equations
Lucas-Kanade Method
Lucas-Kanade method takes a 3x3 patch around the point. So all the 9 points
have the same motion. We can find (fx,fy,ft) for these 9 points.
So now our problem becomes solving 9 equations with two unknown variables
which is over-determined.
using least square fit method.
Lucas-Kanade Optical flow in OpenCV
Step 1: Get features points
Step 2: Track extracted features points using Optical flow
Dense Optical flow in OpenCV
Machine Learning
Machine Learning vs Deep Learning
Classification vs Clustering
Some Machine learning algorithms
1. Classification
a. KNN
b. SVM
2. Clustering
a. K-means
b. DBscan
Classification ( KNN - SVM )
Understanding
KNN
Understanding K-Nearest Neighbour
kNN is one of the simplest of classification algorithms available for supervised
learning. The idea is to search for closest match of the test data in feature space.
KNN -> Human Classifier
KNN in OpenCV
Understanding
SVM
Linearly Separable Data
Considering the data given in image, or consider that
We find a line, which divides both
the data to two regions. When we get a new test_data
X just substitute it in f(x).if f(x) > 0 it belongs to blue
group, else it belongs to red group. We can call this
line as Decision Boundary. It is very simple and
memory-efficient. Such data which can be divided
into two with a straight line (or hyperplanes in
higher dimensions) is called Linear Separable.
Linearly Separable Data
So to find this Decision Boundary, you need training
data. Do you need all? NO. Just the ones which are
close to the opposite group are sufficient. In our
image, they are the one blue filled circle and two red
filled squares. We can call them Support Vectors and
the lines passing through them are called Support
Planes. They are adequate for finding our decision
boundary. We need not worry about all the data. It
helps in data reduction.
Clustering ( K-means )
T-Shirt Size
Problem
Consider a company, which is going to release a new model of T-shirt to market.
Obviously they will have to manufacture models in different sizes to satisfy
people of all sizes. So the company make a data of people’s height and weight,
and plot them on to a graph, as below:
Company can’t create t-shirts with all the sizes. Instead, they divide people to
Small, Medium and Large, and manufacture only these 3 models which will fit
into all the people. This grouping of people into three groups can be done by
k-means clustering, and algorithm provides us best 3 sizes, which will satisfy all
the people. And if it doesn’t, company can divide people to more groups, may be
five, and so on. Check image below :
How does it work?
Consider a set of data as below ( You can consider it as t-shirt problem). We need
to cluster this data into two groups.
Step : 1 - Algorithm randomly chooses two
centroids, C1, C2 (sometimes, any two data are
taken as the centroids).
Step : 2 - It calculates the distance from each
point to both centroids. If a test data is more
closer to C1 then that data is labelled with ‘0’. If it
is closer to C2.then labelled as ‘1’ (If more
centroids are there, labelled as ‘2’,‘3’ etc). In our
case, we will color all ‘0’ labelled with red, and ‘1’
labelled with blue. So we get following image after
above operations
Step : 3 - Next we calculate the average of all blue
points and red points separately and that will be
our new centroids. That is C1 and C2 shift to
newly calculated centroids. (Remember, the
images shown are not true values and not to true
scale, it is just for demonstration only). And again,
perform step 2 with new centroids and label data
to ‘0’ and ‘1’.
Now Step - 2 and Step - 3 are iterated until both
centroids are converged to fixed points. (Or it may
be stopped depending on the criteria we provide, like
maximum number of iterations, or a specific
accuracy is reached etc.) These points are such
that sum of distances between test data and their
corresponding centroids are minimum. Or
simply, sum of distances between
Practical Demo
Face Detection using Haar Cascades
https://pythonprogramming.net/haar-c
ascade-face-eye-detection-python-ope
ncv-tutorial/
Beyond Image Processing
Deep Neural Networks
http://cs231n.stanford.edu/
Project
Project
● Deadline: 30th April.
● Submission Form: https://goo.gl/forms/hdmELnD8qmOxVVVh2
a. Demo video on Facebook or Youtube
b. Project source code on github
Assignment
The last assignment ever ( So far )
1. Update your C.V. , Linkedin and Wuzzuf with your projects and assignments
2. Make a list of companies you want to work for and rank them based on your
interest
3. Start to send emails with your C.V. to their HR and their employees (SPAM
their Inbox)
4. Don’t worry “‫رزق‬ ‫”اﻟﻌﻤﻞ‬
AI driven companies in Egypt
(60 Companies)
https://my-interviews-experience-in-egypt.quora.com/AI-Driven-Companies-in-Egypt
Thank you and Good Luck

Contenu connexe

Tendances

Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough TransformMrunal Selokar
 
Edge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicEdge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicIJERA Editor
 
02_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_201402_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_2014Atiqa khan
 
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space IJEEE
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionDawn Raider Gupta
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extractionRishabh shah
 
Point Cloud Segmentation for 3D Reconstruction
Point Cloud Segmentation for 3D ReconstructionPoint Cloud Segmentation for 3D Reconstruction
Point Cloud Segmentation for 3D ReconstructionPirouz Nourian
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processingasodariyabhavesh
 
Color vs texture feature extraction and matching in visual content retrieval ...
Color vs texture feature extraction and matching in visual content retrieval ...Color vs texture feature extraction and matching in visual content retrieval ...
Color vs texture feature extraction and matching in visual content retrieval ...IAEME Publication
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamNazmul Islam
 
3D Graphics
3D Graphics3D Graphics
3D GraphicsViTAly
 
Study and Comparison of Various Image Edge Detection Techniques
Study and Comparison of Various Image Edge Detection TechniquesStudy and Comparison of Various Image Edge Detection Techniques
Study and Comparison of Various Image Edge Detection TechniquesCSCJournals
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processingDheeban Smart
 
Performance analysis of chain code descriptor for hand shape classification
Performance analysis of chain code descriptor for hand shape classificationPerformance analysis of chain code descriptor for hand shape classification
Performance analysis of chain code descriptor for hand shape classificationijcga
 

Tendances (20)

Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough Transform
 
FEATURE EXTRACTION USING SURF ALGORITHM FOR OBJECT RECOGNITION
FEATURE EXTRACTION USING SURF ALGORITHM FOR OBJECT RECOGNITIONFEATURE EXTRACTION USING SURF ALGORITHM FOR OBJECT RECOGNITION
FEATURE EXTRACTION USING SURF ALGORITHM FOR OBJECT RECOGNITION
 
Edge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicEdge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy Logic
 
02_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_201402_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_2014
 
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
Hybrid Technique for Copy-Move Forgery Detection Using L*A*B* Color Space
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
 
Local binary pattern
Local binary patternLocal binary pattern
Local binary pattern
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extraction
 
Visual realism
Visual realismVisual realism
Visual realism
 
Point Cloud Segmentation for 3D Reconstruction
Point Cloud Segmentation for 3D ReconstructionPoint Cloud Segmentation for 3D Reconstruction
Point Cloud Segmentation for 3D Reconstruction
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
Color vs texture feature extraction and matching in visual content retrieval ...
Color vs texture feature extraction and matching in visual content retrieval ...Color vs texture feature extraction and matching in visual content retrieval ...
Color vs texture feature extraction and matching in visual content retrieval ...
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul Islam
 
3 d
3 d3 d
3 d
 
3D Graphics
3D Graphics3D Graphics
3D Graphics
 
Study and Comparison of Various Image Edge Detection Techniques
Study and Comparison of Various Image Edge Detection TechniquesStudy and Comparison of Various Image Edge Detection Techniques
Study and Comparison of Various Image Edge Detection Techniques
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processing
 
Camshaft
CamshaftCamshaft
Camshaft
 
Performance analysis of chain code descriptor for hand shape classification
Performance analysis of chain code descriptor for hand shape classificationPerformance analysis of chain code descriptor for hand shape classification
Performance analysis of chain code descriptor for hand shape classification
 

Similaire à Practical Digital Image Processing 5

Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionAnish Patel
 
SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxMohamedMonir33
 
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...mmjalbiaty
 
Unit II & III_uncovered topics.doc notes
Unit II & III_uncovered topics.doc notesUnit II & III_uncovered topics.doc notes
Unit II & III_uncovered topics.doc notessmithashetty24
 
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an ObjectAnkur Tyagi
 
Introduction to Machine Vision
Introduction to Machine VisionIntroduction to Machine Vision
Introduction to Machine VisionNasir Jumani
 
Advance image processing
Advance image processingAdvance image processing
Advance image processingAAKANKSHA JAIN
 
One dimensional vector based pattern
One dimensional vector based patternOne dimensional vector based pattern
One dimensional vector based patternijcsit
 
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUES
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUESA STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUES
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUEScscpconf
 
A comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrievalA comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrievalcsandit
 
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVALA COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVALcscpconf
 
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...sipij
 
Performance Improvement of Vector Quantization with Bit-parallelism Hardware
Performance Improvement of Vector Quantization with Bit-parallelism HardwarePerformance Improvement of Vector Quantization with Bit-parallelism Hardware
Performance Improvement of Vector Quantization with Bit-parallelism HardwareCSCJournals
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialpotaters
 
Automatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather MonitoringAutomatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather Monitoringguest7782414
 
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...Simplilearn
 

Similaire à Practical Digital Image Processing 5 (20)

Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer VisionSimple Pendulum Experiment and Automatic Survey Grading using Computer Vision
Simple Pendulum Experiment and Automatic Survey Grading using Computer Vision
 
SVM & KNN Presentation.pptx
SVM & KNN Presentation.pptxSVM & KNN Presentation.pptx
SVM & KNN Presentation.pptx
 
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...
Image Interpolation Techniques with Optical and Digital Zoom Concepts -semina...
 
Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
 
Unit II & III_uncovered topics.doc notes
Unit II & III_uncovered topics.doc notesUnit II & III_uncovered topics.doc notes
Unit II & III_uncovered topics.doc notes
 
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object3D Reconstruction from Multiple uncalibrated 2D Images of an Object
3D Reconstruction from Multiple uncalibrated 2D Images of an Object
 
Digital.cc
Digital.ccDigital.cc
Digital.cc
 
mini prjt
mini prjtmini prjt
mini prjt
 
Introduction to Machine Vision
Introduction to Machine VisionIntroduction to Machine Vision
Introduction to Machine Vision
 
Advance image processing
Advance image processingAdvance image processing
Advance image processing
 
One dimensional vector based pattern
One dimensional vector based patternOne dimensional vector based pattern
One dimensional vector based pattern
 
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUES
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUESA STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUES
A STUDY AND ANALYSIS OF DIFFERENT EDGE DETECTION TECHNIQUES
 
A comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrievalA comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrieval
 
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVALA COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
 
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
 
Performance Improvement of Vector Quantization with Bit-parallelism Hardware
Performance Improvement of Vector Quantization with Bit-parallelism HardwarePerformance Improvement of Vector Quantization with Bit-parallelism Hardware
Performance Improvement of Vector Quantization with Bit-parallelism Hardware
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 
Automatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather MonitoringAutomatic Classification Satellite images for weather Monitoring
Automatic Classification Satellite images for weather Monitoring
 
sduGroupEvent
sduGroupEventsduGroupEvent
sduGroupEvent
 
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 2 | Machine Learning Tutorial For Beginners ...
 

Plus de Aly Abdelkareem

An Inductive inference Machine
An Inductive inference MachineAn Inductive inference Machine
An Inductive inference MachineAly Abdelkareem
 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersAly Abdelkareem
 
Deep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularizationDeep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularizationAly Abdelkareem
 
Pattern recognition 4 - MLE
Pattern recognition 4 - MLEPattern recognition 4 - MLE
Pattern recognition 4 - MLEAly Abdelkareem
 
Practical Digital Image Processing 1
Practical Digital Image Processing 1Practical Digital Image Processing 1
Practical Digital Image Processing 1Aly Abdelkareem
 
Machine Learning for Everyone
Machine Learning for EveryoneMachine Learning for Everyone
Machine Learning for EveryoneAly Abdelkareem
 
How to use deep learning on biological data
How to use deep learning on biological dataHow to use deep learning on biological data
How to use deep learning on biological dataAly Abdelkareem
 
Deep Learning using Keras
Deep Learning using KerasDeep Learning using Keras
Deep Learning using KerasAly Abdelkareem
 
Object extraction from satellite imagery using deep learning
Object extraction from satellite imagery using deep learningObject extraction from satellite imagery using deep learning
Object extraction from satellite imagery using deep learningAly Abdelkareem
 
Pattern recognition Tutorial 2
Pattern recognition Tutorial 2Pattern recognition Tutorial 2
Pattern recognition Tutorial 2Aly Abdelkareem
 
Android Udacity Study group 1
Android Udacity Study group 1Android Udacity Study group 1
Android Udacity Study group 1Aly Abdelkareem
 
Java for android developers
Java for android developersJava for android developers
Java for android developersAly Abdelkareem
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 

Plus de Aly Abdelkareem (13)

An Inductive inference Machine
An Inductive inference MachineAn Inductive inference Machine
An Inductive inference Machine
 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency Filters
 
Deep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularizationDeep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularization
 
Pattern recognition 4 - MLE
Pattern recognition 4 - MLEPattern recognition 4 - MLE
Pattern recognition 4 - MLE
 
Practical Digital Image Processing 1
Practical Digital Image Processing 1Practical Digital Image Processing 1
Practical Digital Image Processing 1
 
Machine Learning for Everyone
Machine Learning for EveryoneMachine Learning for Everyone
Machine Learning for Everyone
 
How to use deep learning on biological data
How to use deep learning on biological dataHow to use deep learning on biological data
How to use deep learning on biological data
 
Deep Learning using Keras
Deep Learning using KerasDeep Learning using Keras
Deep Learning using Keras
 
Object extraction from satellite imagery using deep learning
Object extraction from satellite imagery using deep learningObject extraction from satellite imagery using deep learning
Object extraction from satellite imagery using deep learning
 
Pattern recognition Tutorial 2
Pattern recognition Tutorial 2Pattern recognition Tutorial 2
Pattern recognition Tutorial 2
 
Android Udacity Study group 1
Android Udacity Study group 1Android Udacity Study group 1
Android Udacity Study group 1
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 

Dernier

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Dernier (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Practical Digital Image Processing 5

  • 1. Practical 5 - Digital Image Processing Aly Osama
  • 4. Agenda 1. Stereo Images 2. Optical Flow 3. Machine Learning a. Classification ( KNN - SVM ) b. Clustering ( K-means ) 4. Practical Demo 5. Project 6. Assignment 7. AI Companies
  • 6. Depth Map from Stereo Images https://www.youtube.com/watch?v=O7B2vCsTpC0
  • 7. Stereo Vision Idea The diagram contains equivalent triangles. Writing their equivalent equations will yield us following result: x and x′ are the distance between points in image plane corresponding to the scene point 3D and their camera center. B is the distance between two cameras (which we know) and f is the focal length of camera (already known). above equation says that the depth of a point in a scene is inversely proportional to the difference in distance of corresponding image points and their camera centers. So with this information, we can derive the depth of all pixels in an image.
  • 8. Depth Map from Stereo Images
  • 10. Optical Flow Optical flow is the pattern of apparent motion of image objects between two consecutive frames caused by the movement of object or camera. It is 2D vector field where each vector is a displacement vector showing the movement of points from first frame to second. Optical flow works on several assumptions: 1. The pixel intensities of an object do not change between consecutive frames. 2. Neighbouring pixels have similar motion.
  • 11. Consider a pixel I(x,y,t) in first frame It moves by distance (dx,dy) in next frame taken after dt time. So since those pixels are the same and intensity does not change, we can say, I(x,y,t)=I(x+dx,y+dy,t+dt) Then take taylor series approximation: fx u+fy v+ft=0 where: fx=∂f/∂x ; fy=∂f/∂y u=dx/dt ; v=dy/dt Above equation is called Optical Flow equation. In it, we can find fx and fy, they are image gradients. Similarly ft is the gradient along time. But we cannot get u and v from one equation?! Optical Flow Equations
  • 12. Lucas-Kanade Method Lucas-Kanade method takes a 3x3 patch around the point. So all the 9 points have the same motion. We can find (fx,fy,ft) for these 9 points. So now our problem becomes solving 9 equations with two unknown variables which is over-determined. using least square fit method.
  • 13. Lucas-Kanade Optical flow in OpenCV Step 1: Get features points
  • 14. Step 2: Track extracted features points using Optical flow
  • 15. Dense Optical flow in OpenCV
  • 17. Machine Learning vs Deep Learning
  • 19. Some Machine learning algorithms 1. Classification a. KNN b. SVM 2. Clustering a. K-means b. DBscan
  • 22. Understanding K-Nearest Neighbour kNN is one of the simplest of classification algorithms available for supervised learning. The idea is to search for closest match of the test data in feature space.
  • 23. KNN -> Human Classifier
  • 26. Linearly Separable Data Considering the data given in image, or consider that We find a line, which divides both the data to two regions. When we get a new test_data X just substitute it in f(x).if f(x) > 0 it belongs to blue group, else it belongs to red group. We can call this line as Decision Boundary. It is very simple and memory-efficient. Such data which can be divided into two with a straight line (or hyperplanes in higher dimensions) is called Linear Separable.
  • 27. Linearly Separable Data So to find this Decision Boundary, you need training data. Do you need all? NO. Just the ones which are close to the opposite group are sufficient. In our image, they are the one blue filled circle and two red filled squares. We can call them Support Vectors and the lines passing through them are called Support Planes. They are adequate for finding our decision boundary. We need not worry about all the data. It helps in data reduction.
  • 30. Consider a company, which is going to release a new model of T-shirt to market. Obviously they will have to manufacture models in different sizes to satisfy people of all sizes. So the company make a data of people’s height and weight, and plot them on to a graph, as below:
  • 31. Company can’t create t-shirts with all the sizes. Instead, they divide people to Small, Medium and Large, and manufacture only these 3 models which will fit into all the people. This grouping of people into three groups can be done by k-means clustering, and algorithm provides us best 3 sizes, which will satisfy all the people. And if it doesn’t, company can divide people to more groups, may be five, and so on. Check image below :
  • 32. How does it work? Consider a set of data as below ( You can consider it as t-shirt problem). We need to cluster this data into two groups.
  • 33. Step : 1 - Algorithm randomly chooses two centroids, C1, C2 (sometimes, any two data are taken as the centroids). Step : 2 - It calculates the distance from each point to both centroids. If a test data is more closer to C1 then that data is labelled with ‘0’. If it is closer to C2.then labelled as ‘1’ (If more centroids are there, labelled as ‘2’,‘3’ etc). In our case, we will color all ‘0’ labelled with red, and ‘1’ labelled with blue. So we get following image after above operations
  • 34. Step : 3 - Next we calculate the average of all blue points and red points separately and that will be our new centroids. That is C1 and C2 shift to newly calculated centroids. (Remember, the images shown are not true values and not to true scale, it is just for demonstration only). And again, perform step 2 with new centroids and label data to ‘0’ and ‘1’.
  • 35. Now Step - 2 and Step - 3 are iterated until both centroids are converged to fixed points. (Or it may be stopped depending on the criteria we provide, like maximum number of iterations, or a specific accuracy is reached etc.) These points are such that sum of distances between test data and their corresponding centroids are minimum. Or simply, sum of distances between
  • 37. Face Detection using Haar Cascades https://pythonprogramming.net/haar-c ascade-face-eye-detection-python-ope ncv-tutorial/
  • 41. Project ● Deadline: 30th April. ● Submission Form: https://goo.gl/forms/hdmELnD8qmOxVVVh2 a. Demo video on Facebook or Youtube b. Project source code on github
  • 43. The last assignment ever ( So far ) 1. Update your C.V. , Linkedin and Wuzzuf with your projects and assignments 2. Make a list of companies you want to work for and rank them based on your interest 3. Start to send emails with your C.V. to their HR and their employees (SPAM their Inbox) 4. Don’t worry “‫رزق‬ ‫”اﻟﻌﻤﻞ‬
  • 44. AI driven companies in Egypt (60 Companies) https://my-interviews-experience-in-egypt.quora.com/AI-Driven-Companies-in-Egypt
  • 45. Thank you and Good Luck