SlideShare a Scribd company logo
Practical 3 - Digital Image
Processing
Aly Osama
‫اﻟﻣﺗﻧﺑﻲ‬ ‫اﻟطﯾب‬ ‫أﺑو‬
Stages of Computer Vision
Agenda
1. Template Matching
2. Hough Transform
3. Image Segmentation
4. Intro to feature descriptors
5. Harris Corner Detection
6. Practical Demo
7. Assignment
8. Project
Template Matching
Template Matching
Template Matching is a method for searching and finding the location of a
template image in a larger image.
OpenCV comes with a function cv2.matchTemplate() for this purpose.
Template matching
Here, as an example, we will search for Messi’s face in his photo.
We will try all the comparison methods
Template matching
Template matching
Template matching with multiple objects Example
Suppose you are searching for an object which has multiple occurrences, so,we
will use thresholding.
Hough Transform
Hough Line Transform
Hough Transform is a popular technique to detect any shape, if you can
represent that shape in mathematical form. It can detect the shape even if it is
broken or distorted a little bit.
Hough Line Transform
Any line can be represented in these two terms, (⍴, ). to detect a line we use the
OpenCV function, cv2.HoughLines(). It simply returns an array of (⍴, ).
Inputs
1. Input image should be a binary image, so apply threshold or use canny edge
detection before finding applying hough transform.
2. ⍴ and accuracies respectively.
3. threshold, which means minimum vote it should get for it to be considered as a line.
number of votes depend upon number of points on the line. So it
represents the minimum length of line that should be detected.
Hough Line Transform
Probabilistic Hough Transform
Probabilistic Hough Transform is an optimization of Hough Transform, It
doesn’t take all the points into consideration, instead take only a random
subset of points and that is sufficient for line detection. Just we have to
decrease the threshold.
OpenCV implementation is based on Robust Detection of Lines Using the
Progressive Probabilistic Hough Transform. The function used is
cv2.HoughLinesP(). It has two new arguments:
● minLineLength - Minimum length of line. Line segments shorter than
this are rejected.
● maxLineGap - Maximum allowed gap between line segments to treat
them as single line.
Probabilistic Hough Transform
Hough Circle Transform
So OpenCV uses Hough Gradient Method which uses the gradient information
of edges. The function we use here is cv2.HoughCircles().
Image Segmentation
Image Segmentation
Any grayscale image can be viewed as a topographic surface where high intensity
denotes peaks and hills while low intensity denotes valleys.
Watershed Algorithm
OpenCV implemented a marker-based watershed
algorithm where you specify which are all valley
points are to be merged and which are not. It is an
interactive image segmentation.
Consider the coins image below, the coins are
touching each other. Even if you threshold it, it will
be touching each other.
Watershed Algorithm
1. We start with finding an approximate estimate of the coins. For that, we can
use the Otsu’s binarization.
Result
Watershed Algorithm
2. Now we need to remove any small white noises in the image. For that we can
use morphological opening. To remove any small holes in the object, we can
use morphological closing.
3. We need to extract the area which we are sure they are coins. Erosion
removes the boundary pixels. So whatever remaining, we can be sure it is
coin.
4. Next we need to find the area which we are sure they are not coins. For that,
we dilate the result. Dilation increases object boundary to background.
Watershed Algorithm
Watershed Algorithm
The remaining regions are those which we don’t
have any idea, whether it is coins or background.
Watershed algorithm should find it. We call it
border. It can be obtained from subtracting sure_fg
area from sure_bg area.
Watershed Algorithm
Watershed Algorithm
Now our marker is ready. It is time for final step, apply watershed. Then marker image will be modified.
The boundary region will be marked with -1.
Intro to Feature Detection
Understanding Features
We are looking for specific patterns or specific
features which are unique, which can be easily
tracked, which can be easily compared.
A and B are flat surfaces, and they are spread in a lot
of area. It is difficult to find the exact location of
these patches.
C and D are much more simpler. They are edges of
the building. You can find an approximate location,
but exact location is still difficult. It is because,
along the edge, it is same everywhere. Normal to the
edge, it is different. So edge is a much better feature
compared to flat area, but not good enough.
Understanding Features
Finally, E and F are some corners of the building.
And they can be easily found out. Because at
corners, wherever you move this patch, it will look
different. So they can be considered as a good
feature.
Harris Corner Detection
Harris Corner Detector
Theory
It basically finds the difference in intensity for a displacement of (u,v) in all directions.
We have to maximize this function E(u,v) for corner detection. That means, we have to maximize the
second term. So, applying Taylor Expansion to above equation and using some mathematical steps
where
Harris Corner Detector
I͓ and are image derivatives in x and y directions respectively. (Can be easily found out using
cv2.Sobel()).
This equation will determine if a window can contain a corner or not.
Harris Corner Detector
Harris Corner Detector in OpenCV
OpenCV has the function cv2.cornerHarris() for this purpose. Its arguments are :
● img - Input image, it should be grayscale and float32 type.
● blockSize - It is the size of neighbourhood considered for corner detection
● ksize - Aperture parameter of Sobel derivative used.
● k - Harris detector free parameter in the equation.
dst = cv2.cornerHarris(gray,2,3,0.04)
Practical Demo
Object Tracker Demo
Object tracker using Template Matching
Code:
https://github.com/Karim-92/Mario-Tracking
Output:
https://www.youtube.com/watch?v=vjbInO0zvXo
Assignment
Assignment 3
● Description: Implement and Compare with OpenCV functions on the same
image
a. Hough Line and Circle Transform
b. Harris Corner Detector
c. JPEG Image Compression
● Notes:
a. Don't use any opencv function for processing just use it for loading and viewing results
■ Ask Ahmed Nasser Qassem
● Points: 5 points
● Team: 2 members
● Deliverables:
a. Jupyter (html) notebook to https://goo.gl/forms/lroYhjLHcID6lHB83
● Deadline: 31th March 2018
Project
Stanford <<<<<< ASU Image processing course :D
Project
● Description: Solve any complex problem from your real life using computer
vision.
○ Choose your own idea ( DON’T use a project from the internet- > Zero MARKS)
○ Capture or download images to work on them
○ Implement different algorithms just to proof your concept
○ Build the best algorithm on a mobile application (Java or C++ or Python).
● Team: 4 members
● Deliverables Milestones:
○ Milestone 1: Project proposal (Idea description, your plan , image samples, references)
■ Deadline: 27th March 2018
○ Milestone 2: Desktop Script
■ Deadline: 15th April 2018
○ Milestone 3: Mobile application
■ Deadline: 27th April 2018
● Points: 15 points
Have a question?!
If you have any question
● Facebook
○ You can ask me through Facebook but don’t wait for any response before 1 month.
“Simply don’t use facebook”
■ Because I hate facebook
■ I hate talking to people for (work-study) on facebook
■ I use facebook to escape from real world so I hate facebook
● Office Hours
○ Monday 3:30 to 5:00
○ Wednesday 11:30 to 12:30
● Email (Prefered)
○ aly.osama@eng.asu.edu.eg
Thank you

More Related Content

What's hot

Structure and Motion - 3D Reconstruction of Cameras and Structure
Structure and Motion - 3D Reconstruction of Cameras and StructureStructure and Motion - 3D Reconstruction of Cameras and Structure
Structure and Motion - 3D Reconstruction of Cameras and Structure
Giovanni Murru
 
3D reconstruction
3D reconstruction3D reconstruction
3D reconstruction
Jorge Leandro, Ph.D.
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
Dawn Raider Gupta
 
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
CSCJournals
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extractionRushin Shah
 
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
Neural Scene Representation & Rendering: Introduction to Novel View SynthesisNeural Scene Representation & Rendering: Introduction to Novel View Synthesis
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
Vincent Sitzmann
 
Introduction to Computer Vision
Introduction to Computer VisionIntroduction to Computer Vision
Introduction to Computer Vision
Componica LLC
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Douglas Lanman
 
Camshaft
CamshaftCamshaft
Camshaft
Ahmed Tememe
 
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015) Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
Konrad Wenzel
 
Build Your Own 3D Scanner: Conclusion
Build Your Own 3D Scanner: ConclusionBuild Your Own 3D Scanner: Conclusion
Build Your Own 3D Scanner: Conclusion
Douglas Lanman
 
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEYALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
sipij
 
Build Your Own 3D Scanner: The Mathematics of 3D Triangulation
Build Your Own 3D Scanner: The Mathematics of 3D TriangulationBuild Your Own 3D Scanner: The Mathematics of 3D Triangulation
Build Your Own 3D Scanner: The Mathematics of 3D Triangulation
Douglas Lanman
 
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
Seiya Ito
 
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDMImplementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
Soma Boubou
 
02_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_201402_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_2014
Atiqa khan
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
asodariyabhavesh
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
Krish Everglades
 
Data hiding using image interpolation
Data hiding using image interpolationData hiding using image interpolation
Data hiding using image interpolation
Vikrant Arya
 

What's hot (20)

Structure and Motion - 3D Reconstruction of Cameras and Structure
Structure and Motion - 3D Reconstruction of Cameras and StructureStructure and Motion - 3D Reconstruction of Cameras and Structure
Structure and Motion - 3D Reconstruction of Cameras and Structure
 
3D reconstruction
3D reconstruction3D reconstruction
3D reconstruction
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
 
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
 
Image feature extraction
Image feature extractionImage feature extraction
Image feature extraction
 
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
Neural Scene Representation & Rendering: Introduction to Novel View SynthesisNeural Scene Representation & Rendering: Introduction to Novel View Synthesis
Neural Scene Representation & Rendering: Introduction to Novel View Synthesis
 
Introduction to Computer Vision
Introduction to Computer VisionIntroduction to Computer Vision
Introduction to Computer Vision
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
Camshaft
CamshaftCamshaft
Camshaft
 
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015) Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
Dense Image Matching - Challenges and Potentials (Keynote 3D-ARCH 2015)
 
Build Your Own 3D Scanner: Conclusion
Build Your Own 3D Scanner: ConclusionBuild Your Own 3D Scanner: Conclusion
Build Your Own 3D Scanner: Conclusion
 
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEYALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY
 
Build Your Own 3D Scanner: The Mathematics of 3D Triangulation
Build Your Own 3D Scanner: The Mathematics of 3D TriangulationBuild Your Own 3D Scanner: The Mathematics of 3D Triangulation
Build Your Own 3D Scanner: The Mathematics of 3D Triangulation
 
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
[3D勉強会@関東] Deep Reinforcement Learning of Volume-guided Progressive View Inpa...
 
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDMImplementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
Implementing Camshift on a Mobile Robot for Person Tracking and Pursuit_ICDM
 
Camshift
CamshiftCamshift
Camshift
 
02_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_201402_atiqa ijaz khan_05_2014
02_atiqa ijaz khan_05_2014
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
 
Data hiding using image interpolation
Data hiding using image interpolationData hiding using image interpolation
Data hiding using image interpolation
 

Similar to Practical Digital Image Processing 3

Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
paperpublications3
 
06 image features
06 image features06 image features
06 image features
ankit_ppt
 
LANE DETECTION USING IMAGE PROCESSING IN PYTHON
LANE DETECTION USING IMAGE PROCESSING IN PYTHONLANE DETECTION USING IMAGE PROCESSING IN PYTHON
LANE DETECTION USING IMAGE PROCESSING IN PYTHON
IRJET Journal
 
IRJET- Image Feature Extraction using Hough Transformation Principle
IRJET- Image Feature Extraction using Hough Transformation PrincipleIRJET- Image Feature Extraction using Hough Transformation Principle
IRJET- Image Feature Extraction using Hough Transformation Principle
IRJET Journal
 
Module-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfModule-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdf
vikasmittal92
 
A Case Study : Circle Detection Using Circular Hough Transform
A Case Study : Circle Detection Using Circular Hough TransformA Case Study : Circle Detection Using Circular Hough Transform
A Case Study : Circle Detection Using Circular Hough Transform
IJSRED
 
E017443136
E017443136E017443136
E017443136
IOSR Journals
 
Augmented reality session 4
Augmented reality session 4Augmented reality session 4
Augmented reality session 4
NirsandhG
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
asodariyabhavesh
 
Android based application for graph analysis final report
Android based application for graph analysis final reportAndroid based application for graph analysis final report
Android based application for graph analysis final report
Pallab Sarkar
 
Estrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitaleEstrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitale
francescapadoin
 
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKINGA PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
IRJET Journal
 
CAD/CAM/CAE - Notes
CAD/CAM/CAE - NotesCAD/CAM/CAE - Notes
CAD/CAM/CAE - Notes
Learn With GeekAlign
 
Object tracking with SURF: ARM-Based platform Implementation
Object tracking with SURF: ARM-Based platform ImplementationObject tracking with SURF: ARM-Based platform Implementation
Object tracking with SURF: ARM-Based platform Implementation
Editor IJCATR
 
E41033336
E41033336E41033336
E41033336
IJERA Editor
 
Machine learning for high-speed corner detection
Machine learning for high-speed corner detectionMachine learning for high-speed corner detection
Machine learning for high-speed corner detectionbutest
 
Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencv
MohdSalim34
 
I010634450
I010634450I010634450
I010634450
IOSR Journals
 
Performance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
Performance of Efficient Closed-Form Solution to Comprehensive Frontier ExposurePerformance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
Performance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
iosrjce
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
Mohamed El-Serngawy
 

Similar to Practical Digital Image Processing 3 (20)

Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
Hardware Unit for Edge Detection with Comparative Analysis of Different Edge ...
 
06 image features
06 image features06 image features
06 image features
 
LANE DETECTION USING IMAGE PROCESSING IN PYTHON
LANE DETECTION USING IMAGE PROCESSING IN PYTHONLANE DETECTION USING IMAGE PROCESSING IN PYTHON
LANE DETECTION USING IMAGE PROCESSING IN PYTHON
 
IRJET- Image Feature Extraction using Hough Transformation Principle
IRJET- Image Feature Extraction using Hough Transformation PrincipleIRJET- Image Feature Extraction using Hough Transformation Principle
IRJET- Image Feature Extraction using Hough Transformation Principle
 
Module-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdfModule-5-1_230523_171754 (1).pdf
Module-5-1_230523_171754 (1).pdf
 
A Case Study : Circle Detection Using Circular Hough Transform
A Case Study : Circle Detection Using Circular Hough TransformA Case Study : Circle Detection Using Circular Hough Transform
A Case Study : Circle Detection Using Circular Hough Transform
 
E017443136
E017443136E017443136
E017443136
 
Augmented reality session 4
Augmented reality session 4Augmented reality session 4
Augmented reality session 4
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Android based application for graph analysis final report
Android based application for graph analysis final reportAndroid based application for graph analysis final report
Android based application for graph analysis final report
 
Estrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitaleEstrazione automatica delle linee in un'immagine digitale
Estrazione automatica delle linee in un'immagine digitale
 
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKINGA PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
 
CAD/CAM/CAE - Notes
CAD/CAM/CAE - NotesCAD/CAM/CAE - Notes
CAD/CAM/CAE - Notes
 
Object tracking with SURF: ARM-Based platform Implementation
Object tracking with SURF: ARM-Based platform ImplementationObject tracking with SURF: ARM-Based platform Implementation
Object tracking with SURF: ARM-Based platform Implementation
 
E41033336
E41033336E41033336
E41033336
 
Machine learning for high-speed corner detection
Machine learning for high-speed corner detectionMachine learning for high-speed corner detection
Machine learning for high-speed corner detection
 
Road signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencvRoad signs detection using voila jone's algorithm with the help of opencv
Road signs detection using voila jone's algorithm with the help of opencv
 
I010634450
I010634450I010634450
I010634450
 
Performance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
Performance of Efficient Closed-Form Solution to Comprehensive Frontier ExposurePerformance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
Performance of Efficient Closed-Form Solution to Comprehensive Frontier Exposure
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
 

More from Aly Abdelkareem

An Inductive inference Machine
An Inductive inference MachineAn Inductive inference Machine
An Inductive inference Machine
Aly Abdelkareem
 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency Filters
Aly Abdelkareem
 
Deep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularizationDeep learning: Overfitting , underfitting, and regularization
Deep learning: Overfitting , underfitting, and regularization
Aly Abdelkareem
 
Pattern recognition 4 - MLE
Pattern recognition 4 - MLEPattern recognition 4 - MLE
Pattern recognition 4 - MLE
Aly Abdelkareem
 
Practical Digital Image Processing 1
Practical Digital Image Processing 1Practical Digital Image Processing 1
Practical Digital Image Processing 1
Aly Abdelkareem
 
Machine Learning for Everyone
Machine Learning for EveryoneMachine Learning for Everyone
Machine Learning for Everyone
Aly 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 data
Aly Abdelkareem
 
Deep Learning using Keras
Deep Learning using KerasDeep Learning using Keras
Deep Learning using Keras
Aly 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 learning
Aly Abdelkareem
 
Pattern recognition Tutorial 2
Pattern recognition Tutorial 2Pattern recognition Tutorial 2
Pattern recognition Tutorial 2
Aly Abdelkareem
 
Android Udacity Study group 1
Android Udacity Study group 1Android Udacity Study group 1
Android Udacity Study group 1
Aly Abdelkareem
 
Java for android developers
Java for android developersJava for android developers
Java for android developers
Aly Abdelkareem
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
Aly Abdelkareem
 

More from 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
 

Recently uploaded

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 

Recently uploaded (20)

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 

Practical Digital Image Processing 3

  • 1. Practical 3 - Digital Image Processing Aly Osama
  • 4. Agenda 1. Template Matching 2. Hough Transform 3. Image Segmentation 4. Intro to feature descriptors 5. Harris Corner Detection 6. Practical Demo 7. Assignment 8. Project
  • 6. Template Matching Template Matching is a method for searching and finding the location of a template image in a larger image. OpenCV comes with a function cv2.matchTemplate() for this purpose.
  • 7. Template matching Here, as an example, we will search for Messi’s face in his photo. We will try all the comparison methods
  • 10. Template matching with multiple objects Example Suppose you are searching for an object which has multiple occurrences, so,we will use thresholding.
  • 12. Hough Line Transform Hough Transform is a popular technique to detect any shape, if you can represent that shape in mathematical form. It can detect the shape even if it is broken or distorted a little bit.
  • 13. Hough Line Transform Any line can be represented in these two terms, (⍴, ). to detect a line we use the OpenCV function, cv2.HoughLines(). It simply returns an array of (⍴, ). Inputs 1. Input image should be a binary image, so apply threshold or use canny edge detection before finding applying hough transform. 2. ⍴ and accuracies respectively. 3. threshold, which means minimum vote it should get for it to be considered as a line.
  • 14. number of votes depend upon number of points on the line. So it represents the minimum length of line that should be detected.
  • 16. Probabilistic Hough Transform Probabilistic Hough Transform is an optimization of Hough Transform, It doesn’t take all the points into consideration, instead take only a random subset of points and that is sufficient for line detection. Just we have to decrease the threshold. OpenCV implementation is based on Robust Detection of Lines Using the Progressive Probabilistic Hough Transform. The function used is cv2.HoughLinesP(). It has two new arguments: ● minLineLength - Minimum length of line. Line segments shorter than this are rejected. ● maxLineGap - Maximum allowed gap between line segments to treat them as single line.
  • 18. Hough Circle Transform So OpenCV uses Hough Gradient Method which uses the gradient information of edges. The function we use here is cv2.HoughCircles().
  • 20. Image Segmentation Any grayscale image can be viewed as a topographic surface where high intensity denotes peaks and hills while low intensity denotes valleys.
  • 21. Watershed Algorithm OpenCV implemented a marker-based watershed algorithm where you specify which are all valley points are to be merged and which are not. It is an interactive image segmentation. Consider the coins image below, the coins are touching each other. Even if you threshold it, it will be touching each other.
  • 22. Watershed Algorithm 1. We start with finding an approximate estimate of the coins. For that, we can use the Otsu’s binarization. Result
  • 23. Watershed Algorithm 2. Now we need to remove any small white noises in the image. For that we can use morphological opening. To remove any small holes in the object, we can use morphological closing. 3. We need to extract the area which we are sure they are coins. Erosion removes the boundary pixels. So whatever remaining, we can be sure it is coin. 4. Next we need to find the area which we are sure they are not coins. For that, we dilate the result. Dilation increases object boundary to background.
  • 25. Watershed Algorithm The remaining regions are those which we don’t have any idea, whether it is coins or background. Watershed algorithm should find it. We call it border. It can be obtained from subtracting sure_fg area from sure_bg area.
  • 27. Watershed Algorithm Now our marker is ready. It is time for final step, apply watershed. Then marker image will be modified. The boundary region will be marked with -1.
  • 28. Intro to Feature Detection
  • 29.
  • 30. Understanding Features We are looking for specific patterns or specific features which are unique, which can be easily tracked, which can be easily compared. A and B are flat surfaces, and they are spread in a lot of area. It is difficult to find the exact location of these patches. C and D are much more simpler. They are edges of the building. You can find an approximate location, but exact location is still difficult. It is because, along the edge, it is same everywhere. Normal to the edge, it is different. So edge is a much better feature compared to flat area, but not good enough.
  • 31. Understanding Features Finally, E and F are some corners of the building. And they can be easily found out. Because at corners, wherever you move this patch, it will look different. So they can be considered as a good feature.
  • 33. Harris Corner Detector Theory It basically finds the difference in intensity for a displacement of (u,v) in all directions. We have to maximize this function E(u,v) for corner detection. That means, we have to maximize the second term. So, applying Taylor Expansion to above equation and using some mathematical steps where
  • 34. Harris Corner Detector I͓ and are image derivatives in x and y directions respectively. (Can be easily found out using cv2.Sobel()). This equation will determine if a window can contain a corner or not.
  • 36. Harris Corner Detector in OpenCV OpenCV has the function cv2.cornerHarris() for this purpose. Its arguments are : ● img - Input image, it should be grayscale and float32 type. ● blockSize - It is the size of neighbourhood considered for corner detection ● ksize - Aperture parameter of Sobel derivative used. ● k - Harris detector free parameter in the equation. dst = cv2.cornerHarris(gray,2,3,0.04)
  • 37.
  • 39. Object Tracker Demo Object tracker using Template Matching Code: https://github.com/Karim-92/Mario-Tracking Output: https://www.youtube.com/watch?v=vjbInO0zvXo
  • 41. Assignment 3 ● Description: Implement and Compare with OpenCV functions on the same image a. Hough Line and Circle Transform b. Harris Corner Detector c. JPEG Image Compression ● Notes: a. Don't use any opencv function for processing just use it for loading and viewing results ■ Ask Ahmed Nasser Qassem ● Points: 5 points ● Team: 2 members ● Deliverables: a. Jupyter (html) notebook to https://goo.gl/forms/lroYhjLHcID6lHB83 ● Deadline: 31th March 2018
  • 43. Stanford <<<<<< ASU Image processing course :D
  • 44. Project ● Description: Solve any complex problem from your real life using computer vision. ○ Choose your own idea ( DON’T use a project from the internet- > Zero MARKS) ○ Capture or download images to work on them ○ Implement different algorithms just to proof your concept ○ Build the best algorithm on a mobile application (Java or C++ or Python). ● Team: 4 members ● Deliverables Milestones: ○ Milestone 1: Project proposal (Idea description, your plan , image samples, references) ■ Deadline: 27th March 2018 ○ Milestone 2: Desktop Script ■ Deadline: 15th April 2018 ○ Milestone 3: Mobile application ■ Deadline: 27th April 2018 ● Points: 15 points
  • 46. If you have any question ● Facebook ○ You can ask me through Facebook but don’t wait for any response before 1 month. “Simply don’t use facebook” ■ Because I hate facebook ■ I hate talking to people for (work-study) on facebook ■ I use facebook to escape from real world so I hate facebook ● Office Hours ○ Monday 3:30 to 5:00 ○ Wednesday 11:30 to 12:30 ● Email (Prefered) ○ aly.osama@eng.asu.edu.eg