Specifications
Image Creation and Access
4-23
4
Image Borders and Image Tiling
Many neighborhood operators need intensity values for pixels that lie
outside the image, that is, outside the borders of the image. For example, a
3 by 3 filter, when operating on the first row of an image, needs to assume
pixel values of the preceding (non-existent) row. A larger filter will require
more rows from the border. These border issues therefore exist at the top
and bottom, left and right sides, and the four corners of the image. The
library provides a function iplSetBorderMode that the application can use
to set the border mode within the image. This function specifies the
behavior for handling border pixels.
For tiled images, the border mode is handled in the same way as for non-
tiled images. (Outer tiles might contain extra data if the image size is not
an integer multiple of the tile size, but these values are ignored and the
border mode is used instead.)
SetBorderMode
Sets the mode for handling
the border pixels.
void iplSetBorderMode(IplImage *
src
, int
mode
,
int
border
, int
constVal
)
src
The image for which the border mode is to be set.
mode
The following modes are supported:
IPL_BORDER_CONSTANT The value constVal is used for all
pixels.
IPL_BORDER_REPLICATE The last row or column is replicated for
the border.
IPL_BORDER_REFLECT The last rows or columns are reflected in
reverse order, as necessary to create the
border.