machinevisiontoolbox.Image.pad
- Image.pad(left=0, right=0, top=0, bottom=0, value=0)
Pad the edges of the image
- Parameters:
left (int, optional) – number of pixels to pad on left side of image, defaults to 0
right (int, optional) – number of pixels to pad on right side of image, defaults to 0
top (int, optional) – number of pixels to pad on top side of image, defaults to 0
bottom (int, optional) – number of pixels to pad on bottom side of image, defaults to 0
value (scalar, str, array_like) – value of pixels to pad with
- Returns:
padded image
- Return type:
Image
Pad the edges of the image with pixels equal to
value
.Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read('flowers1.png', dtype='float') >>> img Image: 640 x 426 (float32), R:G:B [.../images/flowers1.png] >>> img.pad(left=10, bottom=10, top=10, right=10, value='r') Image: 660 x 446 (float32), R:G:B
(
Source code
,png
,hires.png
,pdf
)