Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

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.

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:
  • If you set the
    ippBorderInMem
    value or its flags combinations, the function tries to access pixels outside of image borders to get border pixels for each filtering stage. For example, the
    ippiMorphOpenBorder
    function uses two stages and with 5x5 mask will access
    floor(5/2)*2=4
    pixels in each direction across the current ROI.
  • If you set
    ippBorderFirstStageInMem
    , the function tries to access
    floor(5/2)=2
    pixels outside of the image borders to get pixels for the first stage of filtering. The second filter will use one of the following border types to reconstruct image borders:
    ippBorderRepl
    ,
    ippBorderConst
    ,
    ippBorderMirror
    , or
    ippBorderMirrorR
    . To specify the border type for the second and next stages, use the bitwise
    OR
    operation between one of the listed above border types and
    ippBorderFirstStageInMem
    .

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
.
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.
  • First stage:
    squares marked in red correspond to pixels copied from the source image, which is the source image ROI, and squares marked in blue correspond to ROI assigned to the first stage filter. As you can see from the figure, the first stage enlarges ROI for top and right sides to consume more memory and provide valid pixels for the second stage memory border.
  • Second stage:
    red squares and blue pixels correspond to resulting pixels from the first stage filter. Blue pixels lie outside of the ROI providing border values for the second stage in top and right directions. Left and bottom border pixels use the constant value
    V
    in accordance with the border flags combination.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804