Padding

Padding
is an option to various array and image operations that specifies what padding to use when extending beyond the original data specified.

DetailsDetails

  • Typical settings for Padding include:
  • cpad with the expression c
    "Fixed"repetitions of the elements on each boundary
    "Periodic"cyclic repetitions of the complete array
    "Reflected"reflections of the array in the boundary
    "Reversed"reversals of the complete array
    Nonedo no padding
  • For a 2D array, indicates that the rectangle of elements added at each corner should be copies of the elements at the corners of the original array.
  • indicates that the outermost layer of elements in the array should be repeated as the innermost layer of elements in the padding. specifies that these elements should not be repeated.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Image convolution with a Gaussian, taking pixel values outside the image to be yellow:

In[1]:=
Click for copyable input
Out[1]=
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »