View Full Version : need a luminosity changing script / plug-in
Forensic
23rd January 2015, 04:06
I need some way to change all pixels below a threshold value to pure black (or I can work with "above a threshold to pure white") while leaving everything else alone. I prefer to work in RGB, but can work with planar if that is my only solution. This is to clean up a mask image. Any suggestions would be greatly appreciated.
feisty2
23rd January 2015, 04:50
couldn't be easier
let's say u wanna set pixels below 32 to 0
mt_lut ("x 32 < 0 x ?")
to convey rgb on yuv colorspace without converting
r=showred ("y8") #or yv12 if u run into troubles with some filters
g=showgreen ("y8")
b=showblue ("y8")
interleave (r,g,b)
#filters here#
mergergb (selectevery (3,0),selectevery (3,1),selectevery (3,2))
Forensic
23rd January 2015, 05:40
Feisty2. Thank you for the quick response. I pride myself on self-sufficiency, but I can't find supportive documentation and am definitely misunderstanding something. I have Masktools2 for AviSynth 2.5.8 (I must use 2.5.8 due to other legacy filters). For simplicity, let's assume I have a one frame planar file in the variable SOURCE. What would be the actual lines of code to set every pixel with a Y below 32 to pure black?
feisty2
23rd January 2015, 05:43
mt_lut ("x 32 < 0 x ?", y=3, u=-128, v=-128)
EDIT: it should work, what kind of error happened there, on your computer, avs 2.5.8 got no support for y8, if some error about y8 appears, just replace y8 with yv12
Forensic
23rd January 2015, 05:57
You are a rock star! Thank you.
StainlessS
28th January 2015, 00:27
I have Masktools2 for AviSynth 2.5.8 (I must use 2.5.8 due to other legacy filters).
What legacy plugz are the problem ? (I'm not aware of any v2.58 plugz that fail in v2.6)
colours
28th January 2015, 13:56
mt_binarize exists and is always faster than the LUT alternative.
mt_binarize(threshold=10,mode="x 0")
Reel.Deel
28th January 2015, 16:11
I have Masktools2 for AviSynth 2.5.8 (I must use 2.5.8 due to other legacy filters)
What legacy plugz are the problem ? (I'm not aware of any v2.58 plugz that fail in v2.6)
Ditto
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.