Averaging RGB Colors the Right Way

Created: 2021-11-24T19:35:33-06:00

Return to the Index

This card pertains to a resource available on the internet.

Only one color channel is covered in this card but it generalizes to each color channel.

Averaging of the colors

Naive way of averaging colors:

r2 = (r0 + r1)/2

Averaging colors with euclidean distances:

r2 = sqrt((r0^2 + r1^2)/2)

Averaging over a space

Collect the color samples from each pixel of interest before dividing.

For example:

for each pixel:
rsum += red * red
average = sqrt(rsum/number pixels)