utils.padding

Functions:

upperPowerOfTwo(v) Return the upper power of two of input value
replicatePadImage(im, marg0, marg1) Pad the input image by replicating first and last column as well as first and last row the specified number of times.
zeroPadImage(im, marg0, marg1) Pad the input image by adding zeros.
padImage(im, n_pad0, n_pad1) Replicate pad the input image to the specified new dimensions.
padSmoothWidth(im, n_pad) Pad the input image to the specified new width by replicate padding with Hanning smoothing to zero.
stp_core.utils.padding.padImage(im, n_pad0, n_pad1)[source]

Replicate pad the input image to the specified new dimensions.

Parameters:
  • im (array_like) – Image data as numpy array
  • n_pad0 (int) – The new height of the image
  • n_pad1 (int) – The new width of the image
  • Return value
  • ———-
  • A padded image
stp_core.utils.padding.padSmoothWidth(im, n_pad)[source]

Pad the input image to the specified new width by replicate padding with Hanning smoothing to zero.

Parameters:
  • im (array_like) – Image data as numpy array.
  • n_pad (int) – The new width of the image.
  • Return value
  • ———-
  • A padded image
stp_core.utils.padding.replicatePadImage(im, marg0, marg1)[source]
Pad the input image by replicating first and last column as well as first and last row
the specified number of times.
Parameters:
  • im (array_like) – Image data as numpy array.
  • marg0 (int) – The number of times first and last row have to be replicated.
  • marg1 (int) – The number of times first and last column have to be replicated.
  • Return value
  • ———-
  • A replicated-padded image.
stp_core.utils.padding.upperPowerOfTwo(v)[source]

Return the upper power of two of input value

Parameters:
  • v (int) – A positive integer value
  • Return value
  • ———-
  • An integer value
stp_core.utils.padding.zeroPadImage(im, marg0, marg1)[source]

Pad the input image by adding zeros.

Parameters:
  • im (array_like) – Image data as numpy array.
  • marg0 (int) – The number of zero rows to add before first and after last row.
  • marg1 (int) – The number of zero rows to add before first and after last column.
  • Return value
  • ———-
  • A zero-padded image.