【发布时间】:2020-11-25 18:32:02
【问题描述】:
在 python 中使用 OpenCV 将 RGB 图像转换为 RGBA 的方法是什么?我的要求很具体,因为我试图在 E-Paper Display 上显示图像。我需要将图像转换为 16 位 RGBA。我编写的代码正在转换图像,但它是全黑的。我也尝试过convert 1 bit deep images to RGBA?NumPy convert 8-bit to 16/32-bit image 这些解决方案。我必须在 Linux 上使用 GMU 图像编辑器 手动转换它然后才能工作。由于我正在尝试打开 pdf 并将每个页面转换为图像以在 E-Paper Diaplay 上显示。我不能走那条路。
i = cv2.imread(FNAME, cv2.IMREAD_UNCHANGED)
img = np.array(i, dtype=np.uint16)
img *= 256
filename = 'khrgb.png'
cv2.imwrite(filename, img)
【问题讨论】: