ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Matching Lightness Value of two clips using sampleimage

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Martin Sautter
Matching Lightness Value of two clips using sampleimage
on Jun 5, 2019 at 8:43:47 pm

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;


http://www.martin-sautter.com



Return to posts index

Oleg Pirogov
Re: Matching Lightness Value of two clips using sampleimage
on Jun 7, 2019 at 5:12:36 pm

>What's the difference between HSLA and HSBA
HSB[rightness] (also known as HSV[alue]) used in AE colorpicking differs form HSL[ightness] from hslToRgb() function.
Here's a reference: https://en.wikipedia.org/wiki/HSL_and_HSV
Notice, that Hue formulae are the same, but Saturation formulae (as well as formulae for Brightness and Lightness) differ.

Side note: Luminosity from blending modes is again a different thing (specified in Adobe documentation, for ex., in PDF standard reference) as well as its corresponding Saturation. Thus, in AE coexist three different color representation systems with three different Saturations. There are colorpicking Saturation, hslToRgb() Saturation and blending modes Saturation.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]