필터 지우기
필터 지우기

I blurred a grayscale image using an average filter and then I am supposed to deblur using an Inverse filter using Constrained Division. Is there a better way to do this?

조회 수: 3 (최근 30일)
Hello I need some help. I have to blur a grayscale image using a 5x5 blurring filter. Then I need to attempt to de-blur the result using inverse filtering with constrained division.The error that pops up is this:
Error using ./
Complex integer arithmetic is not supported.
Error in test2 (line 12)
fbw = fftshift(fft2(blur))./bw;
When I blur the image using a butterworth filter it works just fine yet when I blur using the average filter my code won't work. Below is my attempt:
clear
I = imread('buffalo.png');
H = fspecial('average',[5 5]) ;
blurred=imfilter(I,H);
blur=im2uint8(mat2gray((blurred)));
imshow(blur)
d = 0.01;
bw = blurred;
bw(find(bw<d)) = 1;
fbw = fftshift(fft2(blur))./bw;
ba = abs(ifft2(fbw));
unb01 = im2uint8(mat2gray(ba));

채택된 답변

Matt J
Matt J 2018년 4월 8일
편집: Matt J 2018년 4월 8일
I think this should work.
bw = double(blurred);
In general, I think you should be using im2double rather than im2uint8. The operations that you are doing require float precision.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by