View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Max filter

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

2.0 | 1 rating Rate this file 1 Download (last 30 days) File Size: 1.3 KB File ID: #41608 Version: 1.0
image thumbnail

Max filter



This code is used for max filter

| Watch this File

File Information

This code is for max filter and i have used it. It works very well in every images.

MATLAB release MATLAB 7.14 (R2012a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
11 Mar 2015 Image Analyst

Image Analyst (view profile)

Why not just use imdilate() which is a local max filter built in to the Image Processing Toolbox?

Comment only
03 May 2013 Jan Simon

Jan Simon (view profile)

This script starts with the brute clearing header "clc; clear all; close all;". This is a bad idea, because "clear all" deletes all breakpoints. Impeding the debugging is a very bad idea.

The algorithm is slow: The builtin function MAX is much faster than SORT and selecting the last element.
Expressions line "[d(i-1,j-1) d(i-1,j) d(i-1,j+1) d(i,j-1) d(i,j) d(i,j+1) d(i+1,j-1) d(i+1,j) d(i+1,j+1)]" can be accelerated: "d(i-1:i+1,j-1:j+1)".
The construction of "m=(1/9)*(ones(3,3));" can be omitted, because "m" is not used anywhere.

A function with inputs and outputs would be more useful than this script, which obtains the image by UIGETFILE. Without any comments and documentation the usability of this code is very low.

Contact us