Given a set of real values , we define the median filter
of level *r*, for a
*r* [0, 1], by

Now, consider a set of shapes, for example the set of the ellipses of same area, and an original image *u*_{0}.
This program will compute the sequences of images *u*_{i} defined by

`-a`

option,
u_{i+1}(x) = |
med^{deginf}med^{degsup}{u_{i}(y + x), y B}, B + |
||

med^{degsup}med^{deginf}{u_{i}(y + x), y B}, B /2. |

In a mathematical viewpoint, when the area of the elements of tends
to zero, this scheme (with option `-a`

set)
computes a discretisation of an equation of type

= | *Du*| *G*(*Du*/| *Du*|, *curv*(*u*)), *qquadu*(*t* = 0) = *u*_{0}

For example, it has been proved that when is the set of
segments with same lenght (file `seg_mask`

), and centered into 0,
we have
And, in the same way, when is the sets of the ellipses, or
rectangles with same areas, also centered into 0,
*G*(*Du*/| *Du*|, *curv*(*u*)) = *curv*(*u*)^{}13.

At last, notice that when contains only one element then with
*deginf* = *degsup* = 0 we have the erosion, with
*deginf* = *degsup* = 1 we have the dilation, and with
*deginf* = *degsup* = 0.5 we have the median filter.