当前位置:网站首页>PIL与numpy格式之间的转换
PIL与numpy格式之间的转换
2022-08-02 05:07:00 【Mick..】
PIL是python最常见图像处理库,在深度学习中经常遇到PIL和numpy数组之间的格式变换
PIL转换为numay
from PIL import Image
img = Image.open("./hh.png")
img = np.array(img)
numay转换为PIL
from PIL import Image
import numpy as np
##生成一个随机数组
##randint()生成一定范围的数组
##random()生成0-1之间的均匀分布
##randn() 生成高斯分布
img=np.random.randint(0,255,(48,48))
img = Image.fromarray(img)
img.show()
边栏推荐
- CPU使用率和负载区别及分析
- 区块元素、内联元素(<div>元素、span元素)
- MySQL 用户授权
- classSR论文阅读笔记
- apisix-入门使用篇
- Mysql return table
- ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger
- LeetCode刷题系列 -- 787. K 站中转内最便宜的航班
- MySQL安装常见报错处理大全
- Go language study notes - grpc serverclient protobuf Go language from scratch
猜你喜欢
MySql copies data from one table to another table
Go语学习笔记 - 处理超时问题 - Context使用 从零开始Go语言
Google Chrome(谷歌浏览器)安装使用
H5 access payment process - WeChat payment & Alipay payment
MySQL 字符串拼接 - 多种字符串拼接实战案例
【C语言】LeetCode26.删除有序数组中的重复项&&LeetCode88.合并两个有序数组
Redis-----非关系数据库
Detailed explanation of interface in Go language
25K测试老鸟6年经验的面试心得,四种公司、四种问题…
C语言中i++和++i在循环中的差异性
随机推荐
goroutine (coroutine) in go language
Go语学习笔记 - grpc serverclient protobuf 从零开始Go语言
整合ssm(一)
软件测试的需求人才越来越多,为什么大家还是不太愿意走软件测试的道路?
2022年7月学习计划完成情况
The company does not pay attention to software testing, and the new Ali P8 has written a test case writing specification for us
prisma使用mongodb副本集群报错引发的一些列问题
Navicat cannot connect to mysql super detailed processing method
[PSQL] window function, GROUPING operator
MySQL大批量造数据
classSR论文阅读笔记
对node工程进行压力测试与性能分析
MySQL 灵魂 16 问,你能撑到第几问?
C语言中i++和++i在循环中的差异性
165.比较版本号
Go语学习笔记 - 处理超时问题 - Context使用 从零开始Go语言
MySQL安装教程
AMQP协议详解
测试技术之APP蓝牙连接测试
18 years of programmer career, read more than 200 programming books, pick out some essence to share with you