The C interface for medfilt. More...

afError af_medfilt_B (char *d_out, unsigned m, unsigned n, const char *d_in, const unsigned *h_W)
 Median filtering of a matrix using the specified window (or a 3 x 3 default window). More...
 
afError af_medfilt_c (unsigned char *d_out, unsigned m, unsigned n, const unsigned char *d_in, const unsigned *h_W)
 Medfilt: 8-bit unsigned int. More...
 
afError af_medfilt_I (int *d_out, unsigned m, unsigned n, const int *d_in, const unsigned *h_W)
 Medfilt: int data. More...
 
afError af_medfilt_U (unsigned *d_out, unsigned m, unsigned n, const unsigned *d_in, const unsigned *h_W)
 Medfilt: unsigned int data. More...
 
afError af_medfilt_S (float *d_out, unsigned m, unsigned n, const float *d_in, const unsigned *h_W)
 Medfilt: single-precision data. More...
 
afError af_medfilt_D (double *d_out, unsigned m, unsigned n, const double *d_in, const unsigned *h_W)
 Medfilt: double-precision data. More...
 

Detailed Description

The C interface for medfilt.

Apply a median filter of a given size to an image. 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.

For instance, if we apply a median filter to an simple sequential image:

array = array(seq(1,16), 4, 4);
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
print(medfilt(a, 3, 3));
// 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

This example highlights that pixels outside the image are treated as zeros. So, for the first pixel, the neighborhood looks like:

0 0 0
0 1 5
0 2 6

the median of which is zero.

Function Documentation

afError af_medfilt_B ( char *  d_out,
unsigned  m,
unsigned  n,
const char *  d_in,
const unsigned *  h_W 
)

Median filtering of a matrix using the specified window (or a 3 x 3 default window).

Parameters
[out]d_outOutput buffer to hold the filtered result
[in]d_inInput buffer containing matrix to be filtered
[in]mNumber of rows in input matrix
[in]nNumber of columns in input matrix
[in]h_W2x1 Vector specifying window dimensions to be usedMedfilt: Binary input
afError af_medfilt_c ( unsigned char *  d_out,
unsigned  m,
unsigned  n,
const unsigned char *  d_in,
const unsigned *  h_W 
)

Medfilt: 8-bit unsigned int.

afError af_medfilt_I ( int *  d_out,
unsigned  m,
unsigned  n,
const int *  d_in,
const unsigned *  h_W 
)

Medfilt: int data.

afError af_medfilt_U ( unsigned *  d_out,
unsigned  m,
unsigned  n,
const unsigned *  d_in,
const unsigned *  h_W 
)

Medfilt: unsigned int data.

afError af_medfilt_S ( float *  d_out,
unsigned  m,
unsigned  n,
const float *  d_in,
const unsigned *  h_W 
)

Medfilt: single-precision data.

afError af_medfilt_D ( double *  d_out,
unsigned  m,
unsigned  n,
const double *  d_in,
const unsigned *  h_W 
)

Medfilt: double-precision data.