SlideShare ist ein Scribd-Unternehmen logo
1 von 54
Practical 2 - Digital Image
Processing
Aly Osama
Stages of Computer Vision
Agenda
1. Morphological Transformation
2. Geometric Transformation
3. Image Gradients
4. Canny Edge Detection
5. Image Thresholding
6. Practical Demo
7. Assignment
Morphological
Transformation
Morphological Transformations
Morphological transformations are some simple
operations based on the image shape. It is normally
performed on binary images.
Inputs:
● Original image,
● structuring element called kernel
Two basic morphological operators are Erosion and
Dilation. Then its variant forms like Opening, Closing,
Gradient etc
1. Erosion
it erodes away the boundaries of foreground object.
The kernel slides through the image (as in 2D convolution). A pixel in the original image (either 1 or 0)
will be considered 1 only if all the pixels under the kernel is 1, otherwise it is eroded (made to zero).
2. Dilation
It is just opposite of erosion. Here, a pixel element is ‘1’ if atleast one pixel under
the kernel is ‘1’. So it increases the white region in the image or size of
foreground object increases.
3. Opening
Opening is just another name of erosion followed by dilation. It is useful in
removing noise
4. Closing
Closing is reverse of Opening, Dilation followed by Erosion. It is useful in closing
small holes inside the foreground objects, or small black points on the object.
5. Morphological Gradients
It is the difference between dilation and erosion of an image.
6. Top hat
It is the difference between input image and Opening of the image. Below
example is done for a 9x9 kernel.
7. Black Hat
It is the difference between the closing of the input image and input image.
Structural elements
We manually created a structuring elements in the previous examples but
cv2.getStructuringElement() You just pass the shape and size of the kernel
Hit and Miss Transform - Theory
The Hit-or-Miss transformation is useful to find patterns in binary images. In
particular, it finds those pixels whose neighbourhood matches the shape of a
first structuring element B1 while not matching the shape of a second structuring
element B2
Hit and Miss - Example
B1 B2 B
Hit and Miss - Code
Hit and Miss - Quick Puzzle
?
Geometric Transformation
Geometric Transformation
Another Transformation
‫ﻋﻠﯾﮭﺎ‬ ‫ﻣﺗداس‬ ‫اﻟﻠﻰ‬ ‫اﻟﻣﻌﻔﻧﺔ‬ ‫اﻟورﻗﺔ‬ ‫ﻣﻊ‬ ‫ﺑﯾﻧﻔﻊ‬
Transformation Concept
1. Scale
cv2.INTER_AREA for shrinking or cv2.INTER_CUBIC (slow)
cv2.INTER_LINEAR for zooming
2. Translation
Translation is the shifting of object's location. If you know the shift in (x,y) direction, let it be (tx,ty),
3. Rotation
Rotation of an image for an angle
Affine Transformation
all parallel lines in the original image will still be parallel in the output image
To find the transformation matrix, we need three points from input image and their corresponding locations in
output image. Then cv2.getAffineTransform will create a 2x3 matrix which is to be passed to cv2.warpAffine.
Prospective Transformation
Straight lines will remain straight even after the transformation
To find this transformation matrix, you need 4 points on the input image and corresponding points on the output image. Among these 4
points, 3 of them should not be collinear. Then transformation matrix can be found by the function cv2.getPerspectiveTransform.
Then apply cv2.warpPerspective with this 3x3 transformation matrix.
Image Gradients
Image Gradients
OpenCV provides three types of gradient filters or High-pass filters, Sobel,
Scharr and Laplacian
1. Sobel and Scharr Derivatives
Sobel operators is a joint Gausssian smoothing plus differentiation operation, so it is more resistant to
noise.
2. Laplace
Image Gradients Example
Canny Edge Detection
Canny Edge Detection
Canny Edge Detection is a popular edge detection algorithm. It was developed by
John F. Canny in 1986. It is a multi-stage algorithm
Canny Edge Steps
1. Noise Reduction
2. Finding Intensity Gradient of the Image
3. Non-maximum Suppression
4. Hysteresis Thresholding
1. Noise Reduction
Since edge detection is susceptible to noise in the image, first step is to remove
the noise in the image with a 5x5 Gaussian filter.
2. Find Intensity gradients of images
Smoothened image is then filtered with a Sobel kernel in both horizontal and vertical direction to get first
derivative in horizontal direction ( Gx) and vertical direction ( Gy).
Gradient direction is always perpendicular to edges. It is rounded to one of four angles representing
vertical, horizontal and two diagonal directions.
3. Non-maximum suppression
After getting gradient magnitude and direction, a
full scan of image is done to remove any
unwanted pixels which may not constitute the
edge
Point A is on the edge ( in vertical direction).
Gradient direction is normal to the edge. Point B
and C are in gradient directions. So point A is
checked with point B and C to see if it forms a
local maximum. If so, it is considered for next
stage, otherwise, it is suppressed ( put to zero).
In short, the result you get is a binary image with
"thin edges".
4. Hysteresis Thresholding
which are all edges are really edges and which are not.
For this, we need two threshold values, minVal and maxVal.
● Any edges with intensity gradient more than maxVal are
sure to be edges. (A)
● Those below minVal are sure to be non-edges
● Those who lie between these two thresholds are
classified edges or non-edges based on their connectivity.
If they are connected to "sure-edge" pixels, they are
considered to be part of edges.(C) Otherwise, they are
also discarded.(B)
This stage also removes small pixels noises on the assumption
that edges are long lines.
Canny Example
First argument is our
input image. Second
and third arguments
are our minVal and
maxVal respectively.
Image Thresholding
Image Thresholding
Here, the matter is straightforward. If pixel value is greater than a threshold value, it is assigned one value (may be white), else it is
assigned another value (may be black). The function used is cv.threshold.
Basic Thresholding Types
Basic Thresholding Examples
Adaptive Thresholding
the algorithm calculate the threshold
for a small regions of the image. So
we get different thresholds for
different regions of the same image
and it gives us better results for
images with varying illumination.
Otsu’s Thresholding
consider a bimodal image (In simple words, bimodal image is an
image whose histogram has two peaks). For that image, we can
approximately take a value in the middle of those peaks as
threshold value, right ? That is what Otsu binarization does. So in
simple words, it automatically calculates a threshold
value from image histogram for a bimodal image.
Otsu Simple application
Practical Demo
Better Object Tracker Demo
A better Object tracker using
Meanshift and Camshift
Assignment
CSE 101 How to read a Text ?
● Just read it yourself.
● Don’t invent anything not mentioned.
● Don’t be Attef
Assignment 2
● Description: Exercise on Morphological Operations
○ https://goo.gl/sVyLX4
● Points: 5 points
● Team: Individual
● Deliverables:
○ Jupyter (html) notebook to
○ Form Link https://goo.gl/forms/YSzOSpr7QxIlSQht1
● Deadline: 10th March 2018
‫ﺻﻧﺎب‬ ‫ھﯾﻛون‬ ‫ﻛﺎن‬ ‫ﺑس‬ ‫ھو‬ ,‫ﺑﺎﻟﺷﻐل‬ ‫ﻋﻼﻗﺔ‬ ‫ﻣﺎﻟﮭﺎش‬ ‫اﻟﺻورة‬
‫اﺳﮭل‬ ‫ﻟﺣﺎﺟﺔ‬ ‫ﻏﯾرﺗﮫ‬ ‫ﻟﻛن‬ ‫ﺷﺎت‬
Have a question?!
If you have any question
● Facebook
○ You can ask me through Facebook but don’t wait for any
respond before 1 month. “Simply don’t use facebook”
● Office Hours
○ Wednesday 11:30 to 12:30
● Email
○ aly.osama@eng.asu.edu.eg (Response time one day)

Weitere ähnliche Inhalte

Was ist angesagt?

An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...Kunal Kishor Nirala
 
Build Your Own 3D Scanner: Surface Reconstruction
Build Your Own 3D Scanner: Surface ReconstructionBuild Your Own 3D Scanner: Surface Reconstruction
Build Your Own 3D Scanner: Surface ReconstructionDouglas Lanman
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionDawn Raider Gupta
 
Edge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicEdge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicIJERA Editor
 
Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough TransformMrunal Selokar
 
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
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processingDheeban Smart
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processingasodariyabhavesh
 
Michal Erel's SIFT presentation
Michal Erel's SIFT presentationMichal Erel's SIFT presentation
Michal Erel's SIFT presentationwolf
 
Template Matching - Pattern Recognition
Template Matching - Pattern RecognitionTemplate Matching - Pattern Recognition
Template Matching - Pattern RecognitionMustafa Salam
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processingVinayak Narayanan
 
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
 
morphological image processing
morphological image processingmorphological image processing
morphological image processingAnubhav Kumar
 
Object recognition
Object recognitionObject recognition
Object recognitionsaniacorreya
 

Was ist angesagt? (20)

An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...An automatic algorithm for object recognition and detection based on asift ke...
An automatic algorithm for object recognition and detection based on asift ke...
 
3D reconstruction
3D reconstruction3D reconstruction
3D reconstruction
 
Build Your Own 3D Scanner: Surface Reconstruction
Build Your Own 3D Scanner: Surface ReconstructionBuild Your Own 3D Scanner: Surface Reconstruction
Build Your Own 3D Scanner: Surface Reconstruction
 
Fuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge DetectionFuzzy Logic Based Edge Detection
Fuzzy Logic Based Edge Detection
 
Edge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy LogicEdge Detection Using Fuzzy Logic
Edge Detection Using Fuzzy Logic
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
 
Edge Detection using Hough Transform
Edge Detection using Hough TransformEdge Detection using Hough Transform
Edge Detection using Hough Transform
 
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
 
Morphology in graphics and image processing
Morphology in graphics and image processingMorphology in graphics and image processing
Morphology in graphics and image processing
 
Chapter 9 morphological image processing
Chapter 9 morphological image processingChapter 9 morphological image processing
Chapter 9 morphological image processing
 
Michal Erel's SIFT presentation
Michal Erel's SIFT presentationMichal Erel's SIFT presentation
Michal Erel's SIFT presentation
 
Local binary pattern
Local binary patternLocal binary pattern
Local binary pattern
 
Template Matching - Pattern Recognition
Template Matching - Pattern RecognitionTemplate Matching - Pattern Recognition
Template Matching - Pattern Recognition
 
Morphological image processing
Morphological image processingMorphological image processing
Morphological image processing
 
Edge Detection
Edge Detection Edge Detection
Edge Detection
 
Morphological operations
Morphological operationsMorphological operations
Morphological operations
 
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)
 
morphological image processing
morphological image processingmorphological image processing
morphological image processing
 
Image Segmentation
 Image Segmentation Image Segmentation
Image Segmentation
 
Object recognition
Object recognitionObject recognition
Object recognition
 

Ähnlich wie Practical Digital Image Processing 2

Image pre processing
Image pre processingImage pre processing
Image pre processingAshish Kumar
 
State of art pde based ip to bt vijayakrishna rowthu
State of art pde based ip to bt  vijayakrishna rowthuState of art pde based ip to bt  vijayakrishna rowthu
State of art pde based ip to bt vijayakrishna rowthuvijayakrishna rowthu
 
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISION
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISIONchapter 4 computervision.pdf IT IS ABOUT COMUTER VISION
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISIONshesnasuneer
 
Digital image processing Tool presentation
Digital image processing Tool presentationDigital image processing Tool presentation
Digital image processing Tool presentationdikshabehl5392
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processingMohammed Kamel
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lectureISRAR HUSSAIN
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2Surabhi Ks
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfnagwaAboElenein
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Editor IJARCET
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Editor IJARCET
 
Linear Image Processing
Linear Image Processing Linear Image Processing
Linear Image Processing Avinash Rohra
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processingAshish Kumar
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)Mathankumar S
 
Digital Image Processing - Image Enhancement
Digital Image Processing  - Image EnhancementDigital Image Processing  - Image Enhancement
Digital Image Processing - Image EnhancementMathankumar S
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit NotesAAKANKSHA JAIN
 
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGLAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGPriyanka Rathore
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingAzharo7
 

Ähnlich wie Practical Digital Image Processing 2 (20)

Image pre processing
Image pre processingImage pre processing
Image pre processing
 
State of art pde based ip to bt vijayakrishna rowthu
State of art pde based ip to bt  vijayakrishna rowthuState of art pde based ip to bt  vijayakrishna rowthu
State of art pde based ip to bt vijayakrishna rowthu
 
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISION
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISIONchapter 4 computervision.pdf IT IS ABOUT COMUTER VISION
chapter 4 computervision.pdf IT IS ABOUT COMUTER VISION
 
Digital image processing Tool presentation
Digital image processing Tool presentationDigital image processing Tool presentation
Digital image processing Tool presentation
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processing
 
Image enhancement lecture
Image enhancement lectureImage enhancement lecture
Image enhancement lecture
 
h.pdf
h.pdfh.pdf
h.pdf
 
Image enhancement ppt nal2
Image enhancement ppt nal2Image enhancement ppt nal2
Image enhancement ppt nal2
 
Shadow Detection Using MatLAB
Shadow Detection Using MatLABShadow Detection Using MatLAB
Shadow Detection Using MatLAB
 
Lec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdfLec_2_Digital Image Fundamentals.pdf
Lec_2_Digital Image Fundamentals.pdf
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251Ijarcet vol-2-issue-7-2246-2251
Ijarcet vol-2-issue-7-2246-2251
 
Linear Image Processing
Linear Image Processing Linear Image Processing
Linear Image Processing
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processing
 
Digital image processing - Image Enhancement (MATERIAL)
Digital image processing  - Image Enhancement (MATERIAL)Digital image processing  - Image Enhancement (MATERIAL)
Digital image processing - Image Enhancement (MATERIAL)
 
Digital Image Processing - Image Enhancement
Digital Image Processing  - Image EnhancementDigital Image Processing  - Image Enhancement
Digital Image Processing - Image Enhancement
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit Notes
 
Ijcatr04041016
Ijcatr04041016Ijcatr04041016
Ijcatr04041016
 
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSINGLAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
LAPLACE TRANSFORM SUITABILITY FOR IMAGE PROCESSING
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .Satyam Kumar
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 

Kürzlich hochgeladen (20)

Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Churning of Butter, Factors affecting .
Churning of Butter, Factors affecting  .Churning of Butter, Factors affecting  .
Churning of Butter, Factors affecting .
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 

Practical Digital Image Processing 2

  • 1. Practical 2 - Digital Image Processing Aly Osama
  • 2.
  • 4. Agenda 1. Morphological Transformation 2. Geometric Transformation 3. Image Gradients 4. Canny Edge Detection 5. Image Thresholding 6. Practical Demo 7. Assignment
  • 6. Morphological Transformations Morphological transformations are some simple operations based on the image shape. It is normally performed on binary images. Inputs: ● Original image, ● structuring element called kernel Two basic morphological operators are Erosion and Dilation. Then its variant forms like Opening, Closing, Gradient etc
  • 7. 1. Erosion it erodes away the boundaries of foreground object. The kernel slides through the image (as in 2D convolution). A pixel in the original image (either 1 or 0) will be considered 1 only if all the pixels under the kernel is 1, otherwise it is eroded (made to zero).
  • 8. 2. Dilation It is just opposite of erosion. Here, a pixel element is ‘1’ if atleast one pixel under the kernel is ‘1’. So it increases the white region in the image or size of foreground object increases.
  • 9. 3. Opening Opening is just another name of erosion followed by dilation. It is useful in removing noise
  • 10. 4. Closing Closing is reverse of Opening, Dilation followed by Erosion. It is useful in closing small holes inside the foreground objects, or small black points on the object.
  • 11. 5. Morphological Gradients It is the difference between dilation and erosion of an image.
  • 12. 6. Top hat It is the difference between input image and Opening of the image. Below example is done for a 9x9 kernel.
  • 13. 7. Black Hat It is the difference between the closing of the input image and input image.
  • 14. Structural elements We manually created a structuring elements in the previous examples but cv2.getStructuringElement() You just pass the shape and size of the kernel
  • 15. Hit and Miss Transform - Theory The Hit-or-Miss transformation is useful to find patterns in binary images. In particular, it finds those pixels whose neighbourhood matches the shape of a first structuring element B1 while not matching the shape of a second structuring element B2
  • 16. Hit and Miss - Example B1 B2 B
  • 17. Hit and Miss - Code
  • 18. Hit and Miss - Quick Puzzle ?
  • 21. Another Transformation ‫ﻋﻠﯾﮭﺎ‬ ‫ﻣﺗداس‬ ‫اﻟﻠﻰ‬ ‫اﻟﻣﻌﻔﻧﺔ‬ ‫اﻟورﻗﺔ‬ ‫ﻣﻊ‬ ‫ﺑﯾﻧﻔﻊ‬
  • 23. 1. Scale cv2.INTER_AREA for shrinking or cv2.INTER_CUBIC (slow) cv2.INTER_LINEAR for zooming
  • 24. 2. Translation Translation is the shifting of object's location. If you know the shift in (x,y) direction, let it be (tx,ty),
  • 25. 3. Rotation Rotation of an image for an angle
  • 26. Affine Transformation all parallel lines in the original image will still be parallel in the output image To find the transformation matrix, we need three points from input image and their corresponding locations in output image. Then cv2.getAffineTransform will create a 2x3 matrix which is to be passed to cv2.warpAffine.
  • 27. Prospective Transformation Straight lines will remain straight even after the transformation To find this transformation matrix, you need 4 points on the input image and corresponding points on the output image. Among these 4 points, 3 of them should not be collinear. Then transformation matrix can be found by the function cv2.getPerspectiveTransform. Then apply cv2.warpPerspective with this 3x3 transformation matrix.
  • 29. Image Gradients OpenCV provides three types of gradient filters or High-pass filters, Sobel, Scharr and Laplacian
  • 30. 1. Sobel and Scharr Derivatives Sobel operators is a joint Gausssian smoothing plus differentiation operation, so it is more resistant to noise.
  • 34. Canny Edge Detection Canny Edge Detection is a popular edge detection algorithm. It was developed by John F. Canny in 1986. It is a multi-stage algorithm
  • 35. Canny Edge Steps 1. Noise Reduction 2. Finding Intensity Gradient of the Image 3. Non-maximum Suppression 4. Hysteresis Thresholding
  • 36. 1. Noise Reduction Since edge detection is susceptible to noise in the image, first step is to remove the noise in the image with a 5x5 Gaussian filter.
  • 37. 2. Find Intensity gradients of images Smoothened image is then filtered with a Sobel kernel in both horizontal and vertical direction to get first derivative in horizontal direction ( Gx) and vertical direction ( Gy). Gradient direction is always perpendicular to edges. It is rounded to one of four angles representing vertical, horizontal and two diagonal directions.
  • 38. 3. Non-maximum suppression After getting gradient magnitude and direction, a full scan of image is done to remove any unwanted pixels which may not constitute the edge Point A is on the edge ( in vertical direction). Gradient direction is normal to the edge. Point B and C are in gradient directions. So point A is checked with point B and C to see if it forms a local maximum. If so, it is considered for next stage, otherwise, it is suppressed ( put to zero). In short, the result you get is a binary image with "thin edges".
  • 39. 4. Hysteresis Thresholding which are all edges are really edges and which are not. For this, we need two threshold values, minVal and maxVal. ● Any edges with intensity gradient more than maxVal are sure to be edges. (A) ● Those below minVal are sure to be non-edges ● Those who lie between these two thresholds are classified edges or non-edges based on their connectivity. If they are connected to "sure-edge" pixels, they are considered to be part of edges.(C) Otherwise, they are also discarded.(B) This stage also removes small pixels noises on the assumption that edges are long lines.
  • 40. Canny Example First argument is our input image. Second and third arguments are our minVal and maxVal respectively.
  • 42. Image Thresholding Here, the matter is straightforward. If pixel value is greater than a threshold value, it is assigned one value (may be white), else it is assigned another value (may be black). The function used is cv.threshold.
  • 45. Adaptive Thresholding the algorithm calculate the threshold for a small regions of the image. So we get different thresholds for different regions of the same image and it gives us better results for images with varying illumination.
  • 46. Otsu’s Thresholding consider a bimodal image (In simple words, bimodal image is an image whose histogram has two peaks). For that image, we can approximately take a value in the middle of those peaks as threshold value, right ? That is what Otsu binarization does. So in simple words, it automatically calculates a threshold value from image histogram for a bimodal image.
  • 49. Better Object Tracker Demo A better Object tracker using Meanshift and Camshift
  • 51. CSE 101 How to read a Text ? ● Just read it yourself. ● Don’t invent anything not mentioned. ● Don’t be Attef
  • 52. Assignment 2 ● Description: Exercise on Morphological Operations ○ https://goo.gl/sVyLX4 ● Points: 5 points ● Team: Individual ● Deliverables: ○ Jupyter (html) notebook to ○ Form Link https://goo.gl/forms/YSzOSpr7QxIlSQht1 ● Deadline: 10th March 2018 ‫ﺻﻧﺎب‬ ‫ھﯾﻛون‬ ‫ﻛﺎن‬ ‫ﺑس‬ ‫ھو‬ ,‫ﺑﺎﻟﺷﻐل‬ ‫ﻋﻼﻗﺔ‬ ‫ﻣﺎﻟﮭﺎش‬ ‫اﻟﺻورة‬ ‫اﺳﮭل‬ ‫ﻟﺣﺎﺟﺔ‬ ‫ﻏﯾرﺗﮫ‬ ‫ﻟﻛن‬ ‫ﺷﺎت‬
  • 54. If you have any question ● Facebook ○ You can ask me through Facebook but don’t wait for any respond before 1 month. “Simply don’t use facebook” ● Office Hours ○ Wednesday 11:30 to 12:30 ● Email ○ aly.osama@eng.asu.edu.eg (Response time one day)