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 4th May 2014, 08:44   #1  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
Please test and improve this dehalo script

Code:
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()
}
Source


Dehalo


Masked

Last edited by bxyhxyh; 4th March 2016 at 17:42. Reason: fixed small error.
bxyhxyh is offline   Reply With Quote
Old 13th May 2014, 23:11   #2  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,350
It looks fine, and the basic methodology is also fine. It's a technique that has been tried quite often to say the least, and it always works well enough on cell-shaded material. If you want something good for more natural content, or just more detailed content, it is unlikely to ever be particularly good.
*.mp4 guy is offline   Reply With Quote
Old 14th May 2014, 01:31   #3  |  Link
SEt
Registered User
 
Join Date: Aug 2007
Posts: 374
I suggest you start at YAHR. Just dumb four times the YAHR (might be slightly modded already):

Needs some tweaking, but resuilt is much better imho, as it killed only halos.
SEt is offline   Reply With Quote
Old 26th May 2014, 18:25   #4  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
New version

To avoid
Code:
lsfmod()
dehalo_blah()
It now internally sharpens the video before removes halo, if sharpness is higher than 0.
But it have only sharptype (defaults) and sharpness (strength) parameters for lsfmod().

Code above is now
Code:
dehalo_blah(sharpness=100,sharptype="fast")
Also changed default value of rx and ry to 2. (was 3)

Last edited by bxyhxyh; 26th May 2014 at 18:49.
bxyhxyh is offline   Reply With Quote
Reply

Tags
dehalo

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 03:58.


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