本文简要介绍 python 语言中  numpy.dstack  的用法。
- 用法:- numpy.dstack(tup)
- 按顺序深度(沿第三轴)堆叠数组。 - 这相当于在二维形状数组之后沿第三轴串联(M,N)已被重塑为(M,N,1)和一维形状数组(N,)已被重塑为(1,N,1)。重建数组除以numpy.dsplit. - 此函数对最多 3 维的数组最有意义。例如,对于具有高度(第一轴)、宽度(第二轴)和 r/g/b 通道(第三轴)的 pixel-data。函数 - concatenate、- stack和- block提供更通用的堆叠和连接操作。- tup: 数组序列
- 除了第三个轴之外,阵列必须具有相同的形状。一维或二维数组必须具有相同的形状。 
 
- stacked: ndarray
- 通过堆叠给定数组形成的数组将至少是 3D 的。 
 
 - 参数:- 返回:- 例子:- >>> a = np.array((1,2,3)) >>> b = np.array((2,3,4)) >>> np.dstack((a,b)) array([[[1, 2], [2, 3], [3, 4]]])- >>> a = np.array([[1],[2],[3]]) >>> b = np.array([[2],[3],[4]]) >>> np.dstack((a,b)) array([[[1, 2]], [[2, 3]], [[3, 4]]])
相关用法
- Python numpy dsplit用法及代码示例
- Python numpy dtype.isbuiltin用法及代码示例
- Python numpy dtype.shape用法及代码示例
- Python numpy dtype.ndim用法及代码示例
- Python numpy dtype.alignment用法及代码示例
- Python numpy diagonal用法及代码示例
- Python numpy dtype用法及代码示例
- Python numpy dtype.names用法及代码示例
- Python numpy dtype.__class_getitem__用法及代码示例
- Python numpy divmod用法及代码示例
- Python numpy dtype.flags用法及代码示例
- Python numpy diagflat用法及代码示例
- Python numpy dtype.fields用法及代码示例
- Python numpy dtype.subdtype用法及代码示例
- Python numpy delete用法及代码示例
- Python numpy dtype.descr用法及代码示例
- Python numpy dec.setastest用法及代码示例
- Python numpy datetime_as_string用法及代码示例
- Python numpy divide用法及代码示例
- Python numpy dtype.kind用法及代码示例
- Python numpy dtype.metadata用法及代码示例
- Python numpy diag用法及代码示例
- Python numpy dec.slow用法及代码示例
- Python numpy dtype.newbyteorder用法及代码示例
- Python numpy digitize用法及代码示例
注:本文由纯净天空筛选整理自numpy.org大神的英文原创作品 numpy.dstack。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
