Image Restoration
CS 663, Ajit Rajwade
1
Contents
2
What is image restoration?
3
Degradation Model
4
Observed image
Underlying image
noise
Forward model of the degradation process: note that this is an operator
Common Assumptions on H:
(1) Linearity,
(2) Space Invariance
Degradation Model
5
h is the impulse response of the system, i.e. degraded image if f(x,y) was a unit impulse image – also called as convolution kernel.
Degradation Model
6
Models of Blur
7
Models of Blur
8
Defocus Blur
9
10
Here we are showing plots of
log(magnitude of Fourier transform +1) for easy visualization. We will call them log-Fourier plots
Log-Fourier plot of original image
Log-Fourier plot of Gaussian-blurred image
Gaussian-blurred image.
Kernel size 15 x 15.
Blur level: 5
Motion blur
11
12
Motion Blur
13
Motion Blur
14
Motion Blur
15
Motion Blur
16
17
motion blurred image (motion in X direction)
Log-Fourier plot of motion-blurred image (notice the strong response in the vertical direction and the sinc-like pattern parallel to the X axis!)
Log-Fourier plot of original image
Here we are showing plots of
log(magnitude of Fourier transform +1) for easy visualization. We will call them log-Fourier plots
Example: Restoration by Inverse Filtering
18
Assume no noise (for now)
Convolution theorem
If H(u,v) is zero, there is a problem in estimating F(u,v). Otherwise this task is completely well-defined.
Known (observed)
Known
Unknown (to be estimated)
Example: Restoration by Inverse Filtering
19
Known (observed)
Known
Unknown (to be estimated)
Unknown noise
20
Image restored using Inverse filter with no noise (ideal, non-realistic scenario)
Image restored using Inverse filter with 0.1% noise
Image restored using Inverse filter with 0.1% noise followed by a low-pass filter
Blurring with Holes
21
22
23
Using a coded mask, the restored image is of high quality even under noise (same 0.1% as before). Why does this happen?
24
The coded mask preserves higher frequencies. It also is a spread-spectrum kernel, i.e. it is not a pure low-pass filter. Hence its higher frequency components have larger amplitudes and division (in the inverse filter) does not blow up the noise.
Flutter Shutter Camera
25
26
Frequency response of motion blur kernel in a flutter-shutter camera (blue curve) versus traditional camera (red curve). The green curve corresponds to a different camera (we are not studying it here).
27
Source of images: http://web.media.mit.edu/~raskar/deblur/
28
Source of images: http://web.media.mit.edu/~raskar/deblur/
A word of caution
29
Wiener Filter
30
Wiener filter
31
Wiener filter
32
Wiener filter
33
Wiener filter
34
Wiener filter
Power spectrum of original signal = E(|F(u,v)|2)
Power spectrum of noise = E(|N(u,v)|2)
Power spectrum means magnitude-squared of the Fourier transform. Frequency spectrum means magnitude of the Fourier transform.
Estimate of the Fourier transform of f
35
Noise to signal ratio (or inverse signal to noise ratio – ISNR)
Deblurring filter
Denoising filter
Wiener filter
36
Derivation of Wiener filter in deconvolution
37
We want to find a linear filter whose Fourier transform is L(u,v) and which minimizes the following expected value.
Both these terms are 0 because the image and the noise are uncorrelated and one or both have zero mean.
So E(F(u,v)N*(u,v)) =
E(N(u,v)F*(u,v)) = 0.
E(|F(u,v)|2) = Sf(u,v)
E(|N(u,v)|2) = Sƞ (u,v) E(|L(u,v)|2) = |L(u,v)| 2 as L is not a random variable
38
Derivation of Wiener filter in deconvolution
Derivation of Wiener filter in deconvolution
39
Wiener filter derivation: a few remarks
40
Interactive Wiener filter
41
42
Image taken from the Book by Gonzalez and Woods
43
Image taken from the Book by Gonzalez and Woods
44
Image taken from the Book by Gonzalez and Woods
Regularized Restoration
47
Regularized Restoration
48
Regularized Restoration
49
Regularized Restoration
50
Regularized Restoration
51
The second step follows from Parseval’s theorem
Regularized Restoration
52
Blur is not always bad
53
Motion blur conveys a sense of speed:
can be used to estimate direction of motion of a moving object (or direction of camera motion) from a still image
Aesthetic effects!:
Blur is not always bad
54
Variation in blur conveys depth information
Aesthetic blur: Bokeh
PCA-based denoising
55
Using PCA for image denoising
56
Difference between patches
57
Use of PCA for denoising
J = I + N, N ~ Gaussian distribution of mean 0 and standard deviation σ.
58
Use of PCA for denoising
59
Use of PCA for denoising
60
Use of PCA for denoising
61
Noise variance (assumed known)
Estimate of coefficient squared of true signal
Use of PCA for denoising
62
Comments: Use of PCA for denoising
63
Patch similarity: Use of PCA for denoising
64
qref
Search window for similar patches
65
Sample result
The results with a global eigenspace (consisting of all patches from the image) yield poorer results – see top row, rightmost image.
The results improve with spatially varying PCA provided the number of patches is large enough. The best results with this method generally outperform the results with a bilateral filter which is a purely local technique.
L
L
Use of PCA in denoising: why Wiener-like update?
66
Eigen-coefficients of the “true patch”. We are looking for a linear update which motivates this equation.
As the image and the noise are independent
As the noise is zero mean
ni represents a vector of pure noise values which degrades the true patch to give the noisy patch. Its projection onto the eigenspace gives vector ϒi.
Use of PCA in denoising: why Wiener-like update?
67
Since we are dealing with L similar patches, we can assume (approximately) that the l-th eigen-coefficient of each of those L patches are very similar.