Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd January 2015, 04:06   #1  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
need a luminosity changing script / plug-in

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.
Forensic is offline   Reply With Quote
Old 23rd January 2015, 04:50   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
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))
feisty2 is offline   Reply With Quote
Old 23rd January 2015, 05:40   #3  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
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?
Forensic is offline   Reply With Quote
Old 23rd January 2015, 05:43   #4  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Code:
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

Last edited by feisty2; 23rd January 2015 at 05:47.
feisty2 is offline   Reply With Quote
Old 23rd January 2015, 05:57   #5  |  Link
Forensic
Registered User
 
Join Date: Apr 2008
Location: California, USA
Posts: 127
You are a rock star! Thank you.
Forensic is offline   Reply With Quote
Old 28th January 2015, 00:27   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by Forensic View Post
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)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 28th January 2015 at 00:30.
StainlessS is offline   Reply With Quote
Old 28th January 2015, 13:56   #7  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 308
mt_binarize exists and is always faster than the LUT alternative.

Code:
mt_binarize(threshold=10,mode="x 0")
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 28th January 2015, 16:11   #8  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by Forensic View Post
I have Masktools2 for AviSynth 2.5.8 (I must use 2.5.8 due to other legacy filters)
Quote:
Originally Posted by StainlessS View Post
What legacy plugz are the problem ? (I'm not aware of any v2.58 plugz that fail in v2.6)
Ditto
Reel.Deel is offline   Reply With Quote
Reply

Tags
color, luminosity, mask, threshold

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:34.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.