Numpy 将二维图像矩阵转换为一维向量的方法
作者:hg_zhh 时间:2022-09-21 03:11:01
以下的例子,将32x32的二维矩阵,装换成1x1024的向量
def image2vector (filename):
returnVect=zeros((1,1024))
f=open(filename)
for i in range (32):
lineStr =fr.readline()
for j in range (32):
returnVect[0,32*i*j]=int(lineStr[j])
return returnVect
来源:https://blog.csdn.net/hg_zhh/article/details/77040713
标签:二维,图像,矩阵,一维
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
详解python3百度指数抓取实例
2022-01-11 03:06:59
![](https://img.aspxhome.com/file/2023/2/102802_0s.png)
详解django中自定义标签和过滤器
2021-02-16 19:43:38
![](https://img.aspxhome.com/file/2023/3/75883_0s.png)
python实现决策树C4.5算法详解(在ID3基础上改进)
2022-05-06 08:01:57
![](https://img.aspxhome.com/file/2023/9/123849_0s.jpg)
Python通过递归遍历出集合中所有元素的方法
2022-08-28 01:36:43
HTML和CSS中的视觉语义
2010-07-09 13:08:00
![](https://img.aspxhome.com/file/UploadPic/20107/9/01-27s.jpg)
常用python爬虫库介绍与简要说明
2023-01-07 13:09:12
Python3 循环语句(for、while、break、range等)
2022-11-26 14:36:40
![](https://img.aspxhome.com/file/2023/5/128315_0s.png)
Python 调用PIL库失败的解决方法
2023-01-25 02:47:08
如何配置关联Python 解释器 Anaconda的教程(图解)
2021-06-13 15:27:30
![](https://img.aspxhome.com/file/2023/3/112183_0s.png)
django中的auth模块与admin后台管理方法
2022-11-22 00:01:21
![](https://img.aspxhome.com/file/2023/4/102754_0s.png)
Python 实用技巧之利用Shell通配符做字符串匹配
2021-07-18 22:57:16
Swift 3.0在集合类数据结构上的一些新变化总结
2023-10-19 02:35:47
python 解决print数组/矩阵无法完整输出的问题
2021-05-13 00:45:15
![](https://img.aspxhome.com/file/2023/3/110553_0s.jpg)
Python代理抓取并验证使用多线程实现
2022-07-10 07:04:19
Pytorch数据读取之Dataset和DataLoader知识总结
2023-11-02 22:57:37
![](https://img.aspxhome.com/file/2023/3/124303_0s.png)
Python+OpenCV图像处理——实现直线检测
2021-05-15 20:13:29
![](https://img.aspxhome.com/file/2023/1/107861_0s.png)
在前女友婚礼上用python把婚礼现场的WIFI名称改成了
2023-05-26 15:15:49
![](https://img.aspxhome.com/file/2023/7/67907_0s.jpg)
python字符串操作的15种方法汇总
2023-10-27 00:40:34
ACCESS的参数化查询 附ASP和C#(ASP.NET)函数
2008-01-10 12:18:00
Python在不同场景合并多个Excel的方法
2021-11-03 02:52:00
![](https://img.aspxhome.com/file/2023/7/107867_0s.webp)