I understand that in the default 3 x 3 neighborhood, median filtering replaces every pixel with the median of its neighboring pixels. This is easy to visualize. But I don't quite understand how a matrix or an image is filtered 2x2 neighborhood. What exactly are the neighbors of a pixel in the 2x2 neighborhood? Take for instance a matrix [1 2;3 4] How does the filtering result in matrix [2.5 1;1.5 0]?
I've tried using medfilt2() with random matrices but I can't quite figure how it works