我可以通过堆叠3个np.zeros([1,1,1])来生成所有黑色像素
但是为什么不呢?
import numpy as np
import cv2
m = np.zeros([8,32,1])
k = 0
for i in range(m.shape[0]):
for j in range(m.shape[1]):
for z in range(m.shape[2]):
m[i,j,z] = k
k+=1
a = np.stack(m,m,m)
cv2.imwrite('rgb.png',a)
axis = normalize_axis_index(axis, result_ndim)
TypeError: only size-1 arrays can be converted to Python scalars