python 实现单通道转3通道

python 实现单通道转3通道,第1张

python 实现单通道转3通道

下面有两种方法都可以:

import numpy as np
a=np.asarray([[10,20],[101,201]])

# a=a[:,:,np.newaxis]
# print(a.shape)
# b= a.repeat([3],axis=2)
# print(b.shape,b)

image = np.expand_dims(a, axis=2)
image = np.concatenate((image, image, image), axis=-1)

print(image)
axis=-1就是最后一个通道

以上这篇python 实现单通道转3通道就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持考高分网。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zaji/3247586.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-10-04
下一篇2022-10-04

发表评论

登录后才能评论

评论列表(0条)

    保存