Statistics of Natural Images
Course Material for CS 754 (Advanced Image Processing, IITB)
Course Instructor: Ajit Rajwade
Ajit Rajwade
1
Motivation
Ajit Rajwade
2
Ajit Rajwade
3
Why study statistics of natural images?
Ajit Rajwade
4
Ajit Rajwade
5
Sample State of the art result: Gaussian Noise sigma = 15
Ajit Rajwade
6
Motion deblurring
Ajit Rajwade
7
Inpainting
Why study statistics of natural images?
Ajit Rajwade
8
Real-world signal (scene – static or dynamic)
Convolution with Blur Kernel + Noise
Eye (Retina)
Visual Cortex
Brain is solving an inverse problem!
What are these amazing statistical properties?
Ajit Rajwade
9
Some background
Ajit Rajwade
10
Discrete Fourier transform
Ajit Rajwade
11
2D Discrete Cosine Transform
Ajit Rajwade
12
Here the image is being represented as a linear combination of the cosine functions of different frequencies.
How do the DCT bases look like? (2D-case)
Ajit Rajwade
13
The DCT transforms an 8×8 block of input values to a linear combination of these 64 patterns. The patterns are referred to as the two-dimensional DCT basis vectors, and the output values are referred to as transform coefficients. Here each basis vector is reshaped to form an image.
Note: An image patch (size 8 x 8) can be represented as the linear combination of these 64 patterns.
(1) Power law for natural images
where is a small number between 0 and 1 (usually around 0.19 for natural images), A is a constant.
Ajit Rajwade
14
Expected value of squared magnitude of Fourier transform coefficient at frequency (u,v). Expectation is over all natural images.
Ajit Rajwade
15
Spectrum of Barbara
log(abs(fftshift(fft2(im)+1)
Spectrum of Noise
log(abs(fftshift(fft2(im)+1)
Ajit Rajwade
16
(1) Power Law
(1) Power Law
Ajit Rajwade
17
(2) Joint statistics:�pixel and an immediate neighbor
Ajit Rajwade
18
What do you think the corresponding plot for a pure noise image would look like?
(2) Joint statistics:�pixel and an immediate neighbor
Ajit Rajwade
19
What do you think the corresponding plot for a pure noise image would look like?
(2) Joint statistics of pixel and an immediate neighbor
Ajit Rajwade
20
(2a) Joint statistics of a pixel and nearby pixels: Experiment
Ajit Rajwade
21
Ajit Rajwade
22
1.0000 0.9902 0.9795 0.9733 0.9682 0.9639 0.9604 0.9570
0.9902 1.0005 0.9908 0.9795 0.9734 0.9684 0.9643 0.9605
0.9795 0.9908 1.0010 0.9908 0.9796 0.9735 0.9689 0.9646
0.9733 0.9795 0.9908 1.0005 0.9904 0.9793 0.9735 0.9686
0.9682 0.9734 0.9796 0.9904 1.0004 0.9903 0.9794 0.9734
0.9639 0.9684 0.9735 0.9793 0.9903 1.0001 0.9903 0.9793
0.9604 0.9643 0.9689 0.9735 0.9794 0.9903 1.0004 0.9904
0.9570 0.9605 0.9646 0.9686 0.9734 0.9793 0.9904 1.0002
1.0000 0.9888 0.9770 0.9704 0.9648 0.9599 0.9554 0.9510
0.9888 1.0004 0.9891 0.9768 0.9703 0.9646 0.9596 0.9548
0.9770 0.9891 1.0004 0.9886 0.9764 0.9698 0.9640 0.9587
0.9704 0.9768 0.9886 0.9994 0.9878 0.9755 0.9687 0.9627
0.9648 0.9703 0.9764 0.9878 0.9986 0.9870 0.9746 0.9676
0.9599 0.9646 0.9698 0.9755 0.9870 0.9978 0.9861 0.9734
0.9554 0.9596 0.9640 0.9687 0.9746 0.9861 0.9967 0.9847
0.9510 0.9548 0.9587 0.9627 0.9676 0.9734 0.9847 0.9951
CR/CR(1,1) -
Notice it can be approximated by the form shown two slides before, with ρ~0.99
CC/CC(1,1) -
Notice it can be approximated by the form shown two slides before, with ρ~0.9888
(3) Distribution of DCT coefficients
Ajit Rajwade
23
Ajit Rajwade
24
v
u
DCT coefficients computed for small patches. The distribution is represented by means of a histogram per coefficient. The samples to build the distribution for each coefficient come from the image patches – for each of which the DCT was computed.
Image source: Lam and Goodman, “A Mathematical Analysis of the DCT coefficient distributions for images”, IEEE Transactions on Image Processing, 2000.
(3) Distribution of DCT coefficients
Ajit Rajwade
25
Segway: Generalized Gaussian Distribution
Ajit Rajwade
26
Shape
parameter
Scale
parameter
Gaussian
Laplacian
Uniform
Gaussian
Generalized Gaussian
Ajit Rajwade
27
Generalized Gaussian Distributions: The Laplacian is a GGD with beta = 1.
Laplacian versus Gaussian distribution
Ajit Rajwade
28
The probability density of a sample decreases as the sample value moves farther away from the mean. But for the Gaussian distribution, this decrease is much quicker (why?).
(3) Distribution of DCT coefficients
Ajit Rajwade
29
By Lindeberg’s central limit theorem, the distribution of F(u,v) should be Gaussian – the weighted summation of identically distributed random variables can be approximated as Gaussian.
(3) Distribution of DCT coefficients: Lindeberg’s central limit theorem
Ajit Rajwade
30
(3) Distribution of DCT coefficients: Lindeberg’s central limit theorem
Ajit Rajwade
31
Spatial index k corresponding to location (x,y)
Random variable Xk
(3) Distribution of DCT coefficients
Ajit Rajwade
32
(3) Distribution of DCT coefficients
Ajit Rajwade
33
If σ2 = variance of pixel intensity values, then
Var(F(u,v)) = σ2
Ajit Rajwade
34
Histogram of patch variance values – collected over all non-overlapping patches of size 8 x 8 from a grayscale image
(3) Distribution of DCT coefficients
Ajit Rajwade
35
(3) Distribution of DCT coefficients
Ajit Rajwade
36
This is a Laplacian distribution!
(3) Distribution of DCT coefficients
Ajit Rajwade
37
(3) Distribution of DCT coefficients
Ajit Rajwade
38
(3) Distribution of DCT coefficients
Ajit Rajwade
39
(3) Distribution of DCT coefficients
Ajit Rajwade
40
(4) Distribution of Wavelet coefficients
Ajit Rajwade
41
(4) Distribution of Wavelet coefficients
Ajit Rajwade
42
Corresponding orthonormal basis (each column is a basis vector)
Image source: Huang & Mumford, Statistics of Natural Images and Models, CVPR 1999
(4) Distribution of Wavelet coefficients
Ajit Rajwade
43
(4) Distribution of Wavelet coefficients
Ajit Rajwade
44
(4) Distribution of Wavelet coefficients
Ajit Rajwade
45
(4) Distribution of Wavelet coefficients
Ajit Rajwade
46
Smoother regions: larger coefficient values
Textured regions/edges: smaller values
Image source: Simoncelli, Bayesian denoising of visual images in the wavelet domain, 1999, http://www.cns.nyu.edu/pub/lcv/simoncelli98e.pdf
(4) Distribution of Wavelet coefficients
Ajit Rajwade
47
Ajit Rajwade
48
512 x 512 Barbara image
Image reconstructed from top 80,000 largest DCT coefficients
(4) Distribution of Wavelet coefficients
Ajit Rajwade
49
�(4a) Joint Statistics of Haar wavelet coefficients
Ajit Rajwade
50
Concept of parent, child, sibling and cousin coefficients (all are called wavelet sub-bands). Sibling = adjacent spatial locations in a sub-band, cousins = same spatial location at adjacent orientations.
Coefficients computed at multiples scales of the Haar wavelet pyramid
Image source: Huang & Mumford, Statistics of Natural Images and Models, CVPR 1999
Ajit Rajwade
51
HL1
HH1
LL1
LH1
HH2
LH2
LL2
HL2
Three-level wavelet decomposition of an image
LL3
HL3
LH3
HH3
Ajit Rajwade
52
These joint statistics reveal that wavelet coefficients are NOT independent
Image source: Huang & Mumford, Statistics of Natural Images and Models, CVPR 1999
Ajit Rajwade
53
Large magnitude coefficients tend to occur at neighboring spatial locations within a sub-band, or at the same locations in sub-bands of adjacent scale/orientation, or at related spatial locations in parent and child sub-bands.
Image source: Buccigrossi et al, Image Compression via Joint Statistical
Characterization in the Wavelet Domain.
Ajit Rajwade
54
Joint histogram of logarithms of absolute value of child and parent coefficients (also true for coefficients at adjacent orientations) – features like prominent edges or textures have large magnitude coefficients at multiple scales
Joint histogram of logarithm of squared value of child coefficient, and logarithm of square of linear combination of squared values of coefficients from neighboring sub-bands
Ajit Rajwade
55
HL1
HH1
LL1
LH1
HH2
LH2
LL2
HL2
LL3
HL3
LH3
HH3
Wavelet coefficient from neighboring sub-band (at corresponding location)
Ajit Rajwade
56
Conditional distributions of a wavelet coefficient (log absolute) given linear combinations of its neighbors (log absolute) – the shapes are robust across images! The plots are mean and variance normalized.
This redundancy means that we need not store all the wavelet coefficients – we can just predict some coefficients directly given their neighbors using the linear model that was fit. Useful for lossy image compression!
Why study Natural Image Statistics: Bayesian Framework
Ajit Rajwade
57
Observation
Unknown (to be determined) signal
noise
Prior Model on signal
Likelihood
Bayes rule
Known
operator
Posterior
probability
Why study Natural Image Statistics: Bayesian Framework
Ajit Rajwade
58
Assuming zero-mean i.i.d. (additive) Gaussian noise model,
the likelihood is as follows:
NOTE: Likelihood derived from the assumed noise model
Bayesian Framework: To Estimate x
Ajit Rajwade
59
As y does not affect maximization w.r.t. x
The MAP estimate asks the following question: Given the observation y, what x is the most likely, taking into account that we have prior information on x in the form of p(x)?
If p(x) were a uniform distribution (or effectively we had no prior information about x), then MAP reduces to maximizing p(y|x) – which is called the maximum likelihood estimate.
Bayesian Framework: To Estimate x
Ajit Rajwade
60
Prior is important!
Integrate to 1
Simple Example: 1
Ajit Rajwade
61
Observed Value of y = 14. Determine x given y and the knowledge of the noise model (likelihood) and prior on x.
Prior
Likelihood
Simple Example :1
Ajit Rajwade
62
Simple Example: 2
Ajit Rajwade
63
Observed Value of y = 2. Determine x given y and the knowledge of the noise model (likelihood) and prior on x.
Simple Example: 2
Ajit Rajwade
64
Simple Example: 2
Ajit Rajwade
65
When the likelihood and prior are both Gaussian, the MAP and MMSE estimates are equal.
Maximum Likelihood Estimation
Ajit Rajwade
66
If there is only one observation sample available (assume Gaussian noise), what is the maximum likelihood estimate of x?
If there are some N observation samples available (under Gaussian noise), what is the maximum likelihood estimate of x?
Ajit Rajwade
67
These two examples were very simple and involved scalar quantities. In future lectures, we will use more complex examples, where the unknown quantity x will be multivariate – in fact, it will be an image.
We will study the applications of natural image statistics in the following applications:
Application in Denoising or Deblurring
Ajit Rajwade
68
Application in Denoising
Ajit Rajwade
69
Application in Denoising
Ajit Rajwade
70
Application in Deblurring
Ajit Rajwade
71
Application in Deblurring
Ajit Rajwade
72
Application in deblurring
Ajit Rajwade
73
Application in deblurring
Ajit Rajwade
74
Gaussian instead of Laplacian prior
Ajit Rajwade
75
Gaussian instead of Laplacian prior
Ajit Rajwade
76
This is the Wiener filter which we have seen last semester! The Wiener filter is the optimal linear filter regardless of the signal prior, which is what we proved in CS 663. For Gaussian likelihood and Gaussian prior, the Wiener filter is the optimal filter (among linear as well as non-linear) in a MAP or MMSE sense.
Ajit Rajwade
77
i.e. solution with Laplacian prior
Limitation of this model
Ajit Rajwade
78
Limitation of this model
Ajit Rajwade
79
Statistical Compressed Sensing
Ajit Rajwade
80
Statistical Compressed Sensing
Ajit Rajwade
81
Statistical Compressed Sensing
Ajit Rajwade
82
The latter expression follows by the Woodbury matrix identity.
Statistical Compressed Sensing
Ajit Rajwade
83
Results
Ajit Rajwade
84
k = m = # of measurements
Assumption:
Eigen-values in the covariance matrix for the signal (i.e. Σ) are of the form: i-α where 1 ≤ i ≤ n. The larger the value of α, the lower the reconstruction error.
The decay of the eigenvalues of the covariance matrix is the equivalent of signal sparsity or compressibility in an appropriate orthonormal basis.
For example, a signal with identity covariance matrix would not yield itself to good reconstruction via this method.
Best-k = best k-term approximation obtained by keeping the k largest (absolute value) entries of x and setting the rest t0 0. This is for x ~ N(0,C) where C is a covariance matrix with decaying eigenvalues.
Gaussian assumption on signals?
Ajit Rajwade
85
Gaussian assumption on signals?
Ajit Rajwade
86
Gaussian assumption on signals?
Ajit Rajwade
87
GMMs for compressed sensing
Ajit Rajwade
88
GMMs for compressed sensing
Ajit Rajwade
89
GMMs for compressed sensing
Ajit Rajwade
90
Ajit Rajwade
91
Ajit Rajwade
92
Application in Scene Categorization
Ajit Rajwade
93
Problem statement
Ajit Rajwade
94
Ajit Rajwade
95
Image source: Torralba and Olvia, Statistics of Natural Image Categories, Network, 2003
Man-made versus natural scenes
Ajit Rajwade
96
Ajit Rajwade
97
50% contour
80% contour
X% contour means that the energy inside the contour is X%. Energy refers to sum of the squares of the amplitudes of the Fourier components inside the contour. How is the contour computed? The Fourier coefficients are sorted in descending order of squared magnitude and the first set of coefficients amounting to X% of energy are collected together to create this contour.
Image source: Torralba and Olvia, Statistics of Natural Image Categories, Network, 2003
d
b
Natural scene (more “isotropic” than the signature for man-made scenes)
Man-made scene (notice the larger energy concentrated near the axes)
Ajit Rajwade
98
Domination by the horizon (strong horizontal edges)
More isotropic spectral signatures!
Ajit Rajwade
99
Average spectral signatures for scenes at different scales.
Close-ups of man-made scenes are dominated by smooth surfaces, as opposed to close-ups of natural scenes. Smooth surfaces = dominance of low frequency information! Hence the spectra of man-made scenes have a dominance of low-frequency content – as is evident in the plots above.
Image source: Torralba and Olvia, Statistics of Natural Image Categories, Network, 2003
Ajit Rajwade
100
Scene scale: average scene depth
Image scale: related to its resolution (different scales generated by upsampling the image by a factor of 2 successively)
Image source: Torralba and Olvia, Statistics of Natural Image Categories, Network, 2003
Scene classification
Ajit Rajwade
101
Application of Dependencies between wavelet coefficients: in denoising
Ajit Rajwade
102
Recall 1
Ajit Rajwade
103
Large wavelet coefficients tend to occur near each within the same sub-band.
And at the same relative spatial locations in sub-bands at adjacent scales or orientations
Wavelet coefficient dependency
Ajit Rajwade
104
Image source: Buccigrossi et al, Image Compression via Joint Statistical
Characterization in the Wavelet Domain, IEEE Transactions on Image Processing, 1997
Wavelet coefficient dependency
Ajit Rajwade
105
Wavelet coefficient dependency
Ajit Rajwade
106
Neighbors of coefficient c
(some cousins & siblings, parent)
Can be obtained by least squares method
Ajit Rajwade
107
Can be obtained by least squares method
Least squares estimate of w
Wavelet coefficient dependency
Ajit Rajwade
108
Application to denoising
Ajit Rajwade
109
Application to denoising
and then used for estimating {wk} or α.
Ajit Rajwade
110
Sample results
Ajit Rajwade
111
(Left) Original and (Right) noisy image
(Left) Marginal MAP with independent Gaussian prior and (Right) new model
MMSE estimator using GGD prior on wavelet coefficients
User-assisted reflection removal
Ajit Rajwade
112
Problem statement
Ajit Rajwade
113
Ajit Rajwade
114
Ajit Rajwade
115
This is an ill-posed problem, as there are infinitely many I1 and I2 that could sum up to I.
Method for reflection removal: user-assisted
Ajit Rajwade
116
Ajit Rajwade
117
Method for reflection removal: user-assisted
Ajit Rajwade
118
Method for reflection removal: statistical model
Ajit Rajwade
119
Ajit Rajwade
120
The gradients (in this case, the y derivatives of the intensity) are sparse!
Method for reflection removal: statistical model
Ajit Rajwade
121
z = gradient value,
q = shape parameter
Method for reflection removal: statistical model
Ajit Rajwade
122
Method for reflection removal: statistical model
Ajit Rajwade
123
Method for reflection removal: statistical model
Ajit Rajwade
124
Method for reflection removal: statistical model
Ajit Rajwade
125
Because I2 = I –I1.
Optimization algorithm
Ajit Rajwade
126
Segway: Least squares method
Ajit Rajwade
127
Segway: Weighted least squares method
Ajit Rajwade
128
Segway: Least p-norm problem
Ajit Rajwade
129
Segway: IRLS
Ajit Rajwade
130
Weight for point i at iteration t
Diagonal matrix of weights at iteration t (for all points)
Segway: IRLS
Ajit Rajwade
131
Back to the Optimization algorithm
Ajit Rajwade
132
Optimization algorithm
Ajit Rajwade
133
Method for reflection removal: actual statistical model used in the paper
Ajit Rajwade
134
z = gradient value
Sample results
Ajit Rajwade
135
Ajit Rajwade
136
Comparison: Laplacian and Sparse (mixture of two Laplacians) priors
Ajit Rajwade
137
Comparison: Laplacian and Sparse (mixture of two Laplacians) priors
Ajit Rajwade
138
Comparison: Laplacian and Gaussian priors. Notice the much better results
For the Laplacian prior as compared to the Gaussian prior.
Summary
Ajit Rajwade
139