How can I write noise removal and blur deblur codes in a single matlab code using fft?
Show older comments
I was able to write the noise removal code, but I need to add blur and deblur to it. How should I do this?
Accepted Answer
More Answers (1)
This is what you are trying to obtain:
O_img = imread('MATLAB.jpg');
% Create a blur kernel, e.g., Gaussian noise type of blur:
B_kernel = fspecial('gaussian', [13, 13], 3); % Adjust kernel size and sigma you want
% Convert the original image to double:
O_img = im2double(O_img);
% Apply FFT to the original image and the blur kernel:
FFT_O_img = fft2(O_img);
FFT_B_kernel = fft2(B_kernel, size(O_img, 1), size(O_img, 2));
% Convolution in Frequency domain to get blurs into an image:
FFT_B_img = FFT_O_img .* FFT_B_kernel;
% Inverse FFT to get the blurred image:
B_img = ifft2(FFT_B_img);
% Original vs. blurred images:
figure;
subplot(211); imshow(O_img); title('Original Image');
subplot(212); imshow(abs(B_img), []); title('Blurred Image');
Categories
Find more on Deblurring in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!