【发布时间】:2019-11-08 16:12:19
【问题描述】:
问题是把三张RGB图片组合成一张原图。我需要将同一张图片的 RGB 中的三张过滤图片作为输入。一红一绿一蓝。我尝试获取图像中的每个像素并将其添加到一个元组中,该元组存储它的值。
from Cimpl import *
red_image = load_image("red_image.jpg")
blue_image = load_image("blue_image.jpg")
green_image = load_image("green_image.jpg")
new_image = copy(red_image)
for pixel in new_image:
x, y, (r, g, b) = pixel
for bluePixel in blue_image:
xBlue, yBlue, (rBlue, gBlue, bBlue) = bluePixel
new_colour = create_color(r+rBlue,g+gBlue,b+bBlue)
set_color (new_image, x, y, new_colour)
for greenPixel in green_image:
xGreen, yGreen, (rGreen, gGreen, bGreen) = greenPixel
new_colour = create_color(r+rGreen,g+gGreen,b+bGreen)
set_color (new_image, x, y, new_colour)
show(red_image)
show(new_image)
我似乎又恢复了同一张图片,而不是红色、蓝色和绿色滤镜的“组合图像”(red_image.jpg,因为我将其用作“new_image”)
【问题讨论】: