SlideShare a Scribd company logo
1 of 47
Part I
Legal Notices and Disclaimers
This presentation is for informational purposes only. INTEL MAKES NO WARRANTIES,
EXPRESS OR IMPLIED, IN THIS SUMMARY.
Intel technologiesโ€™ features and benefits depend on system configuration and may require
enabled hardware, software or service activation. Performance varies depending on system
configuration. Check with your system manufacturer or retailer or learn more at intel.com.
This sample source code is released under the Intel Sample Source Code License
Agreement.
Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
*Other names and brands may be claimed as the property of others.
Copyright ยฉ 2018, Intel Corporation. All rights reserved.
2
Calculus in Pixel Space: Image Derivatives
An image derivative represents the amount that an imageโ€™s pixel values are changing at
a given point.
Analogous to a derivative from calculus:
tangent
๐‘“โ€ฒ
๐‘ฅ =
ฮ”๐‘ฆ
ฮ”๐‘ฅ
๐‘“ ๐‘ฅ = ๐‘ฅ2
Motivation for Image Derivatives
Image derivatives in x or y directions can detect features of images, especially edges:
Edges tend to correspond to changes in the intensity of pixels, which a derivative would
capture.
Image source: https://upload.wikimedia.org/wikipedia/commons/6/67/Intensity_image_with_gradient_images.png
Calculus in Pixel Space: Image Derivatives
Image derivatives example:
Step
Generate box
Slice across
middle
Plot slice,
derivative
Code Output
Integral Images
Many applications
Fast calculation of Haar wavelets in face recognition
Precomputing can speed up application of multiple box filters
Can be used to approximate other (non-box) kernels
Method
Summed area table is precalculated
๏‚ง Pixel values from origin
๏‚ง Recursive algorithm used
y = f(x)
Area = โŽฐ f(x).dx
a
b
a b
Integral Images: From Integral to Area
Out
WIn
Column (C)
Row (R)
Total (T; Entire Image Segment)
๐‘พ = ๐‘ป โˆ’ ๐‘ช โˆ’ ๐‘น + ๐‘ฐ๐’
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
Input
1 3 6 10
6 14 24 36
15 33 54 78
28 60 96 136
Output
Dice Probability
Probability of a 2 .... given by:
1. Taking all combinations of events.
2. Computing sums.
3. Returning counts of 2 events divided by total number of events.
4. Also, we know this is 1/6 * 1/6
die = np.full(6, 1/6.0)print(die)
np.convolve(die, die, mode='full')
Dice Probability: Convolution
Probability of a each outcomeโ€ฆ
0.0278
0.0556
0.0833
0.111
0.1389
0.1667
0.1389
0.1111
0.0833
0.0556
0.0278
Box graphic from: https://commons.wikimedia.org/wiki/Category:Dice_probability#/media/File:Twodice.svg
Dice graphic from: https://commons.wikimedia.org/wiki/Category:6-sided_dice#/media/File:6sided_dice.jpg
Probability as a Sliding Window
In the dice example, to get, say, a total
of 7:
โ€ข We can fix a point 7 and slide the two arrays past
(one in reverse order).
โ€ข And when they add up to seven, we take that
sum-product.
1 2 3 4 5 6
6 5 4 3 2 1
1 2 3 4 5 6
6 5 4 3 2 1
1 2 3 4 5 6
6 5 4 3 2 1
1 2 3 4 5 6
6 5 4 3 2 1
Ways to get 12
Ways to get 10
Ways to get 8
Ways to get 7P(s=2) = P1( )* P2( )
P(s=3) = P1( )* P2( ) + P1( )* P2( )
๐‘ƒ ๐‘  = ๐‘‡ =
๐‘–
๐‘ƒ(๐‘–)๐‘ƒ(๐‘‡ โˆ’ ๐‘–)
๐‘ƒ ๐‘‡ =
๐‘–+๐‘—=๐‘‡
๐‘ƒ ๐‘– ๐‘ƒ(๐‘—)
Probability as a Convolution
In general, the probability of sums of events is the convolution of the probabilities of the
component events.
In general, in mathematics, a convolution is a function h produced by a function g
โ€œoperatingโ€ on another function f. This is usually written:
Here, the distribution of probabilities for two dice (h) is a convolution of the probability
distribution over the first die (f) with the probability distribution over the second die (g).
๐‘“โจ‚๐‘” = โ„Ž
Probability as a Convolution
Dice probability is a convolution:
Sum over all the right rolls (r) so that the events add up to our desired total T
Note: r + (T - r) = T
Could also write it like this: And in general like this:
Those sums are convolutions!
Here, we've convolved a discrete function with itself.
Just like we'll do with images, except images are 2D.
๐‘ƒ 2 = ๐‘ƒ 1 โˆ— ๐‘ƒ(1)
๐‘ƒ 3 =
๐‘Ÿ=1,2
๐‘ƒ ๐‘Ÿ โˆ— ๐‘ƒ ๐‘‡ โˆ’ ๐‘Ÿ = ๐‘ƒ 1 โˆ— ๐‘ 2 + ๐‘ƒ 2 โˆ— ๐‘ƒ(1)
Probability as a Convolution
Dice example with code:
Step Code & Output
Generate dice probability
distribution
Convolve to get overall
probabilities
A General 2D Convolution
The usual formula looks like this:
But, as an idea, that is less than clear!
๐‘“ โŠ— ๐‘” ๐‘, ๐‘€ =
โ€๐‘Ÿ๐‘–๐‘”โ„Ž๐‘กโ€๐‘–๐‘—,๐‘˜๐‘™
๐‘“ ๐‘–, ๐‘˜ ๐‘”[๐‘—, ๐‘™]๐‘“ โŠ— ๐‘” ๐‘ =
๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก๐‘ 
๐‘“ ๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก ๐‘”[๐‘ โˆ’ ๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก]
๐‘–๐‘š๐‘” โŠ— ๐‘˜๐‘’๐‘Ÿ๐‘› ๐‘…, ๐ถ =
๐‘๐‘–๐‘ฅ๐‘’๐‘™_๐‘๐‘Ž๐‘–๐‘Ÿ
๐‘–๐‘›๐‘Ž๐‘™๐‘–๐‘”๐‘›๐‘’๐‘‘
๐‘›๐‘’๐‘–๐‘”โ„Ž๐‘๐‘œ๐‘Ÿโ„Ž๐‘œ๐‘œ๐‘‘๐‘ 
(๐‘˜๐‘’๐‘Ÿ๐‘›,๐‘…,๐ถ)
๐‘–๐‘š๐‘” ๐‘–๐‘š๐‘”๐‘Ÿ, ๐‘–๐‘š๐‘”๐‘ ๐‘˜๐‘’๐‘Ÿ๐‘›[๐‘˜๐‘’๐‘Ÿ๐‘›๐‘Ÿ, ๐‘˜๐‘’๐‘Ÿ๐‘›๐‘]
result
imgr, imgc
kernr, kernc
given a kernel, and R, Cโ€ฆ
this tells us the corresponding
pixels in img and elements in
kernel
a pixel
2D Convolution
A combination of a sliding window as it moves over a 2D image
We align the kernel with a block of the image at an anchor point
In the probability example, our anchor point was a Total
The resulting value at the anchor point is the dot-product of the aligned regions
Dot-product means multiply elements pairwise and then sum
2D Convolution
The probability formula and the 2D convolution formula have these pieces:
Multiply element wise
Sum the products
Align
The alignment determines the values we sum over and the values passed to the
functions inside the sum:
Total anchored the probabilities
For a 2D convolution, a target pixel at R,C anchors the neighborhoods of the image and
the kernel
Manual 2D Convolution with SciPy
convolve2d(box, kernel, mode)
With mode=โ€˜sameโ€™ or mode=โ€˜fullโ€™ we have to pad
ยง Can use wrapping
ยง Symmetric
ยง Fill value
Kernel Methods
Kernel methods involve taking a convolution of a kernel - a small array -
with an image to detect the presence of features at locations on an
image.
Also called filtering methods.
Images are filtered using neighborhood operators.
Separable filtering:
2D can be applied as sequential 1D (first a horizontal filter, then a vertical filter).
Low-Pass Filters
Linear methods:
โ€ข Box (mean)
โ€ข Gaussian blur (weighted sum)
Non-linear methods:
โ€ข Bilateral filter (combination of a Gaussian and a empirical similarity of the
neighborhood to the center pixel)
โ€ข Median blur
Blurring
Blurring and Smoothing Using Bilateral Filter
Bilateral smooths both intensities and colors
Edge preserving will produce a watercolor effect when repeated
Pixel distance -and- "color distance"
Kernel Application Details
Padding โ€“ border effects
Constant
Replicate the edge pixel value
Wrap around to other side of image
Mirror back toward center of image
Erosion: Pixel is on if entire
kernel-neighborhood is on
Morphology Fundamental Operations
Morphology in image processing refers to turning each pixel of an image on or off
depending on whether its neighborhood meets a criteria.
Fundamental examples: erosion and dilation
Dilation: Pixel is on if ANY
kernel-neighborhood is on
Original image
Morphology Fundamental Operations
Binary image operations: formal definitions
Morphological operations
Dilation dilate(f,s) = c > 1
on if any in neighborhood are on
Erosion erode(f,s) = c = S
on if all in neighborhood are on
Majority maj(f,s) = c > S/2
on if most in neighborhood are on
s= structuring element f = binary image
S= size of structuring element
c = count in aligned neighborhood after multiplying f and s
Erode
Erode away the foreground (foreground is white)
โ€ข Pixel is on if entire kernel-neighborhood is on
โ€ข So, inside is good, outside is off
โ€ข Borders of foreground: will be reduced
โ€ข More will become background
โ€ข Enhances background
โ€ข Removes noise in background
โ€ข Add noise in foreground
Pixel of interest
Dilate
Dilate adds to the foreground (white)
โ€ข Pixel is on if ANY kernel-neighborhood is on
โ€ข Inside - good; outside โ€“ off
โ€ข Border โ€“ expanded
โ€ข Enhances foreground
โ€ข Removes noise in foreground
โ€ข Adds noise in background
Pixel of interest
Morphology: Additional Operations
Binary image operations
Morphological operations
Opening open(f,s) = dilate(erode(f,s), s)
Closing close(f,s) = erode(dilate(f,s), s)
s= structuring element
f = binary image
S= size of structuring element
c = count
Other Relationships: Open
Opening: dilate(erode(img))
โ€ข Erode it, then dilate it
โ€ข Remove outside noise (false foreground); remove local peaks
โ€ข Count objects
โ€ข opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
Other Relationships: Close
Closing: erode(dilate(img))
โ€ข Remove inside noise (false background)
โ€ข Used as a step in connected-components analysis
closing = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel)
Iterations of these are erode(erode(dilate(dilate())))
๏‚ง ei(di(img))
gradient = dilation - erosion
๏‚ง finds boundary
gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel
Other Relationships: Tophat/Blackhat
Isolate brighter/dimmer (tophat/blackhat) than their surroundings
Tophat: image โ€“ opening
tophat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel)
Blackhat: closing โ€“ image
blackhat = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel)
These can be related to other mathematical techniques:
โ€ข Max-pool in neural network layers is a dilation using a square structuring element followed by
downsample (1/p).
โ€ข It is possible to learn the operations; for example, as implicit layers in the neural network.
Image Pyramids
A stack of images at different resolutions is an image pyramid.
โ€ข Use when you are unsure of object sizes in an image
Work with images of different resolutions and find object in each
โ€ข Uses Gaussian and Laplacian layers
Gaussian Pyramid
Having multiple resolutions represented
simultaneously.
Working with lower-resolution images allows for
faster computations.
Each Gaussian level loses information:
โ€ข Create a complementary Laplacian Pyramid, which
holds that information
โ€ข Bottom Gaussian level plus all Laplacian levels
reconstructs the original image
Pyramids
Gaussian Pyramid Laplacian Pyramid
Example Laplacian Level
๐ฟ๐‘œ = ๐บ๐‘œ โˆ’ ๐‘ˆ๐‘ƒ ๐บ1 โŠ— Gaus5x5 = ๐บ๐‘œ โˆ’ ๐‘ƒ๐‘ฆ๐‘Ÿ๐‘ˆ๐‘ ๐บ1
Laplacian Pyramid (pyrUp/pyrDown)
Power of 2 for biggest image sizes
โ€ข This makes halving/doubling work well
โ€ข Can also pad out to next power of 2
Expanding:
๐‘”0 = ๐‘™0 + ๐‘ˆ๐‘ƒ ๐‘”1 = ๐‘™0 + ๐‘ˆ๐‘ƒ ๐‘™1 + ๐‘ˆ๐‘ƒ ๐‘”2 = ๐‘™0 + ๐‘ˆ๐‘ƒ(๐‘™1 + ๐‘ˆ๐‘ƒ ๐‘๐‘Ž๐‘ ๐‘’ )
Using Image Pyramids for Blending
Combining two images seamlessly (image
stitching and compositions)
1. Decompose source images into Laplacian
pyramid.
2. Create a Gaussian mask from the binary
mask image.
3. Compute the sum of the two weighted
pyramids to stitch the images together.
Edge Detectors
Finding stable features for matching
Matching human boundary detection
Sobel, Scharr, and Laplacian filters
Sobel
Most common differentiation operator
Approximates a derivative on discrete grid
โ€ข Actually a fit to polynomial
Used for kernels of any size
โ€ข Larger kernels are less sensitive to noise, and therefore more accurate
Combine Gaussian smoothing with differentiation
Higher order also (first, second, third, or mixed derivatives)
-1 0 1
-2 0 2
-1 0 1
1 2 1
0 0 0
-1 -2 -1
Sobel x
Sobel y
Scharr
Scharr is a specific Sobel case used for computing 3x3
โ€ข As fast as Sobel, but more accurate for small kernel sizes
Especially useful when implementing common shape
classifiers
โ€ข Need to collect shape information through histograms of gradient
angles
First x- or y- image derivative
โ€ข Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType)
โ€ข Sobel(src, dst, ddepth, dx, dy, cv_scharr, scale, delta, borderType)
-3 0 3
-10 0 10
-3 0 3
3 10 3
0 0 0
-3 10 3
Scharr x
Scharr y
Laplacian
Laplacian function
Can be used to detect edges
Can use 8-bit or 32-bit source image
Often used for blob detection
Local peak and trough in an image will maximize and minimize Laplacian
Sum of second derivatives in x,y
โ€ข Works like a second-order Sobel derivative
๐ฟ๐‘Ž๐‘๐‘™๐‘Ž๐‘๐‘’ ๐‘“ =
๐›ฟ2๐‘“
๐›ฟ๐‘ฅ2
+
๐›ฟ2๐‘“
๐›ฟ๐‘ฆ2
Multiple Colors
Should you detect edges in color or grayscale?
โ€ข Typically we do edge detection in grayscale.
โ€ข If we want to do edge detection in colorโ€ฆ
โ€ข If you take the union of edges, you might thicken the edges
โ€ข If you take the sum of gradients, you need to be careful about sign cancelation
โ€ข Consider non-RGB color space
Distance Transform
Once we have edges, we may need to find and group together pixels as an object.
One step in that process is to find the distances from a pixel to a boundary:
1. Invert an edge detector (non-edge is white)
2. Find distance from central points (now white) to nearest edge (now black)

More Related Content

What's hot

Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlpankit_ppt
ย 
Deep learning summary
Deep learning summaryDeep learning summary
Deep learning summaryankit_ppt
ย 
Machine Learning - Introduction to Convolutional Neural Networks
Machine Learning - Introduction to Convolutional Neural NetworksMachine Learning - Introduction to Convolutional Neural Networks
Machine Learning - Introduction to Convolutional Neural NetworksAndrew Ferlitsch
ย 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoSeongwon Hwang
ย 
Foundations: Artificial Neural Networks
Foundations: Artificial Neural NetworksFoundations: Artificial Neural Networks
Foundations: Artificial Neural Networksananth
ย 
Image processing
Image processingImage processing
Image processingmaheshpene
ย 
Deep Feed Forward Neural Networks and Regularization
Deep Feed Forward Neural Networks and RegularizationDeep Feed Forward Neural Networks and Regularization
Deep Feed Forward Neural Networks and RegularizationYan Xu
ย 
Basics of Machine Learning
Basics of Machine LearningBasics of Machine Learning
Basics of Machine LearningPranav Challa
ย 
Kohonen self organizing maps
Kohonen self organizing mapsKohonen self organizing maps
Kohonen self organizing mapsraphaelkiminya
ย 
Lesson 39
Lesson 39Lesson 39
Lesson 39Avijit Kumar
ย 
Deep learning: Mathematical Perspective
Deep learning: Mathematical PerspectiveDeep learning: Mathematical Perspective
Deep learning: Mathematical PerspectiveYounusS2
ย 
Matrix Factorization
Matrix FactorizationMatrix Factorization
Matrix FactorizationYusuke Yamamoto
ย 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hakky St
ย 
Lesson 38
Lesson 38Lesson 38
Lesson 38Avijit Kumar
ย 
Lesson 36
Lesson 36Lesson 36
Lesson 36Avijit Kumar
ย 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Varun Ojha
ย 
Dimensionality reduction
Dimensionality reductionDimensionality reduction
Dimensionality reductionShatakirti Er
ย 
Data Science - Part IX - Support Vector Machine
Data Science - Part IX -  Support Vector MachineData Science - Part IX -  Support Vector Machine
Data Science - Part IX - Support Vector MachineDerek Kane
ย 
Project 2: Baseband Data Communication
Project 2: Baseband Data CommunicationProject 2: Baseband Data Communication
Project 2: Baseband Data CommunicationDanish Bangash
ย 

What's hot (20)

Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlp
ย 
Deep learning summary
Deep learning summaryDeep learning summary
Deep learning summary
ย 
Machine Learning - Introduction to Convolutional Neural Networks
Machine Learning - Introduction to Convolutional Neural NetworksMachine Learning - Introduction to Convolutional Neural Networks
Machine Learning - Introduction to Convolutional Neural Networks
ย 
Convolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in TheanoConvolutional Neural Network (CNN) presentation from theory to code in Theano
Convolutional Neural Network (CNN) presentation from theory to code in Theano
ย 
Foundations: Artificial Neural Networks
Foundations: Artificial Neural NetworksFoundations: Artificial Neural Networks
Foundations: Artificial Neural Networks
ย 
Image processing
Image processingImage processing
Image processing
ย 
Deep Feed Forward Neural Networks and Regularization
Deep Feed Forward Neural Networks and RegularizationDeep Feed Forward Neural Networks and Regularization
Deep Feed Forward Neural Networks and Regularization
ย 
Basics of Machine Learning
Basics of Machine LearningBasics of Machine Learning
Basics of Machine Learning
ย 
Kohonen self organizing maps
Kohonen self organizing mapsKohonen self organizing maps
Kohonen self organizing maps
ย 
Lesson 39
Lesson 39Lesson 39
Lesson 39
ย 
PCA and SVD in brief
PCA and SVD in briefPCA and SVD in brief
PCA and SVD in brief
ย 
Deep learning: Mathematical Perspective
Deep learning: Mathematical PerspectiveDeep learning: Mathematical Perspective
Deep learning: Mathematical Perspective
ย 
Matrix Factorization
Matrix FactorizationMatrix Factorization
Matrix Factorization
ย 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
ย 
Lesson 38
Lesson 38Lesson 38
Lesson 38
ย 
Lesson 36
Lesson 36Lesson 36
Lesson 36
ย 
Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)Chapter 1 introduction (Image Processing)
Chapter 1 introduction (Image Processing)
ย 
Dimensionality reduction
Dimensionality reductionDimensionality reduction
Dimensionality reduction
ย 
Data Science - Part IX - Support Vector Machine
Data Science - Part IX -  Support Vector MachineData Science - Part IX -  Support Vector Machine
Data Science - Part IX - Support Vector Machine
ย 
Project 2: Baseband Data Communication
Project 2: Baseband Data CommunicationProject 2: Baseband Data Communication
Project 2: Baseband Data Communication
ย 

Similar to 03 image transformations_i

Introduction to Applied Machine Learning
Introduction to Applied Machine LearningIntroduction to Applied Machine Learning
Introduction to Applied Machine LearningSheilaJimenezMorejon
ย 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCVAmit Mandelbaum
ย 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basicsAtul Kumar Jha
ย 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningMasahiro Sakai
ย 
Deferred Pixel Shading on the PLAYSTATIONยฎ3
Deferred Pixel Shading on the PLAYSTATIONยฎ3Deferred Pixel Shading on the PLAYSTATIONยฎ3
Deferred Pixel Shading on the PLAYSTATIONยฎ3Slide_N
ย 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processingMohammed Kamel
ย 
Neural Networks - How do they work?
Neural Networks - How do they work?Neural Networks - How do they work?
Neural Networks - How do they work?Accubits Technologies
ย 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Networkaciijournal
ย 
Image Interpolation Techniques with Optical and Digital Zoom Concepts
Image Interpolation Techniques with Optical and Digital Zoom ConceptsImage Interpolation Techniques with Optical and Digital Zoom Concepts
Image Interpolation Techniques with Optical and Digital Zoom Conceptsmmjalbiaty
ย 
Capstone paper
Capstone paperCapstone paper
Capstone paperMuhammad Saeed
ย 
A Beginner's Guide to Monocular Depth Estimation
A Beginner's Guide to Monocular Depth EstimationA Beginner's Guide to Monocular Depth Estimation
A Beginner's Guide to Monocular Depth EstimationRyo Takahashi
ย 
00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000Ivonne Liu
ย 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdfnyomans1
ย 
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...IRJET Journal
ย 
Non-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation MethodNon-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation MethodEditor IJCATR
ย 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesSubhajit Sahu
ย 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median FiltersAmnaakhaan
ย 
PPT Image Analysis(IRDE, DRDO)
PPT Image Analysis(IRDE, DRDO)PPT Image Analysis(IRDE, DRDO)
PPT Image Analysis(IRDE, DRDO)Nidhi Gopal
ย 

Similar to 03 image transformations_i (20)

Log polar coordinates
Log polar coordinatesLog polar coordinates
Log polar coordinates
ย 
Introduction to Applied Machine Learning
Introduction to Applied Machine LearningIntroduction to Applied Machine Learning
Introduction to Applied Machine Learning
ย 
Introduction to OpenCV
Introduction to OpenCVIntroduction to OpenCV
Introduction to OpenCV
ย 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basics
ย 
DeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep LearningDeepXplore: Automated Whitebox Testing of Deep Learning
DeepXplore: Automated Whitebox Testing of Deep Learning
ย 
Deferred Pixel Shading on the PLAYSTATIONยฎ3
Deferred Pixel Shading on the PLAYSTATIONยฎ3Deferred Pixel Shading on the PLAYSTATIONยฎ3
Deferred Pixel Shading on the PLAYSTATIONยฎ3
ย 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processing
ย 
Neural Networks - How do they work?
Neural Networks - How do they work?Neural Networks - How do they work?
Neural Networks - How do they work?
ย 
Image De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural NetworkImage De-Noising Using Deep Neural Network
Image De-Noising Using Deep Neural Network
ย 
Image Interpolation Techniques with Optical and Digital Zoom Concepts
Image Interpolation Techniques with Optical and Digital Zoom ConceptsImage Interpolation Techniques with Optical and Digital Zoom Concepts
Image Interpolation Techniques with Optical and Digital Zoom Concepts
ย 
Capstone paper
Capstone paperCapstone paper
Capstone paper
ย 
A Beginner's Guide to Monocular Depth Estimation
A Beginner's Guide to Monocular Depth EstimationA Beginner's Guide to Monocular Depth Estimation
A Beginner's Guide to Monocular Depth Estimation
ย 
00463517b1e90c1e63000000
00463517b1e90c1e6300000000463517b1e90c1e63000000
00463517b1e90c1e63000000
ย 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdf
ย 
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
An Approach for Image Deblurring: Based on Sparse Representation and Regulari...
ย 
Non-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation MethodNon-Blind Deblurring Using Partial Differential Equation Method
Non-Blind Deblurring Using Partial Differential Equation Method
ย 
mini prjt
mini prjtmini prjt
mini prjt
ย 
CUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : NotesCUDA by Example : Constant Memory and Events : Notes
CUDA by Example : Constant Memory and Events : Notes
ย 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median Filters
ย 
PPT Image Analysis(IRDE, DRDO)
PPT Image Analysis(IRDE, DRDO)PPT Image Analysis(IRDE, DRDO)
PPT Image Analysis(IRDE, DRDO)
ย 

More from ankit_ppt

01 foundations
01 foundations01 foundations
01 foundationsankit_ppt
ย 
Word2 vec
Word2 vecWord2 vec
Word2 vecankit_ppt
ย 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measuresankit_ppt
ย 
Text generation and_advanced_topics
Text generation and_advanced_topicsText generation and_advanced_topics
Text generation and_advanced_topicsankit_ppt
ย 
Nlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniquesNlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniquesankit_ppt
ย 
Latent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modelingLatent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modelingankit_ppt
ย 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlpankit_ppt
ย 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descentankit_ppt
ย 
Ml9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsMl9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsankit_ppt
ย 
Ml8 boosting and-stacking
Ml8 boosting and-stackingMl8 boosting and-stacking
Ml8 boosting and-stackingankit_ppt
ย 
Ml7 bagging
Ml7 baggingMl7 bagging
Ml7 baggingankit_ppt
ย 
Ml6 decision trees
Ml6 decision treesMl6 decision trees
Ml6 decision treesankit_ppt
ย 
Ml5 svm and-kernels
Ml5 svm and-kernelsMl5 svm and-kernels
Ml5 svm and-kernelsankit_ppt
ย 
Ml4 naive bayes
Ml4 naive bayesMl4 naive bayes
Ml4 naive bayesankit_ppt
ย 
Lesson 3 ai in the enterprise
Lesson 3   ai in the enterpriseLesson 3   ai in the enterprise
Lesson 3 ai in the enterpriseankit_ppt
ย 
Ml3 logistic regression-and_classification_error_metrics
Ml3 logistic regression-and_classification_error_metricsMl3 logistic regression-and_classification_error_metrics
Ml3 logistic regression-and_classification_error_metricsankit_ppt
ย 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionankit_ppt
ย 
Ml1 introduction to-supervised_learning_and_k_nearest_neighbors
Ml1 introduction to-supervised_learning_and_k_nearest_neighborsMl1 introduction to-supervised_learning_and_k_nearest_neighbors
Ml1 introduction to-supervised_learning_and_k_nearest_neighborsankit_ppt
ย 
Lesson 2 ai in industry
Lesson 2   ai in industryLesson 2   ai in industry
Lesson 2 ai in industryankit_ppt
ย 
Lesson 5 arima
Lesson 5 arimaLesson 5 arima
Lesson 5 arimaankit_ppt
ย 

More from ankit_ppt (20)

01 foundations
01 foundations01 foundations
01 foundations
ย 
Word2 vec
Word2 vecWord2 vec
Word2 vec
ย 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measures
ย 
Text generation and_advanced_topics
Text generation and_advanced_topicsText generation and_advanced_topics
Text generation and_advanced_topics
ย 
Nlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniquesNlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniques
ย 
Latent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modelingLatent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modeling
ย 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
ย 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descent
ย 
Ml9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsMl9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methods
ย 
Ml8 boosting and-stacking
Ml8 boosting and-stackingMl8 boosting and-stacking
Ml8 boosting and-stacking
ย 
Ml7 bagging
Ml7 baggingMl7 bagging
Ml7 bagging
ย 
Ml6 decision trees
Ml6 decision treesMl6 decision trees
Ml6 decision trees
ย 
Ml5 svm and-kernels
Ml5 svm and-kernelsMl5 svm and-kernels
Ml5 svm and-kernels
ย 
Ml4 naive bayes
Ml4 naive bayesMl4 naive bayes
Ml4 naive bayes
ย 
Lesson 3 ai in the enterprise
Lesson 3   ai in the enterpriseLesson 3   ai in the enterprise
Lesson 3 ai in the enterprise
ย 
Ml3 logistic regression-and_classification_error_metrics
Ml3 logistic regression-and_classification_error_metricsMl3 logistic regression-and_classification_error_metrics
Ml3 logistic regression-and_classification_error_metrics
ย 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regression
ย 
Ml1 introduction to-supervised_learning_and_k_nearest_neighbors
Ml1 introduction to-supervised_learning_and_k_nearest_neighborsMl1 introduction to-supervised_learning_and_k_nearest_neighbors
Ml1 introduction to-supervised_learning_and_k_nearest_neighbors
ย 
Lesson 2 ai in industry
Lesson 2   ai in industryLesson 2   ai in industry
Lesson 2 ai in industry
ย 
Lesson 5 arima
Lesson 5 arimaLesson 5 arima
Lesson 5 arima
ย 

Recently uploaded

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
ย 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
ย 
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
ย 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
ย 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
ย 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
ย 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
ย 
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
ย 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
ย 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
ย 
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
ย 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
ย 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
ย 
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
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
ย 
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
ย 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
ย 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
ย 

Recently uploaded (20)

Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
ย 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
ย 
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
ย 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
ย 
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Serviceyoung call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
young call girls in Green Park๐Ÿ” 9953056974 ๐Ÿ” escort Service
ย 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
ย 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
ย 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
ย 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
ย 
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...
ย 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
ย 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
ย 
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...
ย 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
ย 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
ย 
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
๐Ÿ”9953056974๐Ÿ”!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
ย 
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...
ย 
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
ย 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
ย 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
ย 

03 image transformations_i

  • 2. Legal Notices and Disclaimers This presentation is for informational purposes only. INTEL MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY. Intel technologiesโ€™ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at intel.com. This sample source code is released under the Intel Sample Source Code License Agreement. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries. *Other names and brands may be claimed as the property of others. Copyright ยฉ 2018, Intel Corporation. All rights reserved. 2
  • 3. Calculus in Pixel Space: Image Derivatives An image derivative represents the amount that an imageโ€™s pixel values are changing at a given point. Analogous to a derivative from calculus: tangent ๐‘“โ€ฒ ๐‘ฅ = ฮ”๐‘ฆ ฮ”๐‘ฅ ๐‘“ ๐‘ฅ = ๐‘ฅ2
  • 4. Motivation for Image Derivatives Image derivatives in x or y directions can detect features of images, especially edges: Edges tend to correspond to changes in the intensity of pixels, which a derivative would capture. Image source: https://upload.wikimedia.org/wikipedia/commons/6/67/Intensity_image_with_gradient_images.png
  • 5. Calculus in Pixel Space: Image Derivatives Image derivatives example: Step Generate box Slice across middle Plot slice, derivative Code Output
  • 6. Integral Images Many applications Fast calculation of Haar wavelets in face recognition Precomputing can speed up application of multiple box filters Can be used to approximate other (non-box) kernels Method Summed area table is precalculated ๏‚ง Pixel values from origin ๏‚ง Recursive algorithm used y = f(x) Area = โŽฐ f(x).dx a b a b
  • 7. Integral Images: From Integral to Area Out WIn Column (C) Row (R) Total (T; Entire Image Segment) ๐‘พ = ๐‘ป โˆ’ ๐‘ช โˆ’ ๐‘น + ๐‘ฐ๐’ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Input 1 3 6 10 6 14 24 36 15 33 54 78 28 60 96 136 Output
  • 8.
  • 9. Dice Probability Probability of a 2 .... given by: 1. Taking all combinations of events. 2. Computing sums. 3. Returning counts of 2 events divided by total number of events. 4. Also, we know this is 1/6 * 1/6 die = np.full(6, 1/6.0)print(die) np.convolve(die, die, mode='full')
  • 10. Dice Probability: Convolution Probability of a each outcomeโ€ฆ 0.0278 0.0556 0.0833 0.111 0.1389 0.1667 0.1389 0.1111 0.0833 0.0556 0.0278 Box graphic from: https://commons.wikimedia.org/wiki/Category:Dice_probability#/media/File:Twodice.svg Dice graphic from: https://commons.wikimedia.org/wiki/Category:6-sided_dice#/media/File:6sided_dice.jpg
  • 11. Probability as a Sliding Window In the dice example, to get, say, a total of 7: โ€ข We can fix a point 7 and slide the two arrays past (one in reverse order). โ€ข And when they add up to seven, we take that sum-product. 1 2 3 4 5 6 6 5 4 3 2 1 1 2 3 4 5 6 6 5 4 3 2 1 1 2 3 4 5 6 6 5 4 3 2 1 1 2 3 4 5 6 6 5 4 3 2 1 Ways to get 12 Ways to get 10 Ways to get 8 Ways to get 7P(s=2) = P1( )* P2( ) P(s=3) = P1( )* P2( ) + P1( )* P2( ) ๐‘ƒ ๐‘  = ๐‘‡ = ๐‘– ๐‘ƒ(๐‘–)๐‘ƒ(๐‘‡ โˆ’ ๐‘–) ๐‘ƒ ๐‘‡ = ๐‘–+๐‘—=๐‘‡ ๐‘ƒ ๐‘– ๐‘ƒ(๐‘—)
  • 12. Probability as a Convolution In general, the probability of sums of events is the convolution of the probabilities of the component events. In general, in mathematics, a convolution is a function h produced by a function g โ€œoperatingโ€ on another function f. This is usually written: Here, the distribution of probabilities for two dice (h) is a convolution of the probability distribution over the first die (f) with the probability distribution over the second die (g). ๐‘“โจ‚๐‘” = โ„Ž
  • 13. Probability as a Convolution Dice probability is a convolution: Sum over all the right rolls (r) so that the events add up to our desired total T Note: r + (T - r) = T Could also write it like this: And in general like this: Those sums are convolutions! Here, we've convolved a discrete function with itself. Just like we'll do with images, except images are 2D. ๐‘ƒ 2 = ๐‘ƒ 1 โˆ— ๐‘ƒ(1) ๐‘ƒ 3 = ๐‘Ÿ=1,2 ๐‘ƒ ๐‘Ÿ โˆ— ๐‘ƒ ๐‘‡ โˆ’ ๐‘Ÿ = ๐‘ƒ 1 โˆ— ๐‘ 2 + ๐‘ƒ 2 โˆ— ๐‘ƒ(1)
  • 14. Probability as a Convolution Dice example with code: Step Code & Output Generate dice probability distribution Convolve to get overall probabilities
  • 15. A General 2D Convolution The usual formula looks like this: But, as an idea, that is less than clear! ๐‘“ โŠ— ๐‘” ๐‘, ๐‘€ = โ€๐‘Ÿ๐‘–๐‘”โ„Ž๐‘กโ€๐‘–๐‘—,๐‘˜๐‘™ ๐‘“ ๐‘–, ๐‘˜ ๐‘”[๐‘—, ๐‘™]๐‘“ โŠ— ๐‘” ๐‘ = ๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก๐‘  ๐‘“ ๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก ๐‘”[๐‘ โˆ’ ๐‘œ๐‘“๐‘“๐‘ ๐‘’๐‘ก] ๐‘–๐‘š๐‘” โŠ— ๐‘˜๐‘’๐‘Ÿ๐‘› ๐‘…, ๐ถ = ๐‘๐‘–๐‘ฅ๐‘’๐‘™_๐‘๐‘Ž๐‘–๐‘Ÿ ๐‘–๐‘›๐‘Ž๐‘™๐‘–๐‘”๐‘›๐‘’๐‘‘ ๐‘›๐‘’๐‘–๐‘”โ„Ž๐‘๐‘œ๐‘Ÿโ„Ž๐‘œ๐‘œ๐‘‘๐‘  (๐‘˜๐‘’๐‘Ÿ๐‘›,๐‘…,๐ถ) ๐‘–๐‘š๐‘” ๐‘–๐‘š๐‘”๐‘Ÿ, ๐‘–๐‘š๐‘”๐‘ ๐‘˜๐‘’๐‘Ÿ๐‘›[๐‘˜๐‘’๐‘Ÿ๐‘›๐‘Ÿ, ๐‘˜๐‘’๐‘Ÿ๐‘›๐‘] result imgr, imgc kernr, kernc given a kernel, and R, Cโ€ฆ this tells us the corresponding pixels in img and elements in kernel a pixel
  • 16. 2D Convolution A combination of a sliding window as it moves over a 2D image We align the kernel with a block of the image at an anchor point In the probability example, our anchor point was a Total The resulting value at the anchor point is the dot-product of the aligned regions Dot-product means multiply elements pairwise and then sum
  • 17. 2D Convolution The probability formula and the 2D convolution formula have these pieces: Multiply element wise Sum the products Align The alignment determines the values we sum over and the values passed to the functions inside the sum: Total anchored the probabilities For a 2D convolution, a target pixel at R,C anchors the neighborhoods of the image and the kernel
  • 18. Manual 2D Convolution with SciPy convolve2d(box, kernel, mode) With mode=โ€˜sameโ€™ or mode=โ€˜fullโ€™ we have to pad ยง Can use wrapping ยง Symmetric ยง Fill value
  • 19.
  • 20. Kernel Methods Kernel methods involve taking a convolution of a kernel - a small array - with an image to detect the presence of features at locations on an image. Also called filtering methods. Images are filtered using neighborhood operators. Separable filtering: 2D can be applied as sequential 1D (first a horizontal filter, then a vertical filter).
  • 21. Low-Pass Filters Linear methods: โ€ข Box (mean) โ€ข Gaussian blur (weighted sum) Non-linear methods: โ€ข Bilateral filter (combination of a Gaussian and a empirical similarity of the neighborhood to the center pixel) โ€ข Median blur
  • 23. Blurring and Smoothing Using Bilateral Filter Bilateral smooths both intensities and colors Edge preserving will produce a watercolor effect when repeated Pixel distance -and- "color distance"
  • 24. Kernel Application Details Padding โ€“ border effects Constant Replicate the edge pixel value Wrap around to other side of image Mirror back toward center of image
  • 25.
  • 26. Erosion: Pixel is on if entire kernel-neighborhood is on Morphology Fundamental Operations Morphology in image processing refers to turning each pixel of an image on or off depending on whether its neighborhood meets a criteria. Fundamental examples: erosion and dilation Dilation: Pixel is on if ANY kernel-neighborhood is on Original image
  • 27. Morphology Fundamental Operations Binary image operations: formal definitions Morphological operations Dilation dilate(f,s) = c > 1 on if any in neighborhood are on Erosion erode(f,s) = c = S on if all in neighborhood are on Majority maj(f,s) = c > S/2 on if most in neighborhood are on s= structuring element f = binary image S= size of structuring element c = count in aligned neighborhood after multiplying f and s
  • 28. Erode Erode away the foreground (foreground is white) โ€ข Pixel is on if entire kernel-neighborhood is on โ€ข So, inside is good, outside is off โ€ข Borders of foreground: will be reduced โ€ข More will become background โ€ข Enhances background โ€ข Removes noise in background โ€ข Add noise in foreground Pixel of interest
  • 29. Dilate Dilate adds to the foreground (white) โ€ข Pixel is on if ANY kernel-neighborhood is on โ€ข Inside - good; outside โ€“ off โ€ข Border โ€“ expanded โ€ข Enhances foreground โ€ข Removes noise in foreground โ€ข Adds noise in background Pixel of interest
  • 30. Morphology: Additional Operations Binary image operations Morphological operations Opening open(f,s) = dilate(erode(f,s), s) Closing close(f,s) = erode(dilate(f,s), s) s= structuring element f = binary image S= size of structuring element c = count
  • 31. Other Relationships: Open Opening: dilate(erode(img)) โ€ข Erode it, then dilate it โ€ข Remove outside noise (false foreground); remove local peaks โ€ข Count objects โ€ข opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
  • 32. Other Relationships: Close Closing: erode(dilate(img)) โ€ข Remove inside noise (false background) โ€ข Used as a step in connected-components analysis closing = cv2.morphologyEx(img, cv2.MORPH_CLOSE, kernel) Iterations of these are erode(erode(dilate(dilate()))) ๏‚ง ei(di(img)) gradient = dilation - erosion ๏‚ง finds boundary gradient = cv2.morphologyEx(img, cv2.MORPH_GRADIENT, kernel
  • 33. Other Relationships: Tophat/Blackhat Isolate brighter/dimmer (tophat/blackhat) than their surroundings Tophat: image โ€“ opening tophat = cv2.morphologyEx(img, cv2.MORPH_TOPHAT, kernel) Blackhat: closing โ€“ image blackhat = cv2.morphologyEx(img, cv2.MORPH_BLACKHAT, kernel) These can be related to other mathematical techniques: โ€ข Max-pool in neural network layers is a dilation using a square structuring element followed by downsample (1/p). โ€ข It is possible to learn the operations; for example, as implicit layers in the neural network.
  • 34.
  • 35. Image Pyramids A stack of images at different resolutions is an image pyramid. โ€ข Use when you are unsure of object sizes in an image Work with images of different resolutions and find object in each โ€ข Uses Gaussian and Laplacian layers
  • 36. Gaussian Pyramid Having multiple resolutions represented simultaneously. Working with lower-resolution images allows for faster computations. Each Gaussian level loses information: โ€ข Create a complementary Laplacian Pyramid, which holds that information โ€ข Bottom Gaussian level plus all Laplacian levels reconstructs the original image
  • 38. Example Laplacian Level ๐ฟ๐‘œ = ๐บ๐‘œ โˆ’ ๐‘ˆ๐‘ƒ ๐บ1 โŠ— Gaus5x5 = ๐บ๐‘œ โˆ’ ๐‘ƒ๐‘ฆ๐‘Ÿ๐‘ˆ๐‘ ๐บ1
  • 39. Laplacian Pyramid (pyrUp/pyrDown) Power of 2 for biggest image sizes โ€ข This makes halving/doubling work well โ€ข Can also pad out to next power of 2 Expanding: ๐‘”0 = ๐‘™0 + ๐‘ˆ๐‘ƒ ๐‘”1 = ๐‘™0 + ๐‘ˆ๐‘ƒ ๐‘™1 + ๐‘ˆ๐‘ƒ ๐‘”2 = ๐‘™0 + ๐‘ˆ๐‘ƒ(๐‘™1 + ๐‘ˆ๐‘ƒ ๐‘๐‘Ž๐‘ ๐‘’ )
  • 40. Using Image Pyramids for Blending Combining two images seamlessly (image stitching and compositions) 1. Decompose source images into Laplacian pyramid. 2. Create a Gaussian mask from the binary mask image. 3. Compute the sum of the two weighted pyramids to stitch the images together.
  • 41.
  • 42. Edge Detectors Finding stable features for matching Matching human boundary detection Sobel, Scharr, and Laplacian filters
  • 43. Sobel Most common differentiation operator Approximates a derivative on discrete grid โ€ข Actually a fit to polynomial Used for kernels of any size โ€ข Larger kernels are less sensitive to noise, and therefore more accurate Combine Gaussian smoothing with differentiation Higher order also (first, second, third, or mixed derivatives) -1 0 1 -2 0 2 -1 0 1 1 2 1 0 0 0 -1 -2 -1 Sobel x Sobel y
  • 44. Scharr Scharr is a specific Sobel case used for computing 3x3 โ€ข As fast as Sobel, but more accurate for small kernel sizes Especially useful when implementing common shape classifiers โ€ข Need to collect shape information through histograms of gradient angles First x- or y- image derivative โ€ข Scharr(src, dst, ddepth, dx, dy, scale, delta, borderType) โ€ข Sobel(src, dst, ddepth, dx, dy, cv_scharr, scale, delta, borderType) -3 0 3 -10 0 10 -3 0 3 3 10 3 0 0 0 -3 10 3 Scharr x Scharr y
  • 45. Laplacian Laplacian function Can be used to detect edges Can use 8-bit or 32-bit source image Often used for blob detection Local peak and trough in an image will maximize and minimize Laplacian Sum of second derivatives in x,y โ€ข Works like a second-order Sobel derivative ๐ฟ๐‘Ž๐‘๐‘™๐‘Ž๐‘๐‘’ ๐‘“ = ๐›ฟ2๐‘“ ๐›ฟ๐‘ฅ2 + ๐›ฟ2๐‘“ ๐›ฟ๐‘ฆ2
  • 46. Multiple Colors Should you detect edges in color or grayscale? โ€ข Typically we do edge detection in grayscale. โ€ข If we want to do edge detection in colorโ€ฆ โ€ข If you take the union of edges, you might thicken the edges โ€ข If you take the sum of gradients, you need to be careful about sign cancelation โ€ข Consider non-RGB color space
  • 47. Distance Transform Once we have edges, we may need to find and group together pixels as an object. One step in that process is to find the distances from a pixel to a boundary: 1. Invert an edge detector (non-edge is white) 2. Find distance from central points (now white) to nearest edge (now black)

Editor's Notes

  1. Image source: https://upload.wikimedia.org/wikipedia/commons/6/67/Intensity_image_with_gradient_images.png
  2. Box graphic from: https://commons.wikimedia.org/wiki/Category:Dice_probability#/media/File:Twodice.svg Dice graphic from: https://commons.wikimedia.org/wiki/Category:6-sided_dice#/media/File:6sided_dice.jpg SZ, pg. 111.
  3. NOTE: The probability formula we use is a specific example of a convolution.
  4. Sum over the indexes into the aligned neighborhood centered/anchored at N,M
  5. G_i, L_i are levels of the Gaussian and Laplacian pyramids, respectively. UP/DWN are operators that upscale/downscale (downsample) the image by inserting/deleting even rows/cols. PyUp/PyrDwn moves Up (G_1 -> G_2) the Gaussian pyramid (or down for PyrDown). Highlighted boxes are used to reconstruct the original image (G_2 + L_1 + L_0 = G_0).
  6. Note: The key point is that we can restore the original from the Laplacian layers plus the final Gaussan layer. The three images are reconstructed from (1) original, (2) lvl 1 gauss + lvl 0 laplace, and (3) lvl 2 gauss + lvl 0,1 laplace.