<< medfilt2 Image_Processing_Tool_3 pdist >>

Image_Processing_Tool_3 >> Image_Processing_Tool_3 > padding

padding

Pads the border of an image matrix

Calling Sequence

y = padding(x)
y = padding(x,sz)
y = padding(x,sz,opt)

Parameters

x

A matrix representing an image.

sz

A two element array representing the widths of the horizontal and the vertical borders to be padded.

opt

A character constant which indicates the mode of padding options.

y

A matrix representing the padded matrix.

Description

It pads an image matrix or simply a matrix with certain elements. If only the image matrix is given as itput, the image matrix is padded with zeros of width 1. The desired horizontal and vertical border widths can be specified in second input parameter as two element vector. The third input parameter specifies padding options. The valid options for the third parameter opt are 'z' for zeros 'o' for padding with ones 'p' for periodic padding 'm' for padding with median 'n' for padding with Nans '-' for padding with the minimum value '+' for padding with the maximum value. The size of the output matrix is greater than the size of the imput matrix by the border padded.

Examples

x=testmatrix('magic',8);
//Padding with zeros 
y1=padding(x)
y2=padding(x,[3 2])
// Periodic padding
y3=padding(x,'p')
// padding with median
y4=padding(x,'m')

See Also

Authors

<< medfilt2 Image_Processing_Tool_3 pdist >>