当前位置:网站首页>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()
边栏推荐
- [PSQL] 函数、谓词、CASE表达式、集合运算
- 软件测试的需求人才越来越多,为什么大家还是不太愿意走软件测试的道路?
- Go language study notes - grpc serverclient protobuf Go language from scratch
- Introduction to Grid Layout
- MySQL 8.0.29 decompressed version installation tutorial (valid for personal testing)
- 本周大新闻|苹果MR已进行Pre-EVT测试,Quest 2涨价100美元
- Brush LeetCode topic series - 10. Regular expression match
- MySQL如何创建用户
- [Digital IC hand-tear code] Verilog fixed priority arbiter | topic | principle | design | simulation
- JUC(一)- JUC学习概览 - 对JUC有一个整体的认识
猜你喜欢

MySQL 8.0.28 version installation and configuration method graphic tutorial

去字节跳动自动化测试二面原题(根据录音整理)真实有效 26

What do interview test engineers usually ask?The test supervisor tells you

apifox介绍及使用(1)。

ELK日志分析系统

说好的女程序员做测试有优势?面试十几家,被面试官虐哭~~

测试技术之APP蓝牙连接测试

Detailed explanation of interface in Go language

C语言中i++和++i在循环中的差异性

12个MySQL慢查询的原因分析
随机推荐
Navicat如何连接MySQL
MySQL夺命10问,你能坚持到第几问?
mysql 查询表 所有字段
CPU使用率和负载区别及分析
21 Day Learning Challenge Schedule
ERROR 1045 (28000) Access denied for user ‘root‘@‘localhost‘解决方法
MySQL 5.7详细下载安装配置教程
Timing task library in the language use Cron, rounding
去字节跳动自动化测试二面原题(根据录音整理)真实有效 26
golang泛型
Mycat2.0搭建教程
Matlab paper illustration drawing template No. 41 - bubble chart (bubblechart)
100 latest software testing interview questions in 2022, summary of common interview questions and answers
MySQL安装常见报错处理大全
165.比较版本号
go项目的打包部署
MySQL 的 limit 分页查询及性能问题
Android Studio 实现登录注册-源代码 (连接MySql数据库)
2022年7月学习计划完成情况
Detailed explanation of AMQP protocol