|
|
(One intermediate revision by one user not shown) |
Line 1: |
Line 1: |
− | <pre>
| + | #REDIRECT [[BlindDeHalo3]] |
− | # BlindDeHalo - v0.1 | + | |
− | #
| + | |
− | # This script removes the light & dark halos from too strong "Edge Enhancement"
| + | |
− | # Adaption of the parameters has to be done manually for each source, the function is not adaptive.
| + | |
− | #
| + | |
− | # Needed Plugins: MaskTools.dll >= 1.4.15
| + | |
− | # undot.dll
| + | |
− | #
| + | |
− | | + | |
− | function BlindDeHalo( clip clp, int "strength", int "radius_x", int "radius_y", float "darkamount", string "mode", float "maskblur", bool "fullframe" )
| + | |
− | {
| + | |
− | strength = default( strength, 80)
| + | |
− | radius_x = default( radius_x, 2)
| + | |
− | radius_y = default( radius_y, 2)
| + | |
− | darkamount = default( darkamount,1.0)
| + | |
− | mode = default( mode, "soft")
| + | |
− | maskblur = default( maskblur, 1.0)
| + | |
− | fullframe = default( fullframe, false)
| + | |
− | modus = mode=="hard" ? "hardlight" : "softlight"
| + | |
− | | + | |
− | ox = clp.width
| + | |
− | oy = clp.height
| + | |
− | rx = sqrt(radius_x)
| + | |
− | ry = sqrt(radius_y)
| + | |
− | | + | |
− | clp
| + | |
− | edge=Dedgemask(0,255,0,255,"6 10 6 10 -64 10 6 10 6",setdivisor=true,divisor=64).levels(2,0.5,6,0,255,false).undot#.coloryuv(analyze=true)#
| + | |
− | | + | |
− | blur1 = bicubicresize(int((ox/rx)/4 +.5)*4,int((oy/ry)/4 +.5 )*4,-1.0,1.0).lanczosresize(ox,oy)
| + | |
− | blur2 = bicubicresize(int((ox/rx)/4 +.5)*4,int((oy/ry)/4 +.5 )*4, 1.0,0.0).lanczosresize(ox,oy)
| + | |
− | | + | |
− | diff = YV12subtract(blur1,blur2)
| + | |
− | | + | |
− | overlay(diff,diff,mode="hardlight").levels(0,1.0,255,88,168,false)
| + | |
− | | + | |
− | darkamount == 1.0 ? NOP : overlay(last,last.levels(0,1.0,128,int(128-128*darkamount),128,false),mode="lighten")
| + | |
− | overlay(last,last.levels(0,1.0,255,128+strength,128-strength,false)) # levels reversed: no more "invert" in below overlay()
| + | |
− | | + | |
− | overlay(clp,last.greyscale.blur(maskblur),mode=modus)
| + | |
− | fullframe ? NOP : MaskedMerge(clp,last,edge.deflate.expand.blur(1.58).inflate,useMMX=true)
| + | |
− | | + | |
− | return(last)
| + | |
− | }
| + | |
− | #
| + | |
− | </pre>
| + | |
− | | + | |
− | [[Category:External filters]] | + | |