ValueError:无法将形状(1120,1472,4)的输入数组广播为形状(3000,3000)

时间:2016-11-18 07:23:18

标签: arrays python-2.7 numpy image-processing numpy-broadcasting

我有一个有形状的图像(1120,1472,4),我正在尝试将此更改为(3000,3000,4)我编写的代码就是这样。

pad_shape = (3000, 3000)
i = np.array('test.tif')
result = np.zeros(pad_shape,dtype=int)
result[:i.shape[0], :i.shape[1]] = i
print(result)

生成

ValueError: could not broadcast input array from shape (1120, 1472, 4) into shape (3000, 3000)

1 个答案:

答案 0 :(得分:0)

这是答案

lblDiscountAmount.Caption = "$" + dblVisits.ToString
Me.refresh

x和y变量用于填充。您因填充而收到的错误。