anton_foy
4th October 2020, 23:45
Hi,
I am trying to mask the highlights (220*256 to 255*256) but I want a soft range/feather. With the mt_binarize I get a hard mask with 100% opacity at 219*256 and 0% opacity at 220*256 and up. How can I achieve a softer mask such as a lumaKey mask in NLE's that fades the opacity from 0% to 100% a range below 220*256?
clip1 = last
black = tweak(bright=-255.0)
umask = mt_binarize(threshold=220*256, paramscale="i16")
mt_merge(clip1, black, umask, Y=3, U=2, V=2, chroma="copy first", w=-1, h=-1, paramscale="i16")
Thanks!
WorBry
6th October 2020, 17:31
I assume this is a spin-off from:
https://forum.doom9.org/showthread.php?p=1924524#post1924524
Don't know if this helps, but many moons ago I concocted a function (SelSah_v3) for applying tweak (Sat and Hue) parameters through a luma range mask, all in YV12 space.
http://forum.doom9.org/showthread.php?p=1405481#post1405481
It was modified subsequently to include Contrast (the post following), although not Brightness.
As you can see it enabled control of the degree of 'soft roll-off' at the luma mask boundaries. It didn't include 'opacity' control but another function I concocted (Blend_MT_alpha3), to emulate the 'blend modes' found in AE etc, did:
https://forum.doom9.org/showthread.php?p=1400434#post1400434
The interest at that time was in emulating classic 'film looks' and they worked quite well in that context; these days though I use Resolve almost exclusively for color grading.
I should add though that Didée and Gavino assisted me greatly with the core MaskTools computations and function syntax, so I'm by no means an expert, and this was a long, long time ago.
Anyhow, maybe you can glean something useful from them.
real.finder
6th October 2020, 18:35
I used to do it using lut, maybe someone can make function to act like soft mt_binarize
anton_foy
7th October 2020, 22:48
@WorBry
I assume this is a spin-off from:
https://forum.doom9.org/showthread.p...24#post1924524
Yes I cleaned it up a bit now.
Don't know if this helps, but many moons ago I concocted a function (SelSah_v3) for applying tweak (Sat and Hue) parameters through a luma range mask, all in YV12 space.
http://forum.doom9.org/showthread.ph...81#post1405481
It was modified subsequently to include Contrast (the post following), although not Brightness.
Thanks! Wow this looks great, I must give it a try. I want to do deep color all the way but maybe its no biggie if I use it in 8-bit for masking.
As you can see it enabled control of the degree of 'soft roll-off' at the luma mask boundaries. It didn't include 'opacity' control but another function I concocted (Blend_MT_alpha3), to emulate the 'blend modes' found in AE etc, did:
https://forum.doom9.org/showthread.p...34#post1400434
The interest at that time was in emulating classic 'film looks' and they worked quite well in that context; these days though I use Resolve almost exclusively for color grading.
I should add though that Didée and Gavino assisted me greatly with the core MaskTools computations and function syntax, so I'm by no means an expert, and this was a long, long time ago.
Anyhow, maybe you can glean something useful from them.
Cool, I was here on Doom9 alot in 2005-2008 especially following and contributed (a bit) to the filmlook threads back then. Bleach bypass and all the GIMP curves (GiCoCu) and such stuff came up. Fun times! The PS blending modes are definatley interesting!
Im sure I can find use for them :)
@real.finder
I used to do it using lut, maybe someone can make function to act like soft mt_binarize
Thanks I was trying to make mt_binarize soft and tried with mt_lutxy but I get confused and it did not lead anywhere.
Although I think I found the solution and it was SIMPLE!:
# UNBLOW #
clip1 = last.Levels(0, 1, 65280, 0, 235*256, coring=false, dither=false)
clipR = Levels(0, 1, 65280, 0, 235*256, coring=false, dither=false).converttorgb64().extractR()
clipG = Levels(0, 1, 65280, 0, 235*256, coring=false, dither=false).converttorgb64().extractG()
clipB = Levels(0, 1, 65280, 0, 235*256, coring=false, dither=false).converttorgb64().extractB()
RBD = clipB.Overlay(clipR, mode="darken", opacity=1.0)
GRD = clipG.Overlay(RBD, mode="darken", opacity=1.0)
umask= Greyscale().Levels(197*256, 0.76, 65280, 0, 255*256, coring=false, dither=false).fastgaussblur(20)
mt_merge(clip1, GRD, umask, Y=3, U=2, V=2, chroma="copy first", w=-1, h=-1, paramscale="i16")
By using just levels for the mask seems to get a nice faded luma mask, maybe need a little tweaking.
The green part is changed from chanmix to extract which I think is faster to use? Probably can make it even faster but at least it works now.
If I do not use Levels(0, 1, 65280, 0, 235*256, coring=false, dither=false) before extract() it clips off the highlights so I guess I must do it this way.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.