python相关
xyq1212
这个作者很懒,什么都没留下…
展开
-
根据二维RGB矩阵保存图片
import matplotlib.pyplot as pltfrom PIL import Imagepil_img = Image.fromarray(np.uint8(imageArray))pil_img.save(savePath)原创 2020-10-15 18:16:59 · 494 阅读 · 0 评论 -
Python基础
1.矩阵和tensor转换# tensor转numpymatrix_numpy = matrix_tensor.numpy()# numpy转tensormatrix_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 · 202 阅读 · 0 评论