&quot“ pcolormesh”给我奇怪的结果
我想使用PCOLORMESH绘制RGB图像。但是,我只能单独添加红色,绿色的蓝色通道,但我只会得到缩放图像。
我缺少选项吗?看起来PcoLormesh将像素值正常化
----更新 -
当我在下面再次重建代码时,它会像绿色的怪物一样向上倒下。
import matplotlib.pyplot as plt
import numpy as np
import cv2
from tensorflow.keras.datasets import cifar10
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_test = x_test.reshape(10000, 32, 32, 3)
x_test = x_test.astype('float32')
x = x_test[i, :]
x = x.reshape(32,32,3)
blue,green,red = cv2.split(x)
print(blue)
plt.figure(figsize=(3,3))
plt.pcolormesh(red)
plt.pcolormesh(green)
plt.pcolormesh(blue)
plt.show()
I would like to plot RGB image using pcolormesh. But I only get scaled image although I added Red, Green Blue channels individually.
Am I missing option or something? It looks like pcolormesh normalize the pixel values
---Update--
When I rebuild my code again below, it gives me color like a green monster flipped up-side-down.
import matplotlib.pyplot as plt
import numpy as np
import cv2
from tensorflow.keras.datasets import cifar10
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_test = x_test.reshape(10000, 32, 32, 3)
x_test = x_test.astype('float32')
x = x_test[i, :]
x = x.reshape(32,32,3)
blue,green,red = cv2.split(x)
print(blue)
plt.figure(figsize=(3,3))
plt.pcolormesh(red)
plt.pcolormesh(green)
plt.pcolormesh(blue)
plt.show()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论