How to apply an 9x9 average filter to image with some boundary options?

Hi! I know how to apply an average filter, but how to apply it with a certain boundary options?
For example: boundary option: X=0 or periodic?
Thank you in advance! I'm trying to learn Matlab by myself and this could be very useful for me!

Answers (2)

You can use imfilter() or conv2():
out = conv2(double(grayImage), ones(9)/81, 'same');
This assumes zeros outside the image. I can't think of any reason why you'd need a periodic situation.

1 Comment

I'm trying to solve a several questions from the textbook. It says to use imfilter. I read the help file, but I did not see where I put the boundaries?
The questions ask for: X=0, X=225, mirror-reflection, periodic, equal to nearest border value.
I thought if I understand the periodic and x=0 boundary with imfilter I could sort out the rest.

Sign in to comment.

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 19 Oct 2015

Commented:

on 19 Oct 2015

Community Treasure Hunt

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

Start Hunting!