Home > other >  Can somebody explain the mathematics of this Color Balance formula?
Can somebody explain the mathematics of this Color Balance formula?

Time:07-09

I have found a good example of a Color Balance implementation enter image description here

Additionally, the OP talks about how changing the scale of the trackbar adjusts the shadows, mid-tones, and highlights. What values would I change it to in order to make changes in those ranges?

CodePudding user response:

This is just a linear interpolation between C1(R1, G1, B1) and C2(R2, G2, B2).

If you imagine C1 and C2 as points in 3D space, c_val lets you choose a point on the line that goes from C1 to C2.

  • 0 is on C1
  • 1 is on C2
  • anything in (0,1) is on the line segment between (C1, C2)
  • anything below 0 or above 1 is extrapolated.

Subtracting 0.5 just changes the space from [0,1] to [-0.5, 0.5]

  • Related