SaurusX
9th November 2021, 22:24
Often in animation (and I'm sure elsewhere) there's the issue of asymmetrical edge enhancement to only one side of dark edges. My solution is the approach below, but is there another more elegant approach? I don't know of a dehalo filter that doesn't automatically assume symmetrical haloing.
a=last
#use edgesidebleed to build mask of right-side edges and invert
rside=edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).\
edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).mt_binarize(threshold=150).invert()
#create edge mask
edgmask=hysteria(showmask=false,luma_cap=150,lowthresh=8,highthresh=11,strength=3).Temmod(threshY=12).mt_inflate()
#subtract left side from edge mask leaving only right
halomask=overlay(edgmask,rside, mode="subtract")
#apply dehaloing with mask to only affect right side
overlay(a,dehalo_alpha(ry=.01,rx=1.6,darkstr=0,brightstr=.6,ss=2,cs=true),mask=halomask)
a=last
#use edgesidebleed to build mask of right-side edges and invert
rside=edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).\
edgesidebleed(w32=.000,w16=.00,w8=.0,w4=.00,w2=.015).mt_binarize(threshold=150).invert()
#create edge mask
edgmask=hysteria(showmask=false,luma_cap=150,lowthresh=8,highthresh=11,strength=3).Temmod(threshY=12).mt_inflate()
#subtract left side from edge mask leaving only right
halomask=overlay(edgmask,rside, mode="subtract")
#apply dehaloing with mask to only affect right side
overlay(a,dehalo_alpha(ry=.01,rx=1.6,darkstr=0,brightstr=.6,ss=2,cs=true),mask=halomask)