Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 3/22/2024
Public
Document Table of Contents

FilterMedianColor

Filters an image using a color median filter.

Syntax

IppStatus ippiFilterMedianColor_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize dstRoiSize, IppiMaskSize mask);

Supported values for mod:

8u_C3R 16s_C3R 32f_C3R
8u_AC4R 16s_AC4R 32f_AC4R

Include Files

ippi.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

dstRoiSize

Size of the source and destination ROI in pixels.

mask

Predefined mask of the IppiMaskSize type.

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

When applied to a color image, the previously described median filtering functions process color planes of an image separately, and as a result any correlation between color components is lost. If you want to preserve this information, use the ippiFilterMedianColor function instead. For each input pixel, this function computes differences between red (R), green (G), and blue (B) color components of pixels in the mask neighborhood and the input pixel. The distance between the input pixel i and the neighborhood pixel j is formed as the sum of absolute values:

abs (R(i)-R(j)) + abs (G(i)-G(j)) + abs (B(i)-B(j))

After scanning the entire neighborhood, the function sets the output value for pixel i as the value of the neighborhood pixel with the smallest distance to i.

The function ippiFilterMedianColor supports square masks of size either ippMskSize3x3 or ippMskSize5x5 and processes color images only. To ensure valid operation when image boundary pixels are processed, the application should correctly define additional border pixels (see Borders in Neighborhood Operations).

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error or a warning.

ippStsNullPtrErr

Indicates an error if pSrc or pDst is NULL.

ippStsSizeErr

Indicates an error if dstRoiSize has a field with a zero or negative value.

ippStsStepErr

Indicates an error if srcStep or dstStep has a zero or negative value.

ippStsMaskSizeErr

Indicates an error if mask has an illegal value.