May 31 2007
Effecient Sorting Algorithm For Applying Median Filter to a Image
Normally median filters are applied to remove speckle noises in an Image. There are many variations of Median Filters but all these variations are for choosing the kernel dimensions and shape. What i mean by kernel is that it could be a 3X3 kernel or 5X4 kernel or a radius 3 kernel.
A 3×3 kernal will have 9 elements to sort
A 5X5 kernal will have 25 elements to sort
A radius 3 kernel will have 29 elements to be sorted before you can pick the median.
Bottom line is you choose any variations of kernals, it boils down to effeciency of sorting. I have come up a one such algorithm that i think is very effecient for Median Filtering
Assumptions:
- RGB Planar data. The bit depth Per pixel is 8 bits.
- Median Filter Kernel size is Odd Number. Like 5, 9, 25 etc
- The following code is PseuodCode and good for one dimensional data.
A pseudo Code implementation of the Algorithm is shown below:
Comments Off