I blurred a grayscale image using a 5x5 average filter and then I am supposed to...

80.2K

Verified Solution

Question

Electrical Engineering

I blurred a grayscale image using a 5x5 average filter and thenI am supposed to deblur using an Inverse filter using ConstrainedDivision. Is there a better way to do this?

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 justfine 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

Answer & Explanation Solved by verified expert
3.5 Ratings (449 Votes)
imimreadSharon2jpg yrgb2grayim zimresizey512 512 ximrotatez270 figure imshowx Define blur kernel hsize 17 sigma 5 Whatever kernel fspecialgaussian hsize sigma Read in sample image grayImage imreadcameramantif Sample image rows columns numberOfColorChannels sizegrayImage w floorhsize2 for col w1 columns w for row w1 rows w code to filter    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students