Code covered by the BSD License  

Highlights from
Hybrid median filtering

5.0

5.0 | 1 rating Rate this file 17 Downloads (last 30 days) File Size: 2.84 KB File ID: #25825
image thumbnail

Hybrid median filtering

by Damien Garcia

 

12 Nov 2009 (Updated 25 Feb 2010)

HMF performs hybrid median filtering of a 2-D array or an RGB image

| Watch this File

File Information
Description

B = HMF(A,N) performs hybrid median filtering of the matrix A using a NxN box. Hybrid median filtering preserves edges better than a NxN square kernel-based median filter because data from different spatial directions are ranked separately. Three median values are calculated in the NxN box: MR is the median of horizontal and vertical R pixels, and MD is the median of diagonal D pixels. The filtered value is the median of the two median values and the central pixel C: median([MR,MD,C]).

B = HMF(A) uses N = 5 (default value).

A can be a 2-D array or an RGB image. If A is an RGB image, hybrid median filtering is performed in the HSV color space.
 
Notes
------
1) N must be odd. If N is even then N is incremented by 1.
2) The Image Processing Toolbox is required.
3) If the function NANMEDIAN exists (Statistics Toolbox), NaNs are treated as missing values and are ignored.
 
Example
--------
% original image
[I,map] = imread('trees.tif');
I = ind2rgb(I,map);
% noisy image
J = imnoise(I,'salt & pepper',0.02);
% hybrid median filtering
K = hmf(J,9);
% figures
subplot(121),imshow(J),subplot(122),imshow(K)

------
Other examples are given in:
http://www.biomecardio.com/matlab/hmf.html
-----

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
03 Feb 2010 Michael

A very straight forward and easy to use file. I used this on a disparity image from a pair of stereo cameras with clean results.

Please login to add a comment or rating.
Updates
25 Feb 2010

Test for RGB has been improved. RGB output and input have same class.

Tag Activity for this File
Tag Applied By Date/Time
image processing Damien Garcia 13 Nov 2009 11:38:32

Contact us at files@mathworks.com