程序代写代做代考 kernel 18-793 Image and Video Processing

18-793 Image and Video Processing
Submission instructions.
Fall 2020
􏰀 Submissions are due on Thursday 11/19 at 10.00pm ET
􏰀 Please upload scans of your solution in GradeScope (via Canvas)
Homework 10
Instructions
􏰀 Please solve all non-MATLAB problems using only paper and pen, without resorting to
a computer.
􏰀 Please show all necessary steps to get the final answer. However, there is no need to be overly elaborate. Crisp and complete answers.
􏰀 For all MATLAB problems, include all code written to generate solutions.
􏰀 Please post all questions on the discussion board on the Piazza course website.
􏰀 If you feel some information is missing, you are welcome to make reasonable assumptions and proceed. Sometimes the omissions are intentional. Needless to say, only reasonable assumptions will be accepted.
1. (Deblurring and boundary conditions) Consider the code snippet below.
clear all
close all
sharpimg = imread(’cameraman.tif’); %%load sharp image
sharpimg = double(sharpimg)/255;
%blur kernel — lets create a random one
k0 = rand(11,11);
k0(6, 🙂 = 1;
k0(:, 6) = 1;
k0 = k0/sum(sum(k0));
%Linear convolution
blurimage = conv2(sharpimg, k0, ’valid’);
%%this is typically what you get when you take a photo
%%the ‘valid’ boundary condition suggests the following

2
Homework 10
%% —— world is not periodic or zero padded, but instead some light from the region
%%
clear sharpimg %%avoid temptation to access the answer
%%%Your code goes here
%%you are welcome to use the variables blurimage, and k0
(Part a) Use Fourier domain inversion to estimate the sharp image. That is, compute 2D FFT of blurimage and k0, divide them, and apply inverse FFT to get an estimate of the sharp image. The size of the FFT is something that is left to you. Also left to you is a strategy on how to handle nulls in the the Fourier transform of k0.
Deliverable: Code, and deblurred sharp image. You are also expected to explain why your deblurred image looks as follows.
(Part b) Now lets attempt to deblur again but this time using algebraic methods. Use the following code to reconstruct the sharp image.
vec = @(x) x(:);
fA = @(x) vec(conv2(reshape(x, size(blurimage)+size(k0)-1), k0, ’valid’));
fAadj = @(x) vec(conv2(reshape(x, size(blurimage)), k0(end:-1:1, end:-1:1), ’full’));
rhsterm = fAadj(blurimage);
fCGS = @(x) fAadj(fA(x));
xhat = cgs( fCGS, rhsterm, 1e-6, 1000);
xhat= reshape(xhat, size(blurimage)+size(k0)-1);
imshow(xhat);
Deliverable: Just the reconstructed image. no code.
2. (Iterative Soft Thresholding)
Implement iterative soft thresholding in MATLAB under sparsity prior in some basis. Your function for iterative soft thresholding that solves the problem
min 1∥y − A(x)∥2 + λ∥Ψ(x)∥1, x2
might look like this
function xstar = IST(y, lambda, Psi, PsiAdj, A, AAdj, MaxIter, Tol,
xinit)

Homework 10 3 Deliverable 1. Matlab function for IST. Please label the code for readability.
Deliverable 2. Use the code below to test your code. You should include the completed code and the figure it generates.
clear all; close all
N = 1024; %Signal dimension
M = 256; %%number of measurements! 256 < 1024!! K = 64; %sparsity level x0 = zeros(N, 1); Supp0 = randperm(N, K); %support of sparse signal x0(Supp0) = randn(K, 1); %%sparse signal A = randn(M, N)/sqrt(M); %%measurement matrix y = A*x0; %%measurements %%%%[Your code goes here] %%setup function handles and other variables %%call IST and get output in the variable xstar %%Visualize results stem(x0); hold on stem(xstar, ’rx’); 3. (Deblurring with Iterative Soft Thresholding) We will test the code from the problem above on the deblurring problem. In hw10.mat, you are given a blurred image in the variable imblur and a blur kernel k0. Deblur with IST. Deliverable 1. For the deblurring problem , provide MATLAB code for implementing the operator A and its adjoint A∗. Deliverable 2. Deblur the image using your IST code. Do sweep through values of λ for best results. In your submission you are expected to show the restored image. You will be evaluated on the quality of the reconstructed image.