FilterMedian

Computes median values for each source vector element.

Syntax

IppStatus ippsFilterMedian_8u(const Ipp8u* pSrc, Ipp8u* pDst, int len, int maskSize);

IppStatus ippsFilterMedian_16s(const Ipp16s* pSrc, Ipp16s* pDst, int len, int maskSize);

IppStatus ippsFilterMedian_32s(const Ipp32s* pSrc, Ipp32s* pDst, int len, int maskSize);

IppStatus ippsFilterMedian_32f(const Ipp32f* pSrc, Ipp32f* pDst, int len, int maskSize);

IppStatus ippsFilterMedian_64f(const Ipp64f* pSrc, Ipp64f* pDst, int len, int maskSize);

IppStatus ippsFilterMedian_8u_I(Ipp8u* pSrcDst, int len, int maskSize);

IppStatus ippsFilterMedian_16s_I(Ipp16s* pSrcDst, int len, int maskSize);

IppStatus ippsFilterMedian_32s_I(Ipp32s* pSrcDst, int len, int maskSize);

IppStatus ippsFilterMedian_32f_I(Ipp32f* pSrcDst, int len, int maskSize);

IppStatus ippsFilterMedian_64f_I(Ipp64f* pSrcDst, int len, int maskSize);

Parameters

pSrcDst

Pointer to the source and destination vector (for the in-place operation).

pSrc

Pointer to the source vector.

pDst

Pointer to the destination vector.

len

Number of elements in the vector.

maskSize

Median mask size, must be a positive integer. If an even value is specified, the function subtracts 1 and uses the odd value of the filter mask for median filtering.

Description

The function ippsFilterMedian is declared in the ipps.h file. This function computes median values for each element of the source vector pSrc or pSrcDst, and stores the result in pDst or pSrcDst, respectively.

Note iconNote

The value of a non-existent point is equal to the last point value, for example: x[- 1]=x[0], or x[len] = x [len - 1].

The example below illustrates using ippsFilterMedian_16s_I for single-rate filtering.

Return Values

ippStsNoErr

Indicates no error.

ippStsNullPtrErr

Indicates an error when one of the pointers is NULL.

ippStsSizeErr

Indicates an error when len is less than or equal to 0.

ippStsEvenMedianMaskSize

Indicates a warning when the median mask length is even.

Single-Rate Filtering with the ippsFilterMedian Function

void median(void) {
      Ipp16s x[8] = {1,2,127,4,5,0,7,8};
      IppStatus status = ippsFilterMedian_16s_I(x, 8, 3);
      printf_16s(“median =”, x,8, status);
}
Output: 
    median =  1 2 4 5 4 5 7 8
Matlab* Analog: 
    >> x = [1 2 127 4 5 0 7 8]; medfilt1(x)

Submit feedback on this help topic

Copyright © 2000 - 2010, Intel Corporation. All rights reserved.