pad_to_shape#
- stimupy.utils.pad.pad_to_shape(img, shape, pad_value=0)#
Pad image to a resulting specified shape in pixels
- Parameters:
img (numpy.ndarray) – image-array to be padded
shape (Sequence[int, int, ...]) – desired shape of img after padding
pad_value (float, optional) – value to pad with, by default 0.0
- Returns:
img padded to specified shape
- Return type:
- Raises:
ValueError – if img.shape already exceeds shape