Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Last updated 1/28/05
- #
- # By Scintilla, with the third line of themask's definition
- # borrowed from Shodan's derainbower
- #
- ###################
- #
- # Syntax:
- # DFMDeRainbow(clip org, int "maskthresh", bool "mask")
- #
- # Requires YUY2 or YV12 input. Is kinda slow.
- # Suggestions for improvement welcome: scintilla@aquilinestudios.org
- #
- # Required plugins:
- # MSharpen, MaskTools, FluxSmooth, Deen
- #
- # Arguments:
- # maskthresh (default=10) - This is MSharpen's threshold value.
- # Lower values will increase the area in which the blurred chroma
- # is allowed to come through, which catches more edges but may
- # cause desaturation and/or chroma bleeding.
- # Set this as high as you can while still catching all the edges
- # that need to be derainbowed.
- # mask (default=false) - When true, this displays the mask instead of
- # the image. Use this to find the optimal value of maskthresh.
- #
- ###################
- function DFTDeRainbow(clip org, int "maskthresh", bool "mask")
- {
- Assert(org.IsYUV(),"DFMDeRainbow: YUV input only")
- org_u=org.UtoY()
- org_v=org.VtoY()
- first_u=org_u.FluxSmoothT(17).Blur(1.5)
- first_v=org_v.FluxSmoothT(17).Blur(1.5)
- themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
- \ .MSharpen(mask=true,threshold=default(maskthresh,10)).Invert()
- \ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)
- fixed_u=org_u.FluxSmoothST(17,14).dfttest(sigma=7,U=false,V=false)
- fixed_v=org_v.FluxSmoothST(17,14).dfttest(sigma=7,U=false,V=false)
- fixed=YtoUV(fixed_u,fixed_v,org)
- output=MaskedMerge(fixed,org,themask,y=2,u=3,v=3)
- return (default(mask,false)?themask:output)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement