图像处理与递归函数的深入探索
1. 图像处理工具包构建
在图像处理领域,构建一个实用的工具包能极大提升处理效率。下面将介绍几个重要的图像处理函数。
1.1 亮度调整函数
亮度调整函数 adjustBrightness 可对图像的亮度进行调整。以下是完整的函数代码:
def adjustBrightness(image, amount) :
width = image.width()
height = image.height()
# Create a new image that is the same size as the original.
newImage = GraphicsImage(width, height)
for row in range(height) :
for col in range(width) :
# Get the color of the pixel in the original image.
red = image.getRed(row, col)
green = image.getGreen(row, col)
blue = image.getBlue(row, col)
# Adjust the brightness and cap the colors.
newRed = red + red * amount
超级会员免费看
订阅专栏 解锁全文
3518

被折叠的 条评论
为什么被折叠?



