Median Filter. More...

Functions

AFAPI array medfilt (const array &in, const dim_t wind_length=3, const dim_t wind_width=3, const borderType edge_pad=AF_PAD_ZERO)
 C++ Interface for median filter. More...
 
AFAPI af_err af_medfilt (af_array *out, const af_array in, const dim_t wind_length, const dim_t wind_width, const af_border_type edge_pad)
 C Interface for median filter. More...
 

Detailed Description

Median Filter.

A median filter is similar to the arbitrary filter except that instead of a weighted sum, the median value of the pixels covered by the kernel is returned.


Function Documentation

AFAPI af_err af_medfilt ( af_array out,
const af_array  in,
const dim_t  wind_length,
const dim_t  wind_width,
const af_border_type  edge_pad 
)

C Interface for median filter.

Parameters
[out]outarray is the processed image
[in]inarray is the input image
[in]wind_lengthis the kernel height
[in]wind_widthis the kernel width
[in]edge_padvalue will decide what happens to border when running filter in their neighborhood. It takes one of the values [AF_PAD_ZERO | AF_PAD_SYM]
Returns
AF_SUCCESS if the median filter is applied successfully, otherwise an appropriate error code is returned.
AFAPI array af::medfilt ( const array in,
const dim_t  wind_length = 3,
const dim_t  wind_width = 3,
const borderType  edge_pad = AF_PAD_ZERO 
)

C++ Interface for median filter.

array a = array(4, 4, input);
//af_print(a);
//a = 1.0000 5.0000 9.0000 13.0000
// 2.0000 6.0000 10.0000 14.0000
// 3.0000 7.0000 11.0000 15.0000
// 4.0000 8.0000 12.0000 16.0000
array b = af::medfilt(a, 3, 3, AF_PAD_ZERO);
//af_print(b);
//b= 0.0000 2.0000 6.0000 0.0000
// 2.0000 6.0000 10.0000 10.0000
// 3.0000 7.0000 11.0000 11.0000
// 0.0000 4.0000 8.0000 0.0000
Parameters
[in]inarray is the input image
[in]wind_lengthis the kernel height
[in]wind_widthis the kernel width
[in]edge_padvalue will decide what happens to border when running filter in their neighborhood. It takes one of the values [AF_PAD_ZERO | AF_PAD_SYM]
Returns
the processed image
Examples:
image_processing/adaptive_thresholding.cpp, and image_processing/filters.cpp.