Advertisement
Guest User

Untitled

a guest
May 29th, 2012
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. # Last updated 1/28/05
  2. #
  3. # By Scintilla, with the third line of themask's definition
  4. # borrowed from Shodan's derainbower
  5. #
  6. ###################
  7. #
  8. # Syntax:
  9. # DFMDeRainbow(clip org, int "maskthresh", bool "mask")
  10. #
  11. # Requires YUY2 or YV12 input. Is kinda slow.
  12. # Suggestions for improvement welcome: scintilla@aquilinestudios.org
  13. #
  14. # Required plugins:
  15. # MSharpen, MaskTools, FluxSmooth, Deen
  16. #
  17. # Arguments:
  18. # maskthresh (default=10) - This is MSharpen's threshold value.
  19. # Lower values will increase the area in which the blurred chroma
  20. # is allowed to come through, which catches more edges but may
  21. # cause desaturation and/or chroma bleeding.
  22. # Set this as high as you can while still catching all the edges
  23. # that need to be derainbowed.
  24. # mask (default=false) - When true, this displays the mask instead of
  25. # the image. Use this to find the optimal value of maskthresh.
  26. #
  27. ###################
  28.  
  29. function DFTDeRainbow(clip org, int "maskthresh", bool "mask")
  30. {
  31. Assert(org.IsYUV(),"DFMDeRainbow: YUV input only")
  32.  
  33. org_u=org.UtoY()
  34. org_v=org.VtoY()
  35.  
  36. first_u=org_u.FluxSmoothT(17).Blur(1.5)
  37. first_v=org_v.FluxSmoothT(17).Blur(1.5)
  38.  
  39. themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
  40. \ .MSharpen(mask=true,threshold=default(maskthresh,10)).Invert()
  41. \ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)
  42.  
  43.  
  44. fixed_u=org_u.FluxSmoothST(17,14).dfttest(sigma=7,U=false,V=false)
  45. fixed_v=org_v.FluxSmoothST(17,14).dfttest(sigma=7,U=false,V=false)
  46.  
  47.  
  48. fixed=YtoUV(fixed_u,fixed_v,org)
  49.  
  50. output=MaskedMerge(fixed,org,themask,y=2,u=3,v=3)
  51.  
  52. return (default(mask,false)?themask:output)
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement