我正在尝试通过使用pypng
合并三个灰度png图像来创建RGB png图像。我已经将png文件读入numpy数组,如下所示
pngFile1 = png.Reader("file1.png").read()
pngFile2 = png.Reader("file2.png").read()
pngFile3 = png.Reader("file3.png").read()
pngArray1 = np.array(list(pngFile1[2]))
pngArray2 = np.array(list(pngFile2[2]))
pngArray3 = np.array(list(pngFile3[2]))
如何组合这三个数组/图像来重新创建RGB png图像?在
我应该创建一个2D数组,每一行都是
3*width
,并且包含连续的RGB值为了简单起见,我们假设您有3个
3x3
维的灰度图像,并将这3个灰度图像表示为:我发现
scipy
可以直接将灰度png读取到数组中。在相关问题 更多 >
编程相关推荐