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

Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 4th May 2014, 08:44   #1  |  Link
Registered User
Join Date: Dec 2011
Posts: 354
Please test and improve this dehalo script

Function dehalo_blah(clip c, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss", 
                           \ int "sw", int "sh", string "expandmode", int "leftover", bool "double", int "sharpness", string "sharptype", bool "show")
   rx         = default(rx,2.0)
   ry         = default(ry,2.0)
   darkstr    = default(darkstr,1.0)
   brightstr  = default(brightstr,1.0)
   lowsens    = default(lowsens,50)
   highsens   = default(highsens,50)
   ss         = default(ss,1.5)
   sw         = default(sw,1)
   sh         = default(sh,1)
   expandmode = default(expandmode,"rectangle")
   double     = default(double,true)
   show       = default(show,false)
   sharpness  = default(sharpness,0)       # Strength for lsfmod. If it is higher than 0 it will sharpen your video before removes halo.
   sharptype  = default(sharptype,"fast")  # Defaults value for lsfmod.
   leftover   = sharpness==0 ? default(leftover,5) : default(leftover,6) # you can set this lower if there is some halo left without masked

   sharpen    = sharpness==0 ? false : true
   sharpness  = sharpness==0 ? 120 : sharpness
   sharp      = c.lsfmod(strength=sharpness,defaults=sharptype)
   mask       = mt_lutxy(sharp,c,"x y - 1 - 255 *",u=1,v=1).mt_expand_multi(sw=sw,sh=sh,mode=expandmode,u=1,v=1)
   c          = !sharpen ? c : sharp
   nohalo     = double ? c.dehalo_alpha_mt(rx=rx,ry=ry,darkstr=darkstr,brightstr=brightstr,lowsens=lowsens,highsens=highsens,ss=ss).dehalo_alpha_mt(rx=rx,ry=ry,darkstr=darkstr,brightstr=brightstr,lowsens=lowsens,highsens=highsens,ss=ss) \
                       : c.dehalo_alpha_mt(rx=rx,ry=ry,darkstr=darkstr,brightstr=brightstr,lowsens=lowsens,highsens=highsens,ss=ss)
   merged     = mt_merge(c,nohalo,mask)
   mask2      = mt_lutxy(merged,nohalo,"x y - " + string(leftover) + " - 255 *",u=1,v=1)
   return !show ? mt_merge(merged,nohalo,mask2) : mt_logic(mask,mask2,"max").grayscale()



Last edited by bxyhxyh; 4th March 2016 at 17:42. Reason: fixed small error.
bxyhxyh is offline   Reply With Quote


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 07:53.

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