Python代写|ECSE 343 Assignment 3: 2D Deconvolution, Regularization and SVD

Let’s revisit and generalize the image convolution and deconvolution problems we saw in Assignment 1. This time, instead of only consider a discrete 1D horizontal blur kernel, we will consider more general 2D blurs (i.e., horizontal and vertical).

To illustrate the forward blurring process we extend our previous diagrams, however the “sweep and stamp” process still applies. Our diagram below illustrates a few instances of applying a 3 × 3 blur kernel (i.e., with 9 elements, which we’ve numbered for clarity: ❶, ❷, , ❾) to a input image, and generating a … 5 × 5 5 × 5 output image, e.g.,

The kernel is centered — this time horizontally and vertically — on an input pixel at the location of the corresponding output pixel (illustrated as a circle with black contour and grey fill), and if portions of the kernel happen to fall outside the bounds of the input image, they wrap around (vertically and horizontally,now).

By “sliding” the kernel along each pixel of the uncorrupted input image, weighting the underlying source/input pixels by the overlapping kernel values and summing across these weighted input pixels, we construct the final blurred image one pixel at a time:

Recall, as in Assignment 1, while the diagrams above illustrate the blurring process in 2D and for 2D images and kernels, you will express this linear map as a matrix — and thus — must treat the input (and output) images as “flattened” 1D vectors. Treating this change of indexing from 2D pixel coordinates to flattened 1D “image” vector elements is one part of the learning objective for this task.

One common blur kernel is the discrete isotropic Gaussian kernel. For one-dimensional blurs, the continuous kernel is defined as

where 𝜎 is the standard deviation of the Gaussian, which defines its fall-off rate, and the continuous kernel is defined over the entire real line, i.e., for −∞ ≤ 𝑥 ≤ ∞. In practice, one way to take this continuous kernel and discretize it to have length is to evaluate the kernel at integer lattice values 𝑘 𝑥 ∈ {−⌊ 𝑘2 ⌋, … , ⌊ 𝑘2 ⌋}.

For two-dimensional blur kernels, the continuous isotropic Gaussian is

and its discretized 𝑘 × 𝑘 version is obtained by evaluating on a 2D (𝑥, 𝑦) integer lattice with 𝑥 ∈ {−⌊𝑘/2⌋, … , ⌊𝑘/2⌋} and 𝑦 ∈ {−⌊𝑘/2⌋, … , ⌊𝑘/2⌋}. Note 𝐺2D that can be decomposed as the product of two 1D Gaussians, a fact you can optionally leverage to simplify your implementation.