【发布时间】:2017-10-11 20:34:01
【问题描述】:
我想使用用户输入确定的范围内像素的平均颜色来更改整个图片的白平衡。我正在使用名为startX、endX、startY 和endY 的变量。
我已经设法从单个像素坐标中做到这一点,但不是从范围内像素的平均值。 greyValue 是我卡住的地方,因为我不知道如何返回颜色平均值。
def whiteBalanceBonus():
File=pickAFile()
myPict=makePicture(File)
startX=requestInteger("Enter the value of the first 'X' Coordinate in the range")
startY=requestInteger("Enter the value of the first 'Y' Coordinate in the range")
endX=requestInteger("Enter the value of the last 'X' Coordinate in the range")
endY=requestInteger("Enter the value of the last 'Y' Coordinate in the range")
for x in range(startX,endX):
for y in range(startY,endY):
pixel=getPixel(myPict,x,y)
greyValue=
【问题讨论】: