Python numpy ValueError: setting an array element with a sequence.

ValueError: setting an array element with a sequence.

两个矩阵没有对齐

p[x, y] = img[i, j]

p的shape是(256, 256)
img的shape是(256, 256, 3)

将img截取成(256, 256)

image = img[:,:,0]
#深复制
image = np.copy(img[:,:,0])

你可能感兴趣的:(python)