Filtering functions described in this section perform neighborhood
operations. They operate on the assumption that for each pixel to be processed, all
neighborhood pixels required for the operation are also available.
The neighborhood for each given pixel is defined by the filter kernel (or
mask) size and anchor cell position. For more information about anchors and how to define the
anchor cell position refer to Neighborhood Operations
As the following figure illustrates, if the input pixel is near the
horizontal or vertical edge of the image, the overlaid kernel may refer to neighborhood pixels
that do not exist within the source image and are located outside the image area.
The set of all boundary source image pixels that require such
non-existent pixels to complete the neighborhood operation for the given kernel and anchor is
shaded yellow, while the collection of all scanned external pixels (called border
pixels) is shaded gray.
If you want to apply some filtering operation to the whole source image,
you must figure out what additional border pixels are required for the operation, and define
these non-existent pixels. To do this, you can use the Intel IPP functions
, which fill the border of
the extended image with the pixel values that you define, or you can apply your own extension
If the required border
pixels are not defined prior to the filtering function call, you may get memory violation
If you want to apply the filtering operation to the part of the source
image, or ROI, then the necessity of extending the image area with border pixels depends on
the ROI size and position within the image. The figure below shows that if ROI does not cover
yellow (internal boundary) pixels, then no external pixels are scanned, and border extension
is not required.
If boundary pixels are part of ROI, you still need to extend some area of
the source image.
To provide valid results of filtering operations, the application must
check the following:
ROI parameters passed to
the filtering function have such values
All required neighborhood
pixels actually exist in the image and define the missing pixels when necessary.