我正在使用pylibtiff来读取带有get_samples函数的图像。 错误是:
arr[i:i + xxx] = d ValueError: could not broadcast input array from shape (1360) into shape (1347)
我修改了错误点附近的代码以找到错误:
if compression == 1: # none
d = self.data[start:end]
elif compression == 5: # lzw
d = self.data[start:end]
d = tif_lzw.decode(d, bytes_per_strip)
print(compression, d, d.shape, d.nbytes, i, i + d.nbytes)
print(d.nbytes, arr[i:i + d.nbytes].shape)
arr[i:i + d.nbytes] = d
i += d.nbytes
然而我仍然得到了结果:
5 [0 0 0 ..., 0 0 0] (1360,) 1360 82305853 82307213
1360 (1347,)
怎么可能呢? d.nbytes是1360,是82305853,i + d.nbytes = 82307213. 1347来自哪里?