File Exchange

image thumbnail

Average Filter

version 1.6.0.0 (3.44 KB) by Jan Motl
Average filter performs image smoothing with integral image method.

10 Downloads

Updated 01 Jun 2018

View License

The advantage of this implementation in comparison to IMFILTER from Image Processing Toolbox is that the processing time is independent of window size. In practice, it means that this implementation of the mean filter is faster than IMFILTER once windows size goes beyond 7 pixels.

Cite As

Jan Motl (2020). Average Filter (https://www.mathworks.com/matlabcentral/fileexchange/40174-average-filter), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Lns K

this algorithm has it a good result in a subpixel detection , I would comapre some techniques of thresholding and their impacts in a subpixel accuracy ( centroid calculation)

Jan Motl

I fixed the error in the test file. The function should be called like:
averagefilter(image, [m n])
and not like:
averagefilter(image, m, n)

Thank you for the report!

Partho Pritom

there is an error which reports "Index exceeds matrix dimensions"

Kate Snyder

sara

Jan Motl

Hi Jan,
thank you for your feedback. The biggest gain from the vectorised version is in calculation of the integral image - cumsum accelerated the whole function by 5%. And that is good.

Jan

Although I like FOR loops, here a vectorized approach would be much more efficient, e.g.:
output = (t(1+m:rows+m, 1+n:columns+n) + t(1:rows, 1:columns) -
t(1+m:rows+m, 1:columns) - t(1:rows, 1+n:columns+n)) / winNum;

The documentation is very good: H1 line, exhaustive descritpion of inputs and outputs, "See also" line. I only miss a date and the author.
The inputs are check reliably.

Updates

1.6.0.0

Fixed the test file. (Thanks to Kate!)

1.6.0.0

Fix typos

1.6.0.0

Allowed reuse of the integral image.

1.5.0.0

Added support for even sized kernels.

1.4.0.0

Vectorised version.

1.3.0.0

Improved the help text. (Thanks Jan!)

1.2.0.0

Fixed copyright owner.

1.1.0.0

Added padding parameters.

MATLAB Release Compatibility
Created with R13
Compatible with any release
Platform Compatibility
Windows macOS Linux