np.concatenate不会串联

时间:2019-11-01 11:08:13

标签: python numpy numpy-ndarray

我正在尝试将这两个矩阵“ Y”和“ I”连接起来,但我不明白这是怎么回事。 我拍了一张黑白图像,得到了矩阵“ Y”,“ I”和“ Q”,并对它们的值做了一些更改,并希望使用“ np.concatenate()”将它们放回一起:

*Running Windows Runtime device detection.
No winrtrunner.exe found.
Running Windows Runtime device detection.
No winrtrunner.exe found.
Running Windows Runtime device detection.
No winrtrunner.exe found.
Running "C:\Program Files\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{8cd95c25-ccf7-4bd3-92e3-6efb4a56f1b5}" --experimental" in D:\build-tudatBundle-Desktop-Release.
Starting to parse CMake project.
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:21 (project):
  The CMAKE_CXX_COMPILER:
    D:/Qt/bin/clang/bin/clang.exe
  is not a full path to an existing compiler tool.
  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.
Configuring incomplete, errors occurred!
See also "D:/build-tudatBundle-Desktop-Release/CMakeFiles/CMakeOutput.log".
See also "D:/build-tudatBundle-Desktop-Release/CMakeFiles/CMakeError.log".
CMake Deprecation Warning:
  The 'cmake-server(7)' is deprecated.  Please port clients to use the
  'cmake-file-api(7)' instead.
CMake Project parsing failed.*

我得到的错误是:

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)

在这种情况下,有人知道这个错误是什么意思吗? 谢谢

1 个答案:

答案 0 :(得分:1)

np.concatenate()的第一个参数是一个序列:

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

请参阅:https://docs.scipy.org/doc/numpy/reference/generated/numpy.concatenate.html