% ========================================================================= % Math 336 - Image Processing - Laboratory 4 % % Image Restoration (Part 1): % Apply a blurring PSF to peppers. Add noise. Use the function % l_curve_rtls.m to construct the L-curve of a Tikhonov reconstruction of % peppers. % % Marty Kandes % Computational Science Research Center / Department of Physics % San Diego State University % Fall 2008 % ------------------------------------------------------------------------- clear all; close all; clc; % Clear Matlab workspace. F = imread('peppers.jpg'); % Read in peppers image. F = im2double(F); % Convert peppers to double. F = mat2gray(F); % Normalize grayscale image. [M,N] = size(F); % Get dimensions of image. PSF = fspecial('disk',6); % Make disk or circular PSF. OTF = psf2otf(PSF,[M,N]); % Compute the OTF of the PSF. G = real(ifft2(OTF.*fft2(F))); % Apply PSF to create blurring. H = imnoise(G,'gaussian',0,0.01); % Add gaussian noise. figure; % Open new figure. imshow(G); % Display the blurred peppers. imwrite(F,'peppersblurred.jpg','jpg'); % Write image to file. figure; % Open new figure. imshow(H); % Display the blurred+noisy peppers. imwrite(H,'peppersblurrednoisy.jpg','jpg'); % Write image to file. % How do you use l_curve_rtls.m correctly? L = eye(M,N); % Assume zeroth-order regularization operator.