![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python相关
xyq1212
这个作者很懒,什么都没留下…
展开
-
根据二维RGB矩阵保存图片
import matplotlib.pyplot as plt from PIL import Image pil_img = Image.fromarray(np.uint8(imageArray)) pil_img.save(savePath)原创 2020-10-15 18:16:59 · 483 阅读 · 0 评论 -
Python基础
1.矩阵和tensor转换 # tensor转numpy matrix_numpy = matrix_tensor.numpy() # numpy转tensor matrix_tensor = torch.from_numpy(matrix_numpy) 2.矩阵切割 # eg:切割部分图像,前两个维度分别代表高和宽,第三个维度是RGB,全选 clip_image = whole_img[left:right,top:bottom,:] 3.根据由RGB组成的二维矩阵显示并保存图像 imp原创 2020-10-19 14:40:23 · 191 阅读 · 0 评论