我试图将这两个矩阵'Y‘和'I’连接起来,但我不明白哪里出了问题。我拍摄了一张黑白图像,得到了矩阵'Y','I‘和'Q',对它们的值做了一些更改,并希望使用’np.concatenate()‘将它们重新组合在一起:
Y = imYIQ[:, :, 0]
I = imYIQ[:, :, 1]
Q = imYIQ[:, :, 2]
normalized_Y = np.true_divide(Y, np.max(Y))
# Normalizes to [0, 1], stretches to [0, 2] and moves to the left to [-1, 1] both of 'I' and 'Q'
normalized_I = np.subtract(np.multiply(np.true_divide(I, np.max(I)), 2), 1)
normalized_Q = np.subtract(np.multiply(np.true_divide(Q, np.max(I)), 2), 1)
# Code crashes here:
concatenatedYI = np.concatenate(normalized_Y, normalized_I, axis=0)我得到的错误是:
TypeError: only integer scalar arrays can be converted to a scalar index有没有人理解这个错误在这个上下文中是什么意思?谢谢
发布于 2019-11-01 19:09:51
np.concatenate()的第一个参数是一个序列:
np.concatenate([normalized_Y, normalized_I], axis=0)
请参阅:https://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html
https://stackoverflow.com/questions/58658206
复制相似问题