门户网站用什么程序做,设计室内装修的软件,儿童网站网页设计,两个wordpress同步python debug时需要图像化展示数据#xff0c;有三种方法。
方法一#xff1a;t是值在[0, 255]之间的numpy数组#xff0c;形状为 [ x ∗ x ∗ 3 ] [x*x*3] [x∗x∗3]#xff0c;其中3为channel数。#xff08;使用t.permute(1,2,0)变换通道#xff0c;使用np.squeeze(t…python debug时需要图像化展示数据有三种方法。
方法一t是值在[0, 255]之间的numpy数组形状为 [ x ∗ x ∗ 3 ] [x*x*3] [x∗x∗3]其中3为channel数。使用t.permute(1,2,0)变换通道使用np.squeeze(t)去掉冗余维度
import cv2
cv2.imwrite(1.jpg, t)方法二t是值在[0, 1]之间、或在[0, 255]之间的numpy数组形状为 [ x ∗ x ∗ 3 ] [x*x*3] [x∗x∗3]
import matplotlib.pyplot as plt
plt.imshow(t)
plt.savefig(2.jpg)方法三t是PIL的一个实例形状为 [ 3 ∗ x ∗ x ] [3*x*x] [3∗x∗x]
from PIL import Image
imgImage.open(d:/t.png)
img.save(3.jpg)