A high-performance general-purpose compute library

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 array medfilt1 (const array &in, const dim_t wind_width=3, const borderType edge_pad=AF_PAD_ZERO)
 C++ Interface for median filter. More...
 
AFAPI array medfilt2 (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...
 
AFAPI af_err af_medfilt1 (af_array *out, const af_array in, const dim_t wind_width, const af_border_type edge_pad)
 C Interface for 1D median filter. More...
 
AFAPI af_err af_medfilt2 (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

◆ af_medfilt()

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.

◆ af_medfilt1()

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

C Interface for 1D median filter.

Parameters
[out]outarray is the processed signal
[in]inarray is the input signal
[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.

◆ af_medfilt2()

AFAPI af_err af_medfilt2 ( 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.

◆ medfilt()

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.

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 = 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
A multi dimensional data container.
Definition: array.h:37
@ AF_PAD_ZERO
Out of bound values are 0.
Definition: defines.h:270
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.
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

◆ medfilt1()

AFAPI array medfilt1 ( const array in,
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 = 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 signal
[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 signal

◆ medfilt2()

AFAPI array medfilt2 ( 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 = 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