Starting from:

$30

STATSM232A-Project 1Statistics of Natural Images Solved

Problem 1 (High kurtosis and scale invariance,). For computational considerations, first convert image to grey level and re-scale the intensity to [0,31] i.e. 32 grey levels. Convolve the images with a gradient filter rxI, i.e. the intensity di↵erence between two adjacent (horizontally or vertically). You can either pick any single image for the following steps or accumulate the histograms (average) over the 4 images.

1.   Plot the histogram H(z) for the di↵erence against the horizontal axis z 2 [ 31,+31]. Then do a log-plot logH(z). [Some bins will be zero, you can assign ✏ for such bins in the log-plot].

2.   Compute the mean, variance, and kurtosis for this histogram [Report the numericnumbers in your report].

3.   Fit this histogram to a Generalized Gaussian distribution e|z/ | and plot the fittedcurves super-imposed against the histogram. What is the value of in the fitted generalized Gaussian?

4.   Plot the Gaussian distribution using the mean and the variance above, and superimpose this plot with the plots in step (1) above (i.e. plot the Gaussian and its log plot, this is easy to do in matlab).

5.   Down-sample your image(s) by a 2 ⇥ 2 average (or simply sub-sample) the image. Plot the histogram and log histogram, and impose with the plots in step 1, to compare the di↵erence. Repeat this down-sampling process 2-3 times.

6.   Synthesize a uniform noise image, i.e. each pixel is drawn independently from auniform number in [0,31]. Repeat 1-2-4 to compare the di↵erence between a noise image and a natural image. Do a 2 ⇥ 2 average instead of sub-sampling.

1

Problem 2. (Verify the 1/f power law observation in natural images,).

Do an FFT (Fast Fourier Transform) on the grey image I which returns a Fourier image ˆ(⇠,⌘) which is complex number matrix indexed by (⇠,⌘) for its horizontal and vertical frequencies. Compute the amplitude (modulus) of each complex number A(⇠,⌘).

 

Denote the frequency f = p⇠2 + ⌘2, and transfer to a polar coordinate, and we calculate the total Fourier power A2(f) for each frequency (i.e. you need to discretize f, and calculate the A2(f) averaged over the ring for each f, stop f when the circle hits the boundary of the Fourier image).

1.   Plot logA(f) against logf. This should be close to a straight line for each image.

Plot the curves for the 4 images in one figure for comparison.

2.   Compute the integration (summation in discrete case) of S(f0) = R⌦ A2(⇠,⌘)d⇠d⌘ over the domain

⌦(f0) = {(⇠,⌘) : f0 q⇠2 + ⌘2  2f0}

Plot S(f0) over f0, the plot should fit to a horizontal line (with fluctuation) as S(f0) is supposed to be a constant over f0.

Problem 3. (A 2D scale invariant world). Suppose we simulate a toy 2D world where the images consist of only 1D line segments. In an image, a line segment is represented by its center (xi,yi), orientation ✓i and length ri. The line segments are independently distributed with uniform probability for their centers and orientations. The length follows a probability p(r) / [1][2]/r[3], i.e. a cubic power law. You may control the density of line by a Poisson distribution. That is, in each unit area, the number of line segments has a certain constant mean. [Hint: How to sample r from p(r)? Calculate the Cumulative Distribution function of p(r), then draw a random number in [0,1].]


 
[1] . Simulate 1 image I1 of size 1024 ⇥ 1024 pixels with a total N lines. (You need to record all the N lines whose centers are within a range of the image, truncate long lines and hide (discard) lines shorter than a pixel.)
[2] . Simulate 2 new images I2 and I3 of size 512⇥512 and 256⇥256 pixels respectively. I2 and I3 are down-sampled version of I1 and are generated by shortening the N line segments in I1 by 50% and 25% respectively (discard lines shorter than 1).
[3] . Crop 2 image patches of size 128⇥128 pixels randomly from each of the three images I1,I2,I3 respectively. Plot these six images [draw the line segments in black on white background].

If you did it right [Please try !], the 6 images must look the same (i.e. you should not be able to tell what scale the 6 images are cropped from). So this 2D world is scale-invariant.

More products