the frequency domain, without tearscs194-26/fa16/lectures/freqdomain... · image compression using...
TRANSCRIPT
![Page 1: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/1.jpg)
The Frequency Domain, without tears
Somewhere in Cinque Terre, May 2005
Many slides borrowed from Steve Seitz
CS194: Image Manipulation & Computational Photography Alexei Efros, UC Berkeley, Fall 2016
![Page 2: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/2.jpg)
Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976
![Page 3: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/3.jpg)
![Page 4: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/4.jpg)
![Page 5: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/5.jpg)
A nice set of basis
This change of basis has a special name…
Teases away fast vs. slow changes in the image.
![Page 6: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/6.jpg)
Jean Baptiste Joseph Fourier (1768-1830) had crazy idea (1807): Any univariate function can
be rewritten as a weighted sum of sines and cosines of different frequencies.
Don’t believe it? • Neither did Lagrange,
Laplace, Poisson and other big wigs
• Not translated into English until 1878!
But it’s (mostly) true! • called Fourier Series
...the manner in which the author arrives at these equations is not exempt of difficulties and...his
analysis to integrate them still leaves something to be desired on the score of generality and even
rigour.
Laplace
Lagrange Legendre
![Page 7: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/7.jpg)
A sum of sines Our building block: Add enough of them to get any signal f(x) you want! How many degrees of freedom? What does each control? Which one encodes the coarse vs. fine structure of the signal?
)+φωxAsin(
![Page 8: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/8.jpg)
Fourier Transform We want to understand the frequency ω of our signal. So, let’s reparametrize the signal by ω instead of x:
)+φωxAsin(
f(x) F(ω) Fourier Transform
F(ω) f(x) Inverse Fourier Transform
For every ω from 0 to inf, F(ω) holds the amplitude A and phase φ of the corresponding sine
• How can F hold both?
)()()( ωωω iIRF +=22 )()( ωω IRA +±=
)()(tan 1
ωωφ
RI−=
We can always go back:
![Page 9: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/9.jpg)
Time and Frequency example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
![Page 10: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/10.jpg)
Time and Frequency example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
= +
![Page 11: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/11.jpg)
Frequency Spectra example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
= +
![Page 12: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/12.jpg)
Frequency Spectra Usually, frequency is more interesting than the phase
![Page 13: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/13.jpg)
= +
=
Frequency Spectra
![Page 14: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/14.jpg)
= +
=
Frequency Spectra
![Page 15: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/15.jpg)
= +
=
Frequency Spectra
![Page 16: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/16.jpg)
= +
=
Frequency Spectra
![Page 17: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/17.jpg)
= +
=
Frequency Spectra
![Page 18: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/18.jpg)
= 1
1 sin(2 )k
A ktk
π∞
=∑
Frequency Spectra
![Page 19: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/19.jpg)
Frequency Spectra
![Page 20: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/20.jpg)
FT: Just a change of basis
.
.
.
* =
M * f(x) = F(ω)
![Page 21: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/21.jpg)
IFT: Just a change of basis
.
.
.
* =
M-1 * F(ω) = f(x)
![Page 22: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/22.jpg)
Finally: Scary Math
![Page 23: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/23.jpg)
Finally: Scary Math
…not really scary: is hiding our old friend: So it’s just our signal f(x) times sine at frequency ω
)sin()cos( xixe xi ωωω +=
= +±=
)+=+
−
QPQPΑ
xAxQxP
122 tan
sin()sin()cos(
φ
φ
)+φωxsin(phase can be encoded
by sin/cos pair
![Page 24: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/24.jpg)
Extension to 2D
Image as a sum of basis images
=
![Page 25: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/25.jpg)
Extension to 2D
in Matlab, check out: imagesc(log(abs(fftshift(fft2(im)))));
![Page 26: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/26.jpg)
Fourier analysis in images
Intensity Image
Fourier Image
http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering
![Page 27: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/27.jpg)
Signals can be composed
+ =
http://sharp.bu.edu/~slehar/fourier/fourier.html#filtering More: http://www.cs.unm.edu/~brayer/vision/fourier.html
![Page 28: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/28.jpg)
Man-made Scene
![Page 29: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/29.jpg)
Can change spectrum, then reconstruct
Local change in one domain, courses global change in the other
![Page 30: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/30.jpg)
Low and High Pass filtering
![Page 31: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/31.jpg)
The Convolution Theorem The greatest thing since sliced (banana) bread!
• The Fourier transform of the convolution of two functions is the product of their Fourier transforms
• The inverse Fourier transform of the product of two Fourier transforms is the convolution of the two inverse Fourier transforms
• Convolution in spatial domain is equivalent to multiplication in frequency domain!
]F[]F[]F[ hghg =∗
][F][F][F 111 hggh −−− ∗=
![Page 32: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/32.jpg)
2D convolution theorem example
*
f(x,y)
h(x,y)
g(x,y)
|F(sx,sy)|
|H(sx,sy)|
|G(sx,sy)|
![Page 33: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/33.jpg)
Why does the Gaussian give a nice smooth image, but the square filter give edgy artifacts?
Gaussian Box filter
Filtering
![Page 34: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/34.jpg)
Fourier Transform pairs
![Page 35: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/35.jpg)
Gaussian
![Page 36: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/36.jpg)
Box Filter
![Page 37: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/37.jpg)
Low-pass, Band-pass, High-pass filters low-pass:
High-pass / band-pass:
![Page 38: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/38.jpg)
Edges in images
![Page 39: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/39.jpg)
What does blurring take away?
original
![Page 40: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/40.jpg)
What does blurring take away?
smoothed (5x5 Gaussian)
![Page 41: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/41.jpg)
High-Pass filter
smoothed – original
![Page 42: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/42.jpg)
Image “Sharpening” What does blurring take away?
original smoothed (5x5)
–
detail
=
sharpened
=
Let’s add it back:
original detail
+ α
![Page 43: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/43.jpg)
Unsharp mask filter
Gaussian unit impulse
Laplacian of Gaussian
))1(()1()( gefgffgfff ααααα −+∗=∗−+=∗−+
image blurred image
unit impulse (identity)
![Page 44: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/44.jpg)
Hybrid Images Gaussian Filter!
Laplacian Filter!
A. Oliva, A. Torralba, P.G. Schyns, “Hybrid Images,” SIGGRAPH 2006
Gaussian unit impulse Laplacian of Gaussian
![Page 45: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/45.jpg)
Salvador Dali “Gala Contemplating the Mediterranean Sea, which at 30 meters becomes the portrait of Abraham Lincoln”, 1976
![Page 46: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/46.jpg)
Band-pass filtering
Laplacian Pyramid (subband images) Created from Gaussian pyramid by subtraction
Gaussian Pyramid (low-pass images)
![Page 47: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/47.jpg)
Laplacian Pyramid
How can we reconstruct (collapse) this pyramid into the original image?
Need this!
Original image
![Page 48: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/48.jpg)
Blending
![Page 49: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/49.jpg)
Alpha Blending / Feathering
0 1
0 1
+
= Iblend = αIleft + (1-α)Iright
![Page 50: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/50.jpg)
Affect of Window Size
0
1 left
right 0
1
![Page 51: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/51.jpg)
Affect of Window Size
0
1
0
1
![Page 52: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/52.jpg)
Good Window Size
0
1
“Optimal” Window: smooth but not ghosted
![Page 53: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/53.jpg)
What is the Optimal Window? To avoid seams
• window = size of largest prominent feature
To avoid ghosting • window <= 2*size of smallest prominent feature
Natural to cast this in the Fourier domain • largest frequency <= 2*size of smallest frequency • image frequency content should occupy one “octave” (power of two)
FFT
![Page 54: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/54.jpg)
What if the Frequency Spread is Wide
Idea (Burt and Adelson) • Compute Fleft = FFT(Ileft), Fright = FFT(Iright) • Decompose Fourier image into octaves (bands)
– Fleft = Fleft1 + Fleft
2 + … • Feather corresponding octaves Fleft
i with Frighti
– Can compute inverse FFT and feather in spatial domain • Sum feathered octave images in frequency domain
Better implemented in spatial domain
FFT
![Page 55: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/55.jpg)
Octaves in the Spatial Domain
Bandpass Images
Lowpass Images
![Page 56: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/56.jpg)
Pyramid Blending
0
1
0
1
0
1
Left pyramid Right pyramid blend
![Page 57: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/57.jpg)
Pyramid Blending
![Page 58: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/58.jpg)
laplacian level
4
laplacian level
2
laplacian level
0
left pyramid right pyramid blended pyramid
![Page 59: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/59.jpg)
Blending Regions
![Page 60: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/60.jpg)
Laplacian Pyramid: Blending General Approach:
1. Build Laplacian pyramids LA and LB from images A and B 2. Build a Gaussian pyramid GR from selected region R 3. Form a combined pyramid LS from LA and LB using nodes
of GR as weights: • LS(i,j) = GR(I,j,)*LA(I,j) + (1-GR(I,j))*LB(I,j)
4. Collapse the LS pyramid to get the final blended image
![Page 61: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/61.jpg)
Horror Photo
© david dmartin (Boston College)
![Page 62: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/62.jpg)
Results from this class (fall 2005)
© Chris Cameron
![Page 63: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/63.jpg)
Simplification: Two-band Blending Brown & Lowe, 2003
• Only use two bands: high freq. and low freq. • Blends low freq. smoothly • Blend high freq. with no smoothing: use binary alpha
![Page 64: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/64.jpg)
Low frequency (λ > 2 pixels)
High frequency (λ < 2 pixels)
2-band “Laplacian Stack” Blending
![Page 65: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/65.jpg)
Linear Blending
![Page 66: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/66.jpg)
2-band Blending
![Page 67: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/67.jpg)
Da Vinci and Peripheral Vision
https://en.wikipedia.org/wiki/Speculations_about_Mona_Lisa#Smile
![Page 68: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/68.jpg)
Leonardo playing with peripheral vision
Livingstone, Vision and Art: The Biology of Seeing
![Page 69: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/69.jpg)
Early processing in humans filters for various orientations and scales of frequency
Perceptual cues in the mid frequencies dominate perception When we see an image from far away, we are effectively subsampling
it
Early Visual Processing: Multi-scale edge and blob filters
Clues from Human Perception
![Page 70: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/70.jpg)
Frequency Domain and Perception
Campbell-Robson contrast sensitivity curve
![Page 71: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/71.jpg)
Freq. Perception Depends on Color
R G B
![Page 72: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/72.jpg)
Lossy Image Compression (JPEG)
Block-based Discrete Cosine Transform (DCT)
![Page 73: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/73.jpg)
Using DCT in JPEG The first coefficient B(0,0) is the DC component,
the average intensity The top-left coeffs represent low frequencies,
the bottom right – high frequencies
![Page 74: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/74.jpg)
Image compression using DCT Quantize
• More coarsely for high frequencies (which also tend to have smaller values)
• Many quantized high frequency values will be zero
Encode • Can decode with inverse dct
Quantization table
Filter responses
Quantized values
![Page 75: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/75.jpg)
JPEG Compression Summary Subsample color by factor of 2
• People have bad resolution for color
Split into blocks (8x8, typically), subtract 128 For each block
a. Compute DCT coefficients b. Coarsely quantize
– Many high frequency components will become zero
c. Encode (e.g., with Huffman coding)
http://en.wikipedia.org/wiki/YCbCr http://en.wikipedia.org/wiki/JPEG
![Page 76: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/76.jpg)
Block size in JPEG Block size
• small block – faster – correlation exists between neighboring pixels
• large block – better compression in smooth regions
• It’s 8x8 in standard JPEG
![Page 77: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/77.jpg)
JPEG compression comparison
89k 12k
![Page 78: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/78.jpg)
Denoising
Additive Gaussian Noise
Gaussian Filter
![Page 79: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/79.jpg)
Smoothing with larger standard deviations suppresses noise, but also blurs the image
Reducing Gaussian noise
Source: S. Lazebnik
![Page 80: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/80.jpg)
Reducing salt-and-pepper noise by Gaussian smoothing
3x3 5x5 7x7
![Page 81: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/81.jpg)
Alternative idea: Median filtering A median filter operates over a window by
selecting the median intensity in the window
• Is median filtering linear? Source: K. Grauman
![Page 82: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/82.jpg)
Median filter What advantage does median filtering
have over Gaussian filtering? • Robustness to outliers
Source: K. Grauman
![Page 83: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/83.jpg)
Median filter Salt-and-pepper
noise Median filtered
Source: M. Hebert
MATLAB: medfilt2(image, [h w])
![Page 84: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/84.jpg)
Median vs. Gaussian filtering 3x3 5x5 7x7
Gaussian
Median
![Page 85: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/85.jpg)
![Page 86: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/86.jpg)
EXTRA SLIDES
![Page 87: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/87.jpg)
A Gentle Introduction to Bilateral Filtering and its Applications
“Fixing the Gaussian Blur”: the Bilateral Filter
Sylvain Paris – MIT CSAIL
![Page 88: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/88.jpg)
Blur Comes from Averaging across Edges
*
*
*
input output
Same Gaussian kernel everywhere.
![Page 89: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/89.jpg)
Bilateral Filter No Averaging across Edges
*
*
*
input output
The kernel shape depends on the image content.
[Aurich 95, Smith 97, Tomasi 98]
![Page 90: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/90.jpg)
space weight
not new
range weight
I
new
normalization factor
new
Bilateral Filter Definition: an Additional Edge Term
( ) ( )∑∈
−−=S
IIIGGW
IBFq
qqpp
p qp ||||||1][rs σσ
Same idea: weighted average of pixels.
![Page 91: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/91.jpg)
Illustration a 1D Image
• 1D image = line of pixels
• Better visualized as a plot
pixel intensity
pixel position
![Page 92: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/92.jpg)
space
Gaussian Blur and Bilateral Filter
space range normalization
Gaussian blur
( ) ( )∑∈
−−=S
IIIGGW
IBFq
qqpp
p qp ||||||1][rs σσ
Bilateral filter [Aurich 95, Smith 97, Tomasi 98]
space
space range
p
p
q
q
( )∑∈
−=S
IGIGBq
qp qp ||||][ σ
![Page 93: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/93.jpg)
q
This image cannot currently be displayed.
Bilateral Filter on a Height Field
output input
( ) ( )∑∈
−−=S
IIIGGW
IBFq
qqpp
p qp ||||||1][rs σσ
p
reproduced from [Durand 02]
![Page 94: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/94.jpg)
Space and Range Parameters
• space σs : spatial extent of the kernel, size of the considered neighborhood.
• range σr : “minimum” amplitude of an edge
( ) ( )∑∈
−−=S
IIIGGW
IBFq
qqpp
p qp ||||||1][rs σσ
![Page 95: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/95.jpg)
Influence of Pixels
p
Only pixels close in space and in range are considered.
space
range
![Page 96: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/96.jpg)
σs = 2
σs = 6
σs = 18
σr = 0.1 σr = 0.25 σr = ∞
(Gaussian blur)
input
Exploring the Parameter Space
![Page 97: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/97.jpg)
σs = 2
σs = 6
σs = 18
σr = 0.1 σr = 0.25 σr = ∞
(Gaussian blur)
input
Varying the Range Parameter
![Page 98: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/98.jpg)
input
![Page 99: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/99.jpg)
σr = 0.1
![Page 100: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/100.jpg)
σr = 0.25
![Page 101: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/101.jpg)
σr = ∞ (Gaussian blur)
![Page 102: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/102.jpg)
σs = 2
σs = 6
σs = 18
σr = 0.1 σr = 0.25 σr = ∞
(Gaussian blur)
input
Varying the Space Parameter
![Page 103: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/103.jpg)
input
![Page 104: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/104.jpg)
σs = 2
![Page 105: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/105.jpg)
σs = 6
![Page 106: The Frequency Domain, without tearscs194-26/fa16/Lectures/FreqDomain... · Image compression using DCT. Quantize • More coarsely for high frequencies (which also tend to have smaller](https://reader034.vdocuments.site/reader034/viewer/2022051923/6010d95d398d7e06d55ff089/html5/thumbnails/106.jpg)
σs = 18