Border Modes

Some functions (such as filters) need pixel values in a certain neighborhood of an input pixel in order to compute the corresponding output pixel. If the pixel in question is close to the image border, some of the necessary neighborhood pixels are "missing" because they turn out to be outside the border. Values at these "missing" pixels can be reconstructed in different ways, depending on the current border mode.

You can set border modes by calling the function

void iplSetBorderMode(IplImage *src, int mode, int border, int constVal); 

The following border modes are supported in the library:
IPL_BORDER_CONSTANT A constant value is used for all "missing" pixels.
IPL_BORDER_REPLICATE The last row or column is replicated outside the border.
IPL_BORDER_REFLECT The last rows or columns are reflected in reverse order, as necessary to create the "missing" pixels.
IPL_BORDER_WRAP The "missing" rows or columns are taken from the opposite side of the image.

The border parameter specifies the image side to which the new mode applies; it can be one of the following: IPL_SIDE_LEFT, IPL_SIDE_RIGHT, IPL_SIDE_TOP, IPL_SIDE_BOTTOM, IPL_SIDE_ALL.

In the example on the next page, a filter is applied to an image with different border mode settings.

* Legal Information © 1998-2000, Intel Corporation