Median filter
Include <mln/morpho/median_filter.hpp>
-
void median_filter(Image image, StructuringElement se, BorderManager bm, OutputImage out)
-
Image{I}
image_concrete_t<I> median_filter(I image, StructuringElement se, BorderManager bm) The median filter is non-linear filter that assigns the median value in a given structuring element 𝐵.
\[g(x) = med(\{ f(y) \in \mathcal{B}_x) \})\]where med returns the median value of the set of pixels in the structuring element 𝑩 centered in 𝑥.
A border management may be used to manage border side-effects.
If the optional
output
image is provided, it must be wide enough to store the result (the function does not perform any resizing).
- Parameters:
ima – Input image 𝑓
se – Structuring element 𝐵
bm – Border manager policy
output (optional) – Output image
- Returns:
Nothing (the output image is passed as an argument)
An image whose type is deduced from the input image
- Exception:
N/A
Notes
Complexity
Example 1 : Median-filter by a square on a gray-level image
#include <mln/morpho/median_filter.hpp>
#include <mln/core/se/rect2d.hpp>
// Define a square SE of size 21x21
auto input = ...;
auto rect = mln::se::rect2d(21,21);
auto output = mln::morpho::median_filter(input, rect, mln::extension::mirror);