SlideShare a Scribd company logo
1 of 43
Detour: Time complexity of convolution
β€’ Image is w x h
β€’ Filter is k x k
β€’ Every entry takes O(k2) operations
β€’ Number of output entries:
β€’ (w+k-1)(h+k-1) for full
β€’ wh for same
β€’ Total time complexity:
β€’ O(whk2)
Optimization: separable filters
β€’ basic alg. is O(r2): large filters get expensive fast!
β€’ definition: w(x,y) is separable if it can be written as:
β€’ Write u as a k x 1 filter, and v as a 1 x k filter
β€’ Claim:
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1 u2v2
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1 u2v2 u2v3
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1 u2v2 u2v3
u3v1
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1 u2v2 u2v3
u3v1 u3v2
Separable filters
u1
u2
u3
v1 v2 v3
*
u1
u2
u3
u3
u2
u1
u1v1 u1v2 u1v3
u2v1 u2v2 u2v3
u3v1 u3v2 u3v3
w
Separable filters
β€’ Time complexity of original : O(whk2)
β€’ Time complexity of separable version : O(whk)
Image resizing
Why do we need to talk about resizing?
β€’ Need to zoom in to a
region to get more details
β€’ Can we get more details?
Louis Daguerre, 1838
Why do we need to talk about resizing?
β€’ Far away objects appear
small, nearby objects appear
larger
β€’ Need to recognize objects at
multiple scales
β€’ Resizing images to same size
helps recognition
Why is resizing hard?
β€’ E.g, consider reducing size by a factor of 2
β€’ Simple solution: subsampling
β€’ Example: subsampling by a factor of 2
Why is resizing hard?
β€’ Dropping pixels causes problems
Aliasing in time
Aliasing in time
Why does aliasing happen?
β€’ We ”miss” things between samples
β€’ High frequency signals might appear as low frequency signals
β€’ Called β€œaliasing”
Β© Kavita Bala, Computer Science, Cornell University
Let’s look at it mathematically
β€’ Fourier basis signals
β€’ π΅π‘˜ 𝑛 = 𝑒
𝑖2πœ‹π‘˜π‘›
𝑁 , time period N/k, frequency k/N
β€’ Suppose we sample every P pixels. Then we are only looking at the
values
β€’ π΅π‘˜ 𝑃 , π΅π‘˜ 2𝑃 , … , π΅π‘˜ 𝑛𝑃 , …
β€’ Consider two basis vectors π΅π‘˜ and π΅π‘˜+𝑁/𝑃
β€’ π΅π‘˜+𝑁/𝑃 𝑛𝑃 = 𝑒
𝑖2πœ‹ π‘˜+
𝑁
𝑃 𝑃𝑛
𝑁 = 𝑒
𝑖2πœ‹π‘˜π‘ƒπ‘›
𝑇
+𝑖2πœ‹π‘›(
𝑁
𝑃
)(
𝑃
𝑁
)
= 𝑒
𝑖2πœ‹π‘˜π‘ƒπ‘›
𝑇
+𝑖2πœ‹π‘›
= 𝑒
𝑖2πœ‹π‘˜π‘ƒπ‘›
𝑁 = π΅π‘˜(𝑛𝑃)
Let’s look at it mathematically
β€’ π΅π‘˜ 𝑛𝑃 = π΅π‘˜+
𝑁
𝑃
𝑛𝑃
β€’ The two basis vectors look identical if we sample every P pixels
β€’ Our eyes see the lower frequency: aliasing
β€’ How do we avoid aliasing?
β€’ Remove high frequencies that may be aliased
β€’ Sample at a high enough rate (lower P)
Avoiding aliasing
β€’ Suppose image has limited high frequency components
β€’ Fourier transform of x is X
β€’ Suppose X is non-zero only for βˆ’π‘˜π‘šπ‘Žπ‘₯ to π‘˜π‘šπ‘Žπ‘₯
0 N/2
-N/2 -kmax kmax
Avoiding aliasing
β€’ When sampling once every P pixels, βˆ’π‘˜π‘šπ‘Žπ‘₯ is indistinguishable from
βˆ’ π‘˜π‘šπ‘Žπ‘₯ + 𝑁/𝑃
β€’ If image has both coefficients, they will get mixed
β€’ So we want that π‘˜π‘šπ‘Žπ‘₯ < βˆ’π‘˜π‘šπ‘Žπ‘₯ +
𝑁
𝑃
β‡’ 2π‘˜π‘šπ‘Žπ‘₯ <
𝑁
𝑃
0 N/2
-N/2 -kmax kmax
-kmax+N/P
Nyquist Sampling Theorem
β€’ 2π‘˜π‘šπ‘Žπ‘₯ <
𝑁
𝑃
β€’ Basis π΅π‘˜ has a time period of
𝑁
π‘˜
or frequency of
π‘˜
𝑁
β€’
2π‘˜π‘šπ‘Žπ‘₯ <
𝑁
𝑃
β‡’
2π‘˜π‘šπ‘Žπ‘₯
𝑁
<
1
P
β‡’ 2πœˆπ‘šπ‘Žπ‘₯ < πœˆπ‘ π‘Žπ‘šπ‘π‘™π‘’
β€’ Need to sample at at least twice the rate of the highest frequency
component
Subsampling the image
β€’ First smooth the image to remove
high frequency components
β€’ How should we smooth?
β€’ One simple answer: blur with
Gaussian
β€’ Recall that Fourier transform of
Gaussian is Gaussian
β€’ Choose sigma so that frequencies
above
πœˆπ‘ π‘Žπ‘šπ‘π‘™π‘’
2
get killed
Subsampling before and after smoothing
Before After
Image sub-sampling
1/4 (2x zoom) 1/16 (4x zoom)
Why does this look so crufty? Aliasing!
1/2
Source: S. Seitz
Subsampling images correctly
G 1/4
G 1/8
Gaussian 1/2
β€’ Solution: filter the image, then subsample
Source: S. Seitz
Subsampling with Gaussian pre-filtering
G 1/4 G 1/8
Gaussian 1/2
β€’ Solution: filter the image, then subsample
Source: S. Seitz
Compare with...
1/4 (2x zoom) 1/8 (4x zoom)
1/2
Source: S. Seitz
Low-pass filtering
β€’ Convolving with a Gaussian = remove high frequencies
β€’ β€œLow-pass” filtering: low frequencies β€œpass” through filter, high
frequencies don’t
β€’ Identity – Low-pass filtered image = β€œHigh-pass filtering”
Gaussian
pre-filtering
β€’ Solution: filter
the image, then
subsample
blur
F0 H
*
subsample blur subsample …
F1
F1 H
*
F2
F0
blur
F0 H
*
subsample blur subsample …
F1
F1 H
*
F2
F0
Gaussian
pyramid
Gaussian pyramids
[Burt and Adelson, 1983]
β€’ In computer graphics, a mip map [Williams, 1983]
Gaussian Pyramids have all sorts of applications in computer vision
Source: S. Seitz
Gaussian pyramids - Searching over scales
Gaussian pyramids - Searching over scales
2
)
*
( 2
3 ο‚―
ο€½ gaussian
G
G
1
G
The Gaussian Pyramid
High resolution
Low resolution
Image
ο€½
0
G
2
)
*
( 0
1 ο‚―
ο€½ gaussian
G
G
2
)
*
( 1
2 ο‚―
ο€½ gaussian
G
G
2
)
*
( 3
4 ο‚―
ο€½ gaussian
G
G
blur
blur
blur
blur
Gaussian pyramid and stack
Source: Forsyth
Memory Usage
β€’ What is the size of the pyramid?
4
3

More Related Content

Similar to lec06-resampling2.pptx

Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford MapR Technologies
Β 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersAly Abdelkareem
Β 
Lecture1
Lecture1Lecture1
Lecture1tarikh007
Β 
Balls and-bins model app
Balls and-bins model appBalls and-bins model app
Balls and-bins model appdeawoo Kim
Β 
Compressed learning for time series classification
Compressed learning for time series classificationCompressed learning for time series classification
Compressed learning for time series classificationε­ΈηΏ° ζ–½
Β 
2007_05_Fischette.pdf
2007_05_Fischette.pdf2007_05_Fischette.pdf
2007_05_Fischette.pdfRRaja Einstein
Β 
november29.ppt
november29.pptnovember29.ppt
november29.pptCharlesMatu2
Β 
Analysis of local affine model v2
Analysis of  local affine model v2Analysis of  local affine model v2
Analysis of local affine model v2cindy071434
Β 
Analysis of local affine model v2
Analysis of  local affine model v2Analysis of  local affine model v2
Analysis of local affine model v2cindy071434
Β 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenBenjamin Glatzel
Β 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012Ted Dunning
Β 
Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28Ted Dunning
Β 
Slide Handouts with Notes
Slide Handouts with NotesSlide Handouts with Notes
Slide Handouts with NotesLeon Nguyen
Β 
GoshawkDB: Making Time with Vector Clocks
GoshawkDB: Making Time with Vector ClocksGoshawkDB: Making Time with Vector Clocks
GoshawkDB: Making Time with Vector ClocksC4Media
Β 
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural NetworksPaper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural NetworksChenYiHuang5
Β 
Max flows via electrical flows (long talk)
Max flows via electrical flows (long talk)Max flows via electrical flows (long talk)
Max flows via electrical flows (long talk)Thatchaphol Saranurak
Β 

Similar to lec06-resampling2.pptx (20)

Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
Β 
Digital Image Processing - Frequency Filters
Digital Image Processing - Frequency FiltersDigital Image Processing - Frequency Filters
Digital Image Processing - Frequency Filters
Β 
Lecture1
Lecture1Lecture1
Lecture1
Β 
Balls and-bins model app
Balls and-bins model appBalls and-bins model app
Balls and-bins model app
Β 
Compressed learning for time series classification
Compressed learning for time series classificationCompressed learning for time series classification
Compressed learning for time series classification
Β 
2007_05_Fischette.pdf
2007_05_Fischette.pdf2007_05_Fischette.pdf
2007_05_Fischette.pdf
Β 
november29.ppt
november29.pptnovember29.ppt
november29.ppt
Β 
Analysis of local affine model v2
Analysis of  local affine model v2Analysis of  local affine model v2
Analysis of local affine model v2
Β 
Analysis of local affine model v2
Analysis of  local affine model v2Analysis of  local affine model v2
Analysis of local affine model v2
Β 
PS
PSPS
PS
Β 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
Β 
sampling-alising.pdf
sampling-alising.pdfsampling-alising.pdf
sampling-alising.pdf
Β 
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012
Β 
Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28Paris data-geeks-2013-03-28
Paris data-geeks-2013-03-28
Β 
PPT s04-machine vision-s2
PPT s04-machine vision-s2PPT s04-machine vision-s2
PPT s04-machine vision-s2
Β 
LaplacianPyramids which is a image processing to extract the information
LaplacianPyramids which is a image processing to extract the informationLaplacianPyramids which is a image processing to extract the information
LaplacianPyramids which is a image processing to extract the information
Β 
Slide Handouts with Notes
Slide Handouts with NotesSlide Handouts with Notes
Slide Handouts with Notes
Β 
GoshawkDB: Making Time with Vector Clocks
GoshawkDB: Making Time with Vector ClocksGoshawkDB: Making Time with Vector Clocks
GoshawkDB: Making Time with Vector Clocks
Β 
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural NetworksPaper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Paper Study: OptNet: Differentiable Optimization as a Layer in Neural Networks
Β 
Max flows via electrical flows (long talk)
Max flows via electrical flows (long talk)Max flows via electrical flows (long talk)
Max flows via electrical flows (long talk)
Β 

Recently uploaded

Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
Β 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
Β 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)Dr. Mazin Mohamed alkathiri
Β 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
Β 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
Β 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
Β 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
Β 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
Β 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
Β 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
Β 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
Β 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
Β 
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
Β 

Recently uploaded (20)

Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
Β 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
Β 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
Β 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
Β 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
Β 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
Β 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
Β 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
Β 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
Β 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Β 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Β 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
Β 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Β 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
Β 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
Β 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
Β 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
Β 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
Β 
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
Β 

lec06-resampling2.pptx

  • 1.
  • 2. Detour: Time complexity of convolution β€’ Image is w x h β€’ Filter is k x k β€’ Every entry takes O(k2) operations β€’ Number of output entries: β€’ (w+k-1)(h+k-1) for full β€’ wh for same β€’ Total time complexity: β€’ O(whk2)
  • 3. Optimization: separable filters β€’ basic alg. is O(r2): large filters get expensive fast! β€’ definition: w(x,y) is separable if it can be written as: β€’ Write u as a k x 1 filter, and v as a 1 x k filter β€’ Claim:
  • 4. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1
  • 5. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2
  • 6. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3
  • 7. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1
  • 8. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1 u2v2
  • 9. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1 u2v2 u2v3
  • 10. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1 u2v2 u2v3 u3v1
  • 11. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1 u2v2 u2v3 u3v1 u3v2
  • 12. Separable filters u1 u2 u3 v1 v2 v3 * u1 u2 u3 u3 u2 u1 u1v1 u1v2 u1v3 u2v1 u2v2 u2v3 u3v1 u3v2 u3v3 w
  • 13. Separable filters β€’ Time complexity of original : O(whk2) β€’ Time complexity of separable version : O(whk)
  • 15. Why do we need to talk about resizing? β€’ Need to zoom in to a region to get more details β€’ Can we get more details? Louis Daguerre, 1838
  • 16. Why do we need to talk about resizing? β€’ Far away objects appear small, nearby objects appear larger β€’ Need to recognize objects at multiple scales β€’ Resizing images to same size helps recognition
  • 17. Why is resizing hard? β€’ E.g, consider reducing size by a factor of 2 β€’ Simple solution: subsampling β€’ Example: subsampling by a factor of 2
  • 18. Why is resizing hard? β€’ Dropping pixels causes problems
  • 19.
  • 20.
  • 23. Why does aliasing happen? β€’ We ”miss” things between samples β€’ High frequency signals might appear as low frequency signals β€’ Called β€œaliasing” Β© Kavita Bala, Computer Science, Cornell University
  • 24. Let’s look at it mathematically β€’ Fourier basis signals β€’ π΅π‘˜ 𝑛 = 𝑒 𝑖2πœ‹π‘˜π‘› 𝑁 , time period N/k, frequency k/N β€’ Suppose we sample every P pixels. Then we are only looking at the values β€’ π΅π‘˜ 𝑃 , π΅π‘˜ 2𝑃 , … , π΅π‘˜ 𝑛𝑃 , … β€’ Consider two basis vectors π΅π‘˜ and π΅π‘˜+𝑁/𝑃 β€’ π΅π‘˜+𝑁/𝑃 𝑛𝑃 = 𝑒 𝑖2πœ‹ π‘˜+ 𝑁 𝑃 𝑃𝑛 𝑁 = 𝑒 𝑖2πœ‹π‘˜π‘ƒπ‘› 𝑇 +𝑖2πœ‹π‘›( 𝑁 𝑃 )( 𝑃 𝑁 ) = 𝑒 𝑖2πœ‹π‘˜π‘ƒπ‘› 𝑇 +𝑖2πœ‹π‘› = 𝑒 𝑖2πœ‹π‘˜π‘ƒπ‘› 𝑁 = π΅π‘˜(𝑛𝑃)
  • 25. Let’s look at it mathematically β€’ π΅π‘˜ 𝑛𝑃 = π΅π‘˜+ 𝑁 𝑃 𝑛𝑃 β€’ The two basis vectors look identical if we sample every P pixels β€’ Our eyes see the lower frequency: aliasing β€’ How do we avoid aliasing? β€’ Remove high frequencies that may be aliased β€’ Sample at a high enough rate (lower P)
  • 26. Avoiding aliasing β€’ Suppose image has limited high frequency components β€’ Fourier transform of x is X β€’ Suppose X is non-zero only for βˆ’π‘˜π‘šπ‘Žπ‘₯ to π‘˜π‘šπ‘Žπ‘₯ 0 N/2 -N/2 -kmax kmax
  • 27. Avoiding aliasing β€’ When sampling once every P pixels, βˆ’π‘˜π‘šπ‘Žπ‘₯ is indistinguishable from βˆ’ π‘˜π‘šπ‘Žπ‘₯ + 𝑁/𝑃 β€’ If image has both coefficients, they will get mixed β€’ So we want that π‘˜π‘šπ‘Žπ‘₯ < βˆ’π‘˜π‘šπ‘Žπ‘₯ + 𝑁 𝑃 β‡’ 2π‘˜π‘šπ‘Žπ‘₯ < 𝑁 𝑃 0 N/2 -N/2 -kmax kmax -kmax+N/P
  • 28. Nyquist Sampling Theorem β€’ 2π‘˜π‘šπ‘Žπ‘₯ < 𝑁 𝑃 β€’ Basis π΅π‘˜ has a time period of 𝑁 π‘˜ or frequency of π‘˜ 𝑁 β€’ 2π‘˜π‘šπ‘Žπ‘₯ < 𝑁 𝑃 β‡’ 2π‘˜π‘šπ‘Žπ‘₯ 𝑁 < 1 P β‡’ 2πœˆπ‘šπ‘Žπ‘₯ < πœˆπ‘ π‘Žπ‘šπ‘π‘™π‘’ β€’ Need to sample at at least twice the rate of the highest frequency component
  • 29. Subsampling the image β€’ First smooth the image to remove high frequency components β€’ How should we smooth? β€’ One simple answer: blur with Gaussian β€’ Recall that Fourier transform of Gaussian is Gaussian β€’ Choose sigma so that frequencies above πœˆπ‘ π‘Žπ‘šπ‘π‘™π‘’ 2 get killed
  • 30. Subsampling before and after smoothing Before After
  • 31. Image sub-sampling 1/4 (2x zoom) 1/16 (4x zoom) Why does this look so crufty? Aliasing! 1/2 Source: S. Seitz
  • 32. Subsampling images correctly G 1/4 G 1/8 Gaussian 1/2 β€’ Solution: filter the image, then subsample Source: S. Seitz
  • 33. Subsampling with Gaussian pre-filtering G 1/4 G 1/8 Gaussian 1/2 β€’ Solution: filter the image, then subsample Source: S. Seitz
  • 34. Compare with... 1/4 (2x zoom) 1/8 (4x zoom) 1/2 Source: S. Seitz
  • 35. Low-pass filtering β€’ Convolving with a Gaussian = remove high frequencies β€’ β€œLow-pass” filtering: low frequencies β€œpass” through filter, high frequencies don’t β€’ Identity – Low-pass filtered image = β€œHigh-pass filtering”
  • 36. Gaussian pre-filtering β€’ Solution: filter the image, then subsample blur F0 H * subsample blur subsample … F1 F1 H * F2 F0
  • 37. blur F0 H * subsample blur subsample … F1 F1 H * F2 F0 Gaussian pyramid
  • 38. Gaussian pyramids [Burt and Adelson, 1983] β€’ In computer graphics, a mip map [Williams, 1983] Gaussian Pyramids have all sorts of applications in computer vision Source: S. Seitz
  • 39. Gaussian pyramids - Searching over scales
  • 40. Gaussian pyramids - Searching over scales
  • 41. 2 ) * ( 2 3 ο‚― ο€½ gaussian G G 1 G The Gaussian Pyramid High resolution Low resolution Image ο€½ 0 G 2 ) * ( 0 1 ο‚― ο€½ gaussian G G 2 ) * ( 1 2 ο‚― ο€½ gaussian G G 2 ) * ( 3 4 ο‚― ο€½ gaussian G G blur blur blur blur
  • 42. Gaussian pyramid and stack Source: Forsyth
  • 43. Memory Usage β€’ What is the size of the pyramid? 4 3