Date post: | 17-Jan-2016 |
Category: |
Documents |
Upload: | eustace-sharp |
View: | 214 times |
Download: | 0 times |
Image as a linear combination of basis images
16 235 245 231 28 20 17 1 0 0 11 243 70 253 99 16 12 0 0 0 14 170 60 253 169 16 6 1 0 0 19 87 69 248 188 18 4 0 0 0
21 171 187 226 82 21 13 11 0 0 22 224 250 188 74 29 7 1 0 0 21 235 247 71 97 92 20 3 0 0 29 251 246 76 45 34 14 0 0 0 65 252 246 183 17 4 0 0 0 1 38 71 162 174 8 0 0 0 0 0
= 243 * + 70 * +…
16 235 245 231 28 20 17 1 0 0 11 243 70 253 99 16 12 0 0 0 14 170 60 253 169 16 6 1 0 0 19 87 69 248 188 18 4 0 0 0
21 171 187 226 82 21 13 11 0 0 22 224 250 188 74 29 7 1 0 0 21 235 247 71 97 92 20 3 0 0 29 251 246 76 45 34 14 0 0 0 65 252 246 183 17 4 0 0 0 1 38 71 162 174 8 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Image as a linear combination of basis images
= 243 * + 70 * +…
16 235 245 231 28 20 17 1 0 0 11 243 70 253 99 16 12 0 0 0 14 170 60 253 169 16 6 1 0 0 19 87 69 248 188 18 4 0 0 0
21 171 187 226 82 21 13 11 0 0 22 224 250 188 74 29 7 1 0 0 21 235 247 71 97 92 20 3 0 0 29 251 246 76 45 34 14 0 0 0 65 252 246 183 17 4 0 0 0 1 38 71 162 174 8 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Image as a linear combination of basis images
If we agree on basis, then we only need the coefficients (243,70,…) to describe image
What about other basis images beyond impulse images?
A nice set of basis
This change of basis has a special name…
Teases away fast vs. slow changes in the image.
Jean Baptiste Joseph Fourier (1768-1830)
had crazy idea (1807):Any periodic 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 true!• called Fourier Series
A sum of sinesOur 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(
Fourier TransformWe 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? Complex number trick!
)()()( iIRF 22 )()( IRA
)(
)(tan 1
R
I
We can always go back:
Time and Frequency
example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
Time and Frequency
example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
= +
Frequency Spectra
example : g(t) = sin(2pf t) + (1/3)sin(2p(3f) t)
= +
Frequency SpectraLet’s reconstruct a box using a basis of wiggly functions
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= +
=
Frequency Spectra
= 1
1sin(2 )
k
A ktk
Frequency Spectra
Frequency Spectra
Extension to 2D
in Matlab, check out: imagesc(log(abs(fftshift(fft2(im)))));
Man-made Scene
Can change spectrum, then reconstruct
Low and High Pass filtering
The Convolution TheoremThe 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
Fourier Transform pairs
Reason why gaussian smoothing is better than averaging
2D convolution theorem example
*
f(x,y)
h(x,y)
g(x,y)
|F(sx,sy)|
|H(sx,sy)|
|G(sx,sy)|
Low-pass, Band-pass, High-pass filters
low-pass:
High-pass / band-pass:
Edges in images
Where is the edge?
Solution: smooth first
Look for peaks in
Derivative theorem of convolution
This saves us one operation:
Laplacian of Gaussian
Consider
Laplacian of Gaussianoperator
Where is the edge? Zero-crossings of bottom graph
2D edge detection filters
is the Laplacian operator:
Laplacian of Gaussian
Gaussian derivative of Gaussian
MATLAB demo
g = fspecial('gaussian',15,2);imagesc(g)colorbarsurfl(g)im = im2single(rgb2gray(‘image.jpg’));gim = conv2(im,g,'same');imagesc(conv2(im,[-1 1],'same'));imagesc(conv2(im,[-1 1],'same'));dx = conv2(im,[-1 1],'same');imagesc(conv2(im,dx,'same'));lg = fspecial('log',15,2);lim = conv2(im,lg,'same');Imagesc(lim)Imagesc(im + .2*lim)
Lossy Image Compression (JPEG)
Block-based Discrete Cosine Transform (DCT)
Using DCT in JPEG
A variant of discrete Fourier transform• Real numbers• Fast implementation
Block size• small block
– faster – correlation exists between neighboring pixels
• large block– better compression in smooth regions
JPEG compression comparison
89k 12k