Median filtering
Median filtering is particularly useful to reduce speckle and salt and pepper noises. Its edge-preserving nature makes it useful in cases where edge blurring is undesirable.
B = MEDFILT3(A,[M N P]) performs median filtering of the 3-D array A. Each output pixel contains the median value in the M-by-N-by-P neighborhood around the corresponding pixel in the input array.
B = MEDFILT3(A,[M N]) performs median filtering of the matrix A.
B = MEDFILT3(A,M) performs median filtering of the vector A.
B = MEDFILT3(A) performs median filtering using a 3 or 3x3 or 3x3x3 neighborhood according to the size of A.