SlideShare uma empresa Scribd logo
1 de 48
Image Filtering
(Spatial Domain)
Elsayed Hemayed
Overview
• Convolution and Correlation
• Box Filter and Gaussian Filter
• Template Matching and CNN
Convolution
• Convolution of two functions is defined as
– In the discrete case is:
( )* ( ) ( ) ( )f x h x f h x d  


 
[ ]* [ ] [ ] [ ]
m
f n h n f m h n m


 
Convolution – 1D
• In the 2D discrete case Convolution is
defined as:
is called a linear filter1 2[ , ]h n n
Convolution – 2D
Image filtering• Image filtering:
– Compute function of local neighborhood at each position
],[],[],[
,
lnkmIlkfnmh
lk
 
I=imagef=filterh=output
2d coords=m,n2d coords=k,l
[ ] [ ]
[ ]
Correlation and Convolution
• 2d correlation
],[],[],[
,
lnkmIlkfnmh
lk
 
James Hays
e.g., h = scipy.signal.correlate2d(f,I)
Correlation and Convolution
• 2d correlation
• 2d convolution
],[],[],[
,
lnkmIlkfnmh
lk
 
],[],[],[
,
lnkmIlkfnmh
lk
 
Convolution is the same as correlation with a 180° rotated filter kernel.
Correlation and convolution are identical when the filter kernel is symmetric
James Hays
e.g., h = scipy.signal.correlate2d(f,I)
e.g., h = scipy.signal.convolve2d(f,I)
– Step1:
filter image
f f x h
Image Filtering
– Step2:
filter image
f x hf
Image Filtering
– Step3:
filter image
f x hf
Image Filtering
– Step4:
filter image
f x hf
Image Filtering
– Step5:
filter image
f x hf
etc. . . . .
Image Filtering
Image filtering
• Image filtering:
– Compute function of local neighborhood at each
position
• Really important!
– Enhance images
• Denoise, resize, increase contrast, etc.
– Extract information from images
• Texture, edges, distinctive points, etc.
– Detect patterns
• Template matching
],[],[],[
,
lnkmIlkfnmh
lk
 
James Hays
What does it do?
• Replaces each pixel with
an average of its
neighborhood
• Achieve smoothing effect
(remove sharp features)
111
111
111
],[g 
Box Filter
15
1 1 1
1
1 1 1
9
1 1 1
 
 
 
  
* =
Smoothing with box filter
17
Practice with linear filters
000
010
000
Original
?
18
Practice with linear filters
000
010
000
Original Filtered
(no change)
19
Practice with linear filters
000
100
000
Original
?
20
Practice with linear filters
000
100
000
Original Shifted left
By 1 pixel
21
Practice with linear filters
Original
111
111
111
000
020
000
- ?
22
Practice with linear filters
Original
111
111
111
000
020
000
-
Sharpening filter
- Accentuates differences with local
average
23
Sharpening
24
Edges
-101
-202
-101
Vertical Edge
(absolute value)
Sobel
David Lowe
Edges
-1-2-1
000
121
Horizontal Edge
(absolute value)
Sobel
David Lowe
• Spatially-weighted average
0.003 0.013 0.022 0.013 0.003
0.013 0.059 0.097 0.059 0.013
0.022 0.097 0.159 0.097 0.022
0.013 0.059 0.097 0.059 0.013
0.003 0.013 0.022 0.013 0.003
5 x 5,  = 1
Slide credit: Christopher Rasmussen
Important filter: Gaussian
27
Smoothing with Gaussian filter
28
Smoothing with box filter
29
Gaussian vs. mean filters
What does real blur look like?
Gaussian filters
• What parameters matter here?
• Variance of Gaussian: determines extent of
smoothing
Source: K. Grauman
31
Smoothing with a Gaussian
…
Parameter σ is the “scale” / “width” / “spread” of the Gaussian
kernel, and controls the amount of smoothing.
Source: K. Grauman
32
Gaussian filters
• Remove “high-frequency” components from the
image (low-pass filter)
– Images become more smooth
• Gaussian convolved with Gaussian…
…is another Gaussian
– So can smooth with small-width kernel, repeat, and
get same result as larger-width kernel would have
– Convolving two times with Gaussian kernel of width σ
is same as convolving once with kernel of width σ √2
• Separable kernel
– Factors into product of two 1D Gaussians
Source: K. Grauman
Separability of the Gaussian filter
Source: D. Lowe
Separability example
*
*
=
=
2D convolution
(center location only)
Source: K. Grauman
The filter factors
into a product of 1D
filters:
Perform convolution
along rows:
Followed by convolution
along the remaining column:
=
Separable filters
* =
Compute Gaussian in
horizontal direction, followed
by the vertical direction.
Not all filters are separable.
Freeman and Adelson, 1991
Much faster!
Separability
Why is separability useful in practice?
MxN image, PxQ filter
• 2D convolution: ~MNPQ multiply-adds
• Separable 2D: ~MN(P+Q) multiply-adds
Speed up = PQ/(P+Q)
9x9 filter = ~4.5x faster
Practical matters
• How big should the filter be?
• Values at edges should be near zero
• Gaussians have infinite extent…
• Rule of thumb for Gaussian: set filter half-
width to about 3 σ
James Hays
Practical matters
• What about near the edge?
– the filter window falls off the edge of the
image
– need to extrapolate
– methods:
• clip filter (black)
• wrap around
• copy edge
• reflect across edge
Source: S. Marschner
mode=‘full’ (Default; pad with zeros)
mode=‘same’ (Return same size as D)
mode=‘valid’ (No padding)
Practical matters
I = correlate2d( D, f, ‘same’ )
I = convolve2d( D, f, ‘same’ )
# Normalize for visualization
>> I_norm = (I – np.min(I)) / (np.max(I) – np.min(I))
>> plt.imshow( I_norm )
Convolution in Convolutional
Neural Networks
• Convolution is the basic operation in
CNNs
• Learning convolution kernels allows us to
learn which `features’ provide useful
information in images.
Input Image
Feature Map
.
.
.
Convolution (Filtering) Example
Source: Rob Fergus, “Deep Learning & Feature Learning Methods for Vision” , CVPR 2012
Tutorial
Filters
>> f = D[ 57:117, 107:167 ]
Expect response ‘peak’ in middle of I
>> I = correlate2d( D, f, ‘same’ )
f
61 x 61
D (275 x 175 pixels)
I
Response
peak
Hmm…
That didn’t work – why not?
+
Correct
location
[Thanks to Robert Collins @ Penn State]
Template Matching
Correlation
],[],[],[
,
lnkmIlkfnmh
lk
 
e.g., h = scipy.signal.correlate2d(f,I)
As brightness in I increases, the response
in h will increase, as long as f is positive.
Overall brighter regions will give higher
correlation response -> not useful!
OK, so let’s subtract the mean
>> f = D[ 57:117, 107:167 ]
>> f2 = f – np.mean(f)
>> D2 = D – np.mean(D)
Now zero centered.
Score is higher only when dark parts
match and when light parts match.
>> I2 = correlate2d( D2, f2, ‘same’ )
f2
61 x 61
D2 (275 x 175 pixels)
I2
Or even
>> I3 = correlate2d( D2, f2, ‘full’ )
I3
D2 (275 x 175 pixels)
What happens with convolution?
>> f = D[ 57:117, 107:167 ]
>> f2 = f – np.mean(f)
>> D2 = D – np.mean(D)
>> I2 = convolve2d( D2, f2, ‘same’ )
f2
61 x 61
D2 (275 x 175 pixels)
I2
Summary
• Convolution and Correlation
• Box Filter and Gaussian Filter
• Template Matching and CNN

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Image Filtering in the Frequency Domain
Image Filtering in the Frequency DomainImage Filtering in the Frequency Domain
Image Filtering in the Frequency Domain
 
Adaptive Median Filters
Adaptive Median FiltersAdaptive Median Filters
Adaptive Median Filters
 
Image denoising
Image denoising Image denoising
Image denoising
 
5 spatial filtering p1
5 spatial filtering p15 spatial filtering p1
5 spatial filtering p1
 
Image enhancement techniques
Image enhancement techniques Image enhancement techniques
Image enhancement techniques
 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency Filters
 
6 spatial filtering p2
6 spatial filtering p26 spatial filtering p2
6 spatial filtering p2
 
Unit3 dip
Unit3 dipUnit3 dip
Unit3 dip
 
Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Image denoising
Image denoisingImage denoising
Image denoising
 
Enhancement in frequency domain
Enhancement in frequency domainEnhancement in frequency domain
Enhancement in frequency domain
 
Image degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem AshrafImage degradation and noise by Md.Naseem Ashraf
Image degradation and noise by Md.Naseem Ashraf
 
Image processing Presentation
Image processing PresentationImage processing Presentation
Image processing Presentation
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
Chapter10 image segmentation
Chapter10 image segmentationChapter10 image segmentation
Chapter10 image segmentation
 
Image enhancement sharpening
Image enhancement  sharpeningImage enhancement  sharpening
Image enhancement sharpening
 
DIP - Image Restoration
DIP - Image RestorationDIP - Image Restoration
DIP - Image Restoration
 
Image enhancement in the spatial domain1
Image enhancement in the spatial domain1Image enhancement in the spatial domain1
Image enhancement in the spatial domain1
 

Semelhante a Image filtering techniques

Spatial Filtering in intro image processingr
Spatial Filtering in intro image processingrSpatial Filtering in intro image processingr
Spatial Filtering in intro image processingrkumarankit06875
 
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb) IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb) Charles Deledalle
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicingElsayed Hemayed
 
Computer vision - images and image filtering
Computer vision - images and image filtering Computer vision - images and image filtering
Computer vision - images and image filtering Wael Badawy
 
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021Sergey Karayev
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Image enhancement
Image enhancementImage enhancement
Image enhancementKuppusamy P
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processingMohammed Kamel
 
Spatial filtering using image processing
Spatial filtering using image processingSpatial filtering using image processing
Spatial filtering using image processingAnuj Arora
 

Semelhante a Image filtering techniques (20)

Spatial Filtering in intro image processingr
Spatial Filtering in intro image processingrSpatial Filtering in intro image processingr
Spatial Filtering in intro image processingr
 
Lecture 4
Lecture 4Lecture 4
Lecture 4
 
PPT s04-machine vision-s2
PPT s04-machine vision-s2PPT s04-machine vision-s2
PPT s04-machine vision-s2
 
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb) IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
IVR - Chapter 2 - Basics of filtering I: Spatial filters (25Mb)
 
Lec05 filter
Lec05 filterLec05 filter
Lec05 filter
 
Spatial filtering
Spatial filteringSpatial filtering
Spatial filtering
 
Filtering.ppt
Filtering.pptFiltering.ppt
Filtering.ppt
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicing
 
Computer vision - images and image filtering
Computer vision - images and image filtering Computer vision - images and image filtering
Computer vision - images and image filtering
 
2. filtering basics
2. filtering basics2. filtering basics
2. filtering basics
 
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021
Lecture 2.A: Convolutional Networks - Full Stack Deep Learning - Spring 2021
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Lighting and shading
Lighting and shadingLighting and shading
Lighting and shading
 
Image enhancement
Image enhancementImage enhancement
Image enhancement
 
CNN_AH.pptx
CNN_AH.pptxCNN_AH.pptx
CNN_AH.pptx
 
CNN_AH.pptx
CNN_AH.pptxCNN_AH.pptx
CNN_AH.pptx
 
SPATIAL FILTER
SPATIAL FILTERSPATIAL FILTER
SPATIAL FILTER
 
Lecture-11.pdf
Lecture-11.pdfLecture-11.pdf
Lecture-11.pdf
 
Notes on image processing
Notes on image processingNotes on image processing
Notes on image processing
 
Spatial filtering using image processing
Spatial filtering using image processingSpatial filtering using image processing
Spatial filtering using image processing
 

Mais de Elsayed Hemayed

14 cie552 camera_calibration
14 cie552 camera_calibration14 cie552 camera_calibration
14 cie552 camera_calibrationElsayed Hemayed
 
12 cie552 object_recognition
12 cie552 object_recognition12 cie552 object_recognition
12 cie552 object_recognitionElsayed Hemayed
 
11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift11 cie552 image_featuresii_sift
11 cie552 image_featuresii_siftElsayed Hemayed
 
10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner10 cie552 image_featuresii_corner
10 cie552 image_featuresii_cornerElsayed Hemayed
 
09 cie552 image_featuresi
09 cie552 image_featuresi09 cie552 image_featuresi
09 cie552 image_featuresiElsayed Hemayed
 
08 cie552 image_segmentation
08 cie552 image_segmentation08 cie552 image_segmentation
08 cie552 image_segmentationElsayed Hemayed
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulationElsayed Hemayed
 
05 cie552 image_enhancement
05 cie552 image_enhancement05 cie552 image_enhancement
05 cie552 image_enhancementElsayed Hemayed
 
04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequencyElsayed Hemayed
 
02 cie552 image_andcamera
02 cie552 image_andcamera02 cie552 image_andcamera
02 cie552 image_andcameraElsayed Hemayed
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionElsayed Hemayed
 
Csci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiCsci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiElsayed Hemayed
 
Csci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeCsci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeElsayed Hemayed
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programsElsayed Hemayed
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programsElsayed Hemayed
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiElsayed Hemayed
 
Csci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingCsci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingElsayed Hemayed
 
Csci101 lect05 formatted_output
Csci101 lect05 formatted_outputCsci101 lect05 formatted_output
Csci101 lect05 formatted_outputElsayed Hemayed
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_iElsayed Hemayed
 

Mais de Elsayed Hemayed (20)

14 cie552 camera_calibration
14 cie552 camera_calibration14 cie552 camera_calibration
14 cie552 camera_calibration
 
12 cie552 object_recognition
12 cie552 object_recognition12 cie552 object_recognition
12 cie552 object_recognition
 
11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift
 
10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner
 
09 cie552 image_featuresi
09 cie552 image_featuresi09 cie552 image_featuresi
09 cie552 image_featuresi
 
08 cie552 image_segmentation
08 cie552 image_segmentation08 cie552 image_segmentation
08 cie552 image_segmentation
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulation
 
05 cie552 image_enhancement
05 cie552 image_enhancement05 cie552 image_enhancement
05 cie552 image_enhancement
 
04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency
 
02 cie552 image_andcamera
02 cie552 image_andcamera02 cie552 image_andcamera
02 cie552 image_andcamera
 
01 cie552 introduction
01 cie552 introduction01 cie552 introduction
01 cie552 introduction
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selection
 
Csci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiCsci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iii
 
Csci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeCsci101 lect09 vectorized_code
Csci101 lect09 vectorized_code
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programs
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_ii
 
Csci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingCsci101 lect06 advanced_looping
Csci101 lect06 advanced_looping
 
Csci101 lect05 formatted_output
Csci101 lect05 formatted_outputCsci101 lect05 formatted_output
Csci101 lect05 formatted_output
 
Csci101 lect03 algorithms_i
Csci101 lect03 algorithms_iCsci101 lect03 algorithms_i
Csci101 lect03 algorithms_i
 

Último

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 

Último (20)

THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 

Image filtering techniques

  • 2. Overview • Convolution and Correlation • Box Filter and Gaussian Filter • Template Matching and CNN
  • 3. Convolution • Convolution of two functions is defined as – In the discrete case is: ( )* ( ) ( ) ( )f x h x f h x d       [ ]* [ ] [ ] [ ] m f n h n f m h n m    
  • 5. • In the 2D discrete case Convolution is defined as: is called a linear filter1 2[ , ]h n n Convolution – 2D
  • 6. Image filtering• Image filtering: – Compute function of local neighborhood at each position ],[],[],[ , lnkmIlkfnmh lk   I=imagef=filterh=output 2d coords=m,n2d coords=k,l [ ] [ ] [ ]
  • 7. Correlation and Convolution • 2d correlation ],[],[],[ , lnkmIlkfnmh lk   James Hays e.g., h = scipy.signal.correlate2d(f,I)
  • 8. Correlation and Convolution • 2d correlation • 2d convolution ],[],[],[ , lnkmIlkfnmh lk   ],[],[],[ , lnkmIlkfnmh lk   Convolution is the same as correlation with a 180° rotated filter kernel. Correlation and convolution are identical when the filter kernel is symmetric James Hays e.g., h = scipy.signal.correlate2d(f,I) e.g., h = scipy.signal.convolve2d(f,I)
  • 9. – Step1: filter image f f x h Image Filtering
  • 10. – Step2: filter image f x hf Image Filtering
  • 11. – Step3: filter image f x hf Image Filtering
  • 12. – Step4: filter image f x hf Image Filtering
  • 13. – Step5: filter image f x hf etc. . . . . Image Filtering
  • 14. Image filtering • Image filtering: – Compute function of local neighborhood at each position • Really important! – Enhance images • Denoise, resize, increase contrast, etc. – Extract information from images • Texture, edges, distinctive points, etc. – Detect patterns • Template matching ],[],[],[ , lnkmIlkfnmh lk   James Hays
  • 15. What does it do? • Replaces each pixel with an average of its neighborhood • Achieve smoothing effect (remove sharp features) 111 111 111 ],[g  Box Filter 15
  • 16. 1 1 1 1 1 1 1 9 1 1 1          * =
  • 17. Smoothing with box filter 17
  • 18. Practice with linear filters 000 010 000 Original ? 18
  • 19. Practice with linear filters 000 010 000 Original Filtered (no change) 19
  • 20. Practice with linear filters 000 100 000 Original ? 20
  • 21. Practice with linear filters 000 100 000 Original Shifted left By 1 pixel 21
  • 22. Practice with linear filters Original 111 111 111 000 020 000 - ? 22
  • 23. Practice with linear filters Original 111 111 111 000 020 000 - Sharpening filter - Accentuates differences with local average 23
  • 27. • Spatially-weighted average 0.003 0.013 0.022 0.013 0.003 0.013 0.059 0.097 0.059 0.013 0.022 0.097 0.159 0.097 0.022 0.013 0.059 0.097 0.059 0.013 0.003 0.013 0.022 0.013 0.003 5 x 5,  = 1 Slide credit: Christopher Rasmussen Important filter: Gaussian 27
  • 29. Smoothing with box filter 29
  • 30. Gaussian vs. mean filters What does real blur look like?
  • 31. Gaussian filters • What parameters matter here? • Variance of Gaussian: determines extent of smoothing Source: K. Grauman 31
  • 32. Smoothing with a Gaussian … Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing. Source: K. Grauman 32
  • 33. Gaussian filters • Remove “high-frequency” components from the image (low-pass filter) – Images become more smooth • Gaussian convolved with Gaussian… …is another Gaussian – So can smooth with small-width kernel, repeat, and get same result as larger-width kernel would have – Convolving two times with Gaussian kernel of width σ is same as convolving once with kernel of width σ √2 • Separable kernel – Factors into product of two 1D Gaussians Source: K. Grauman
  • 34. Separability of the Gaussian filter Source: D. Lowe
  • 35. Separability example * * = = 2D convolution (center location only) Source: K. Grauman The filter factors into a product of 1D filters: Perform convolution along rows: Followed by convolution along the remaining column: =
  • 36. Separable filters * = Compute Gaussian in horizontal direction, followed by the vertical direction. Not all filters are separable. Freeman and Adelson, 1991 Much faster!
  • 37. Separability Why is separability useful in practice? MxN image, PxQ filter • 2D convolution: ~MNPQ multiply-adds • Separable 2D: ~MN(P+Q) multiply-adds Speed up = PQ/(P+Q) 9x9 filter = ~4.5x faster
  • 38. Practical matters • How big should the filter be? • Values at edges should be near zero • Gaussians have infinite extent… • Rule of thumb for Gaussian: set filter half- width to about 3 σ James Hays
  • 39. Practical matters • What about near the edge? – the filter window falls off the edge of the image – need to extrapolate – methods: • clip filter (black) • wrap around • copy edge • reflect across edge Source: S. Marschner
  • 40. mode=‘full’ (Default; pad with zeros) mode=‘same’ (Return same size as D) mode=‘valid’ (No padding) Practical matters I = correlate2d( D, f, ‘same’ ) I = convolve2d( D, f, ‘same’ ) # Normalize for visualization >> I_norm = (I – np.min(I)) / (np.max(I) – np.min(I)) >> plt.imshow( I_norm )
  • 41. Convolution in Convolutional Neural Networks • Convolution is the basic operation in CNNs • Learning convolution kernels allows us to learn which `features’ provide useful information in images.
  • 42. Input Image Feature Map . . . Convolution (Filtering) Example Source: Rob Fergus, “Deep Learning & Feature Learning Methods for Vision” , CVPR 2012 Tutorial Filters
  • 43. >> f = D[ 57:117, 107:167 ] Expect response ‘peak’ in middle of I >> I = correlate2d( D, f, ‘same’ ) f 61 x 61 D (275 x 175 pixels) I Response peak Hmm… That didn’t work – why not? + Correct location [Thanks to Robert Collins @ Penn State] Template Matching
  • 44. Correlation ],[],[],[ , lnkmIlkfnmh lk   e.g., h = scipy.signal.correlate2d(f,I) As brightness in I increases, the response in h will increase, as long as f is positive. Overall brighter regions will give higher correlation response -> not useful!
  • 45. OK, so let’s subtract the mean >> f = D[ 57:117, 107:167 ] >> f2 = f – np.mean(f) >> D2 = D – np.mean(D) Now zero centered. Score is higher only when dark parts match and when light parts match. >> I2 = correlate2d( D2, f2, ‘same’ ) f2 61 x 61 D2 (275 x 175 pixels) I2
  • 46. Or even >> I3 = correlate2d( D2, f2, ‘full’ ) I3 D2 (275 x 175 pixels)
  • 47. What happens with convolution? >> f = D[ 57:117, 107:167 ] >> f2 = f – np.mean(f) >> D2 = D – np.mean(D) >> I2 = convolve2d( D2, f2, ‘same’ ) f2 61 x 61 D2 (275 x 175 pixels) I2
  • 48. Summary • Convolution and Correlation • Box Filter and Gaussian Filter • Template Matching and CNN