简体   繁体   中英

np.concatenate won't concatenate

I'm trying to concatenate those 2 matrices 'Y' and 'I' but I can't understand what's wrong. I took a black and white image and got the matrices 'Y', 'I' and 'Q', did some changes on the values of them and want to put them back together using '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)

The error that I get is:

TypeError: only integer scalar arrays can be converted to a scalar index

Does anyone understand what does this error mean in this context? Thank you

The first argument to np.concatenate() is a sequence:

np.concatenate([normalized_Y, normalized_I], axis=0)

See: https://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM