title: Creating "holey" median filter in Matlab
body: <p>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. </p>
  
  <p>For standard median filter I use the <code>medfilt2</code> function, but I can't pass the mask (kernel) for it as a matrix (it's not a linear transform).<br>
  For example, using standard averaging filter 3x3 I create the mask (kernel) as:</p>
  
  <pre><code>h = ones(3,3)/9;
  </code></pre>
  
  <p>And for "holey" averaging filter:</p>
  
  <pre><code>h = ones(3,3)/8;
  h(2,2) = 0;
  </code></pre>
  
  <p>How to do the same thing with median filter? Is there any way to modify the <code>medfilt2</code> or do I need to implement a running median on my own? </p>