gpt4 book ai didi

python - 脱脂图像 : how to combine RGB channels?

转载 作者:太空宇宙 更新时间:2023-11-04 10:10:31 24 4
gpt4 key购买 nike

我有一个图像的三个灰色 channel ,每个 channel 是一个 2-dim 数组,值从 0 到 255。我需要将这三个图像组合成一个 RGB 并得到这样的东西:[[234, 45, 67 ], ...], ... [[34, 7, 162], ...]!我使用skimage、numpy来解决这个问题。我在文档中找不到合适的功能(

最佳答案

使用 numpy 的 dstack ( http://docs.scipy.org/doc/numpy/reference/generated/numpy.dstack.html )

import numpy as np
r = np.random.rand(10)
g = np.random.rand(10)
b = np.random.rand(10)

zipped = np.dstack((r, g, b))

关于python - 脱脂图像 : how to combine RGB channels?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38657282/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com