Creating "holey" median filter in Matlab
filtering, image-processing, matlab
Solution
What about using the underlying function `ordfilt2` and defining your own domain there?
https://www.mathworks.com/help/images/ref/ordfilt2.html
Problem
What I need to do is to create a "special" kind of median filter for image processing in Matlab - the "holey" median filter. This is a filter that excludes the element at the center of the area. For standard median filter I use the `medfilt2` function, but I can't pass the mask (kernel) for it as a matrix (it's not a linear transform). For example, using standard averaging filter 3x3 I create the mask (kernel) as: ``` h = ones(3,3)/9; ``` And for "holey" averaging filter: ``` h = ones(3,3)/8; h(2,2) = 0; ``` How to do the same thing with median filter? Is there any way to modify the `medfilt2` or do I need to implement a running median on my own?