lecture 5 statistical models of images today
play

Lecture 5: Statistical models of images Today Review Fourier - PowerPoint PPT Presentation

Lecture 5: Statistical models of images Today Review Fourier transforms Image statistics Texture synthesis The Discrete Fourier transform The Discrete Fourier Transform (DFT) transforms a signal f[n] into F[u] as: Fourier


  1. Lecture 5: Statistical models of images

  2. Today • Review Fourier transforms • Image statistics • Texture synthesis

  3. The Discrete Fourier transform The Discrete Fourier Transform (DFT) transforms a signal f[n] into F[u] as: Fourier coefficient for frequency u 1D image f [ n ] exp ( − 2 π j un N − 1 N ) ∑ F [ u ] = n =0

  4. Examples From Szeliski 3.4

  5. Examples array([1.+0.j, 1.+0.j, a = np.eye(8)[0] 1.+0.j, 1.+0.j, 1.+0.j, np.fft.fft(a) 1.+0.j, 1.+0.j, 1.+0.j])

  6. Examples array([8.+0.j, 0.+0.j, a = np.ones(8) 0.+0.j, 0.+0.j, 0.+0.j, np.fft.fft(a) 0.+0.j, 0.+0.j, 0.+0.j])

  7. 2D Discrete Fourier Transform 2D Discrete Fourier Transform (DFT) transforms an image f [ n,m ] into F [ u,v ] as: f [ n , m ] exp ( − 2 π j ( M ) ) N − 1 M − 1 un N + vm ∑ ∑ F [ u , v ] = n =0 m =0

  8. Examples What is the 2D FFT of a line?

  9. Fourier transform in x direction -v +v

  10. Full 2D Fourier transform -u -v +v +u

  11. What is a “natural” image? “Natural” image “Fake” image Source: Torralba, Freeman, Isola

  12. Source: Torralba, Freeman, Isola

  13. Statistical modeling of images The pixel Source: Torralba, Freeman, Isola

  14. Statistical modeling of images Assumptions : • Independence: All pixels are independent. • Stationarity: The distribution of pixel intensities does not depend on image location. Source: Torralba, Freeman, Isola

  15. Fitting the model Counts Pixel intensity Source: Torralba, Freeman, Isola

  16. Sampling new images Sample Source: Torralba, Freeman, Isola

  17. Sampling new images Sample Doesn’t work very well! Source: Torralba, Freeman, Isola

  18. Statistical modeling of images The pixel Source: Torralba, Freeman, Isola

  19. Statistical modeling of images The pixel Another pixel Source: Torralba, Freeman, Isola

  20. Δ = 2 Δ = 1 Δ = 10 Δ = 40 C horizontal vertical Δ Source: Torralba, Freeman, Isola

  21. Gaussian model We want a distribution that captures the correlation structure typical of natural images. Let C be the covariance matrix of the image: Stationarity assumption: Symmetrical circulant matrix Diagonalization of circulant matrices: C = EDE T The eigenvectors are the Fourier basis The eigenvalues are the squared magnitude of the Fourier coefficients 2 D= 2 … Source: Torralba, Freeman, Isola

  22. A remarkable property of natural images Power spectra fall off as Low spatial frequencies Spectra 1/ v a High spatial frequencies D. J. Field, "Relations between the statistics of natural images and the response properties of cortical cells," J. Opt. Soc. Am. A 4 , 2379- (1987) Source: Torralba, Freeman, Isola

  23. Sampling new images Sample Fit the Gaussian image model to each of the images in the top row, then draw another random sample (with random phase), you get the bottom row. Source: Torralba, Freeman, Isola

  24. Sampling new images Source: Torralba, Freeman, Isola

  25. Doesn’t always work well! Source: Torralba, Freeman, Isola

  26. Denoising Decomposition of a noisy image + = Source: Torralba, Freeman, Isola

  27. Denoising Decomposition of a noisy image + = White Gaussian noise: N (0, σ n2 ) Natural image Find I(x,y) that maximizes the posterior (maximum a posteriory, MAP): x prior likelihood (Bayes’ theorem) Source: Torralba, Freeman, Isola

  28. Denoising Decomposition of a noisy image + = White Gaussian noise: N (0, σ n2 ) Natural image Find I(x,y) that maximizes the posterior (maximum a posteriory, MAP): x prior likelihood x Source: Torralba, Freeman, Isola

  29. Denoising x prior likelihood x The solution is: (note this is a linear operation) This can also be written in the Fourier domain, for constant A: Source: Torralba, Freeman, Isola

  30. The truth: + = The estimated decomposition: = + Source: Torralba, Freeman, Isola

  31. Statistical modeling of images A small neighborhood Source: Torralba, Freeman, Isola

  32. [-1 1] = [-1, 1] h[m,n] f[m,n] g[m,n] Source: Torralba, Freeman, Isola

  33. [-1 1] T = [-1, 1] T h[m,n] f[m,n] g[m,n] Source: Torralba, Freeman, Isola

  34. Observation: Sparse filter response Source: Torralba, Freeman, Isola

  35. Image Intensity histogram [1 -1] filter output [1 -1] output histogram Red – true pdf Black – best Gaussian fit

  36. A model based on filter outputs A small neighborhood p ( h k ( x,y ) ) k All pixels and all outputs are independent Filter outputs Source: Torralba, Freeman, Isola

  37. Sampling images Gaussian model Wavelet marginal model Source: Torralba, Freeman, Isola

  38. Taking a picture… What the camera give us… How do we correct this? Slides R. Fergus

  39. Deblurring Slides R. Fergus

  40. Deblurring Slides R. Fergus

  41. Deblurring Slides R. Fergus

  42. Image formation process ⊗ = Blur 
 kernel Blurry image Sharp image Input to algorithm Desired output Convolution 
 Model is approximation operator

  43. Multiple possible solutions Sharp image Blur kernel = ⊗ = ⊗ Blurry image = ⊗

  44. Natural image statistics Characteristic distribution with heavy tails Histogram of image gradients Slides R. Fergus

  45. Blury images have different statistics Histogram of image gradients Slides R. Fergus

  46. Parametric distribution Histogram of image gradients Use parametric model of sharp image statistics Slides R. Fergus

  47. Nonparametric image models

  48. Texture Synthesis Source: A. Efros

  49. Efros & Leung Algorithm non-parametric sampling p Input image Synthesizing a pixel • Assuming Markov property, compute P( p |N( p )) – Building explicit probability tables infeasible – Instead, we search the input image for all similar neighborhoods — that’s our pdf for p – To sample from this pdf, just pick one match at random Source: A. Efros

  50. Some Details • Growing is in “onion skin” order – Within each “layer”, pixels with most neighbors are synthesized first – If no close match can be found, the pixel is not synthesized until the end • Using Gaussian-weighted SSD is very important – to make sure the new pixel agrees with its closest neighbors – Approximates reduction to a smaller neighborhood window if data is too sparse Source: A. Efros

  51. Neighborhood Window input Source: A. Efros

  52. Varying Window Size Increasing window size Source: A. Efros

  53. Synthesis Results french canvas rafia weave Source: A. Efros

  54. More Results white bread brick wall Source: A. Efros

  55. Homage to Shannon Source: A. Efros

  56. Hole Filling Source: A. Efros

  57. Extrapolation Source: A. Efros

  58. Summary • The Efros & Leung algorithm – Very simple – Surprisingly good results – Synthesis is easier than analysis! – …but very slow

  59. Image Quilting [Efros & Freeman] non-parametric sampling p B Input image Synthesizing a block • Observation: neighbor pixels are highly correlated Idea: unit of synthesis = block • Exactly the same but now we want P( B |N( B )) • Much faster: synthesize all pixels in a block at once • Not the same as multi-scale!

  60. block Input texture B1 B2 B1 B1 B2 B2 Neighboring blocks Minimal error Random placement constrained by overlap boundary cut of blocks

  61. Minimal error boundary overlapping blocks vertical boundary 2 _ = overlap error min. error boundary

  62. Our Philosophy • The “Corrupt Professor’s Algorithm”: – Plagiarize as much of the source image as you can – Then try to cover up the evidence • Rationale: – Texture blocks are by definition correct samples of texture so problem only connecting them together

  63. Failures (Chernobyl Harvest)

  64. Texture Transfer Constraint Texture sample

Recommend


More recommend