Question

how I can make Average filter without built-in function for image on matlab

how I can make Average filter without built-in function for image

on matlab

0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:

MATLAB CODE:

clc;

clear all;

close all;

a=imread('cameraman.tif');

figure, imshow(a)

an=imnoise(a,'gaussian');

[m,n]=size(an);

figure, imshow(uint8(an))

b=input('Enter Averaging Mask size: ');

z=ones(b);

[p,q]=size(z);

w=1:p;

x=round(median(w));

anz=zeros(m+2*(x-1),n+2*(x-1));

for i=x:(m+(x-1))

for j=x:(n+(x-1))

anz(i,j)=an(i-(x-1),j-(x-1));

end

end

figure, imshow(uint8(anz))

sum=0;

x=0;

y=0;

for i=1:m

for j=1:n

for k=1:p

for l=1:q

sum= sum+anz(i+x,j+y)*z(k,l);

y=y+1;

end

y=0;

x=x+1;

end

x=0;

ans(i,j)=(1/(p*q))*(sum);

sum=0;

end

end

figure, imshow(uint8(ans))

----------------------------------------------------------------------------------------------------------

Run the code
will ask you to input the value of averaging mask.

enter 3 if you want to use 3*3
enter 5 if you want to use 5*5

Add a comment
Know the answer?
Add Answer to:
how I can make Average filter without built-in function for image on matlab
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT