stack np arrays code example
Example 1: np.stack
>>> a = np.array([1, 2, 3])
>>> b = np.array([2, 3, 4])
>>> np.stack((a, b))
array([[1, 2, 3],
[2, 3, 4]])
Example 2: np.stack
>>> np.stack((a, b), axis=-1)
array([[1, 2],
[2, 3],
[3, 4]])
Example 3: numpy stack in new dimension
np.stack((R_mat, G_mat, B_mat), axis = 2)
# identify any new dimension as you like