You need to implement the following function:
void mf(int ny, int nx, int hy, int hx, const float* in, float* out)
out are pointers to
float arrays, each of them contains
ny*nx elements (these will be floating point numbers between 0.0 and 1.0). The arrays are already allocated by whoever calls this function; you do not need to do any memory management.
The original value of pixel (x,y) is given in
in[x + nx*y] and its new value will be stored in
out[x + nx*y].
In the output, pixel (x,y) will contain the median of all pixels with coordinates (i,j) where
0 <= i < nx,
0 <= j < ny,
x - hx <= i <= x + hx,
y - hy <= j <= y + hy.
This is the sliding window. Note that the window will contain at most
(2*hx+1) * (2*hy+1) pixels, but near the boundaries there will be fewer pixels.
For our purposes, the median of the vector a = (a1, a2, …, an) is defined as follows: