代码验证:
import numpy as np
#
img = np.arange(4).reshape((2,2))
print(img)
ones = np.ones((2,2))
#%%
print(np.kron(img,ones))
结果:
img:
[[0 1] [2 3]]
np.kron [[0. 0. 1. 1.] [0. 0. 1. 1.] [2. 2. 3. 3.] [2. 2. 3. 3.]]
代码验证:
import numpy as np
#
img = np.arange(4).reshape((2,2))
print(img)
ones = np.ones((2,2))
#%%
print(np.kron(img,ones))
结果:
img:
[[0 1] [2 3]]
np.kron [[0. 0. 1. 1.] [0. 0. 1. 1.] [2. 2. 3. 3.] [2. 2. 3. 3.]]