Developer Reference for Intel® Integrated Performance Primitives

User-defined Border Types

Some of the Intel® IPP image processing functions operate on user-defined border types. It means that the values of border pixels are assigned in accordance with the borderType (or border) and borderValue parameters.

Intel® IPP supports the following border types:

Constant Border

This type of border corresponds to the ippBorderConst value in the IppiBorderType enumerator. When using a constant border, values for all border pixels are set to the constant value that you specify in the borderValue parameter. In the figure below, this constant value is marked as V. Squares marked in red correspond to pixels copied from the source image ROI.



Replicated Border

This type of border corresponds to the ippBorderRepl value in the IppiBorderType enumerator. When using a replicated border, values for border pixels are obtained from the source image boundary pixels, as shown in the figure below. Squares marked in red correspond to pixels copied from the source image ROI. Squares with green values correspond to border pixels, which are replicated from the boundary pixels of the source image.



Mirrored Border

This type of border corresponds to the ippBorderMirror value in the IppiBorderType enumerator. When using a mirrored border, values for border pixels are obtained from the source image boundary pixels, as shown in the figure below. Squares marked in red correspond to pixels copied from the source image ROI. Squares with green values correspond to border pixels, which are mirrored from the source image pixels.



Mirrored Border with Replication

This type of border corresponds to the ippBorderMirrorR value in the IppiBorderType enumerator. When using a mirrored border with replication, values for border pixels are obtained from the source image boundary pixels, as shown in the figure below. Squares marked in red correspond to pixels copied from the source image ROI. Squares with green values correspond to border pixels, which are mirrored from the source image pixels. The difference of this border type from the mirrored border is that the anchor cell value is replicated to the border pixels.



Border in Memory

This type of border corresponds to the ippBorderInMem value and its flags combinations in the IppiBorderType enumerator. Use this border type if the ROI does not cover internal border pixels of the source image. In this case, values for border pixels are obtained from the source image pixels in memory. In the figure below, squares marked in red correspond to pixels copied from the source image ROI. Squares with black values correspond to source image pixels in memory.



Several Intel IPP filters operate in two or more stages. For example, the ippiMorphOpenBorder function performs filtering by applying the Erode and Dilate filters sequentially. You should note the following when setting borders for multistage filters:

Mixed Borders

You can use mixed borders by using a bitwise OR operation between one of the ippBorderRepl, ippBorderConst, ippBorderMirror, or ippBorderMirrorR types and any of the following border types: ippBorderInMemTop, ippBorderInMemBottom, ippBorderInMemLeft, ippBorderInMemRight, or ippBorderFirstStageInMem. In this case, values for border pixels are obtained from the source image pixels in memory in the direction specified by the flag.

The figure below demonstrates the use of the ippBorderConst with the ippBorderInMemTop and ippBorderInMemRight borders. Squares marked in red correspond to pixels copied from the source image, that is the source image ROI. As you can see from the figure, top and right border pixels are obtained from the source image pixels in memory, while the rest of the border pixels are set to the constant value V.



Note

The combination of ippBorderInMem and its flags always has priority over any other border flags or types. For example, if you specify ippBorderFirstStageInMem|ippBorderRepl|ippBorderInMemLeft, the left border will use InMem mode for each stage and other borders will use InMem for the first stage and replication for remaining stages.

The figure below demonstrates the use of the ippBorderConst with the ippBorderInMemTop, ippBorderInMemRight, and ippBorderFirstStageInMem flags for two-stage filtering with one pixel border for both stages.



See Also