RC0*_*993 1 python opencv numpy matplotlib
我是Python + OpenCV的新手,所以对于大多数人来说,这可能是一个基本问题,因为我在网上找不到很好/令人满意的解决方案。
所以我试图通过分别创建RGB层
R-0s
G-255s
B-255 * Identity矩阵来创建图像
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
Red = np.zeros([6, 6], dtype = np.uint8)
plt.imshow(Red) # it is just the red layer which is actually all black
plt.show()
Green = np.ones([6, 6], dtype = np.uint8) * 255
plt.imshow(Green) # it is just the Green layer which is actually all white
plt.show()
Blue = np.eye(6, dtype = int) * 255
plt.imshow(Blue) # it is just the Blue layer which is actually black with white diag
plt.show()
Run Code Online (Sandbox Code Playgroud)
有人可以解释正在发生的事情和/或如何解决吗?
尝试使用
Blue = np.eye(6, dtype = int) * 255
plt.imshow(Blue, cmap='gray', vmin=0, vmax=255)
plt.show()
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参考此答案
| 归档时间: |
|
| 查看次数: |
67 次 |
| 最近记录: |