python 实现单通道转3通道
作者:ShellCollector 时间:2021-09-12 22:03:25
下面有两种方法都可以:
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就是最后一个通道
来源:https://blog.csdn.net/jacke121/article/details/80086866
标签:python,单通道,3通道
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
DjangoRestFramework 使用 simpleJWT 登陆认证完整记录
2021-03-29 18:34:12
![](https://img.aspxhome.com/file/2023/1/76001_0s.png)
python实现自动更换ip的方法
2023-06-16 21:43:06
Anaconda使用IDLE的实现示例
2023-05-09 10:40:39
![](https://img.aspxhome.com/file/2023/0/99650_0s.png)
使用Pyparsing处理复杂文本实现过程
2023-03-21 13:37:44
基于Python实现二维图像双线性插值
2023-08-13 07:46:45
![](https://img.aspxhome.com/file/2023/4/61984_0s.png)
两个命令把 Vim 打造成 Python IDE的方法
2022-01-20 09:31:31
![](https://img.aspxhome.com/file/2023/9/65079_0s.jpg)
解决在Dreamweaver中不支持中文文件名的方法
2010-09-02 12:35:00
Python使用OpenCV对图像进行缩放功能
2022-05-06 03:47:51
![](https://img.aspxhome.com/file/2023/7/71357_0s.jpg)
Python线程创建和终止实例代码
2022-06-29 11:01:34
python调用matplotlib模块绘制柱状图
2024-01-02 04:35:16
PJBlog3优化——301定向跳转解决重复内容的问题
2009-05-20 10:40:00
一文带你了解Python中的字符串是什么
2021-10-16 06:05:27
![](https://img.aspxhome.com/file/2023/7/88987_0s.png)
Python使用reportlab将目录下所有的文本文件打印成pdf的方法
2022-01-23 11:36:11
对python while循环和双重循环的实例详解
2021-01-17 22:22:59
使用遗传算法求二元函数的最小值
2022-07-29 09:13:37
![](https://img.aspxhome.com/file/2023/5/93775_0s.jpg)
Python对口红进行数据分析来选定情人节礼物
2022-01-23 07:38:08
![](https://img.aspxhome.com/file/2023/5/103365_0s.jpg)
python数据类型_元组、字典常用操作方法(介绍)
2021-06-22 14:06:05
仿淘宝星级评分效果
2010-09-03 18:37:00
php用header函数实现301跳转代码实例
2023-10-08 11:29:59
python实现任意位置文件分割的实例
2021-01-17 18:18:22