numpy.padについて ref: https://qiita.com/naivete5656/items/3613ac106b1eb71aaf4a
import numpy as np
img=np.asarray([[1,2,3],[4,5,6],[7,8,9]])
print(np.pad(img,((0,0),(1,1)),'constant',constant_values=0))
print(np.pad(img,((1,1),(0,0)),'constant',constant_values=0))
print(np.pad(img,1,'constant',constant_values=0))
[[0 1 2 3 0]
[0 4 5 6 0]
[0 7 8 9 0]]
[[0 0 0]
[1 2 3]
[4 5 6]
[7 8 9]
[0 0 0]]
[[0 0 0 0 0]
[0 1 2 3 0]
[0 4 5 6 0]
[0 7 8 9 0]
[0 0 0 0 0]]