-
Matching Lightness Value of two clips using sampleimage
Dear Cow Members and Expression gurus.
I have a timelapse drone clip of a soccer field. (birds view, stabilized) Sun and clouds are changing the lightness rapidly. My goal is to “match” the lightness of the second clip that was matchmoved/corner pinned into clip one.
Therefore I had the idea to use a “Expression Color Control” combined with “sampleImage”:
sampleImage(effect(“Point Control”)(“Point”), radius = [10, 10], postEffect = true, t = time)
Then I converted the rgba values to hsla:
RGBA=thisComp.layer(“A002_C018_0922BW_001.mp4”).effect(“Color Control – RGB Sample”)(“Color”);
HSLA=rgbToHsl(RGBA)*100;
value=HSLA[2];Since the second clip is also a moving image I did the same to also sample these lightness values.
So I ended up having two lightness values from both clips.
To get the offset value I wanted to subtract lightness_value_1 with lightness_value_2.
Using the “Color Balance (HLS)” effect I added the lightness_offset_value to the lightness parameter.
The calculated values are correct and working. But the visual result is wrong. Using the “info panel” to sample the HSBA values whilst hovering with the mouse over the image I realized that the B(rightness) values are wrong.
So I was playing around with some parameters and turned the saturation of the “corner pinned” clip down to zero. With no saturation the calculated lightness does match.
Unfortunately I am not able to bring back the saturation afterwards.
So my question is why is the saturation screwing with my lightness values. Since saturation seems to add additional lightness. What’s the difference between HSLA and HSBA.
Is there a way to separate/combine the channels somehow or am I missing something completely?
Would be glad if you could help me out with some experience.
Thanks in advance.
PS: I am using some text layers to output the values.
sampleImage(effect("Point Control")("Point"), radius = [10, 10], postEffect = true, t = time)RGBA=thisComp.layer("A002_C018_0922BW_001.mp4").effect("Color Control - RGB Sample")("Color");
HSLA=rgbToHsl(RGBA)*100;
lvOne=HSLA[2];Color Balance (HLS)" effect - lightness parameter:
lvOne=thisComp.layer("HSL[2].Value_One").text.sourceText.value;
lvTwo=thisComp.layer("HSL[2].Value_Two").text.sourceText.value;
value=lvOne-lvTwo;