File Exchange

image thumbnail

Max filter

version 1.0 (1.3 KB) by

This code is used for max filter

0 Downloads

Updated

View License

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

Comments and Ratings (2)

Image Analyst

Image Analyst (view profile)

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

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.

MATLAB Release
MATLAB 7.14 (R2012a)

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

» Watch video