Advertisement
Guest User

Untitled

a guest
Jan 17th, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. setmemorymax(512)
  2. setmtmode(5,6)
  3. raw=ImageSource("raw.png",start=0,end=0)
  4. gdapt=ImageSource("gdapt.png",start=0,end=0)
  5. setmtmode(2,6)
  6.  
  7. ####################################
  8. raw
  9.     RatioResize(320.0,"adjust2w",kernel="point")
  10.     r = ShowRed("YV12")
  11.     g = ShowGreen("YV12")
  12.     b = ShowBlue("YV12")
  13.     interleave(r,g,b)
  14. raw=last
  15. ####################################
  16.     uv   = 3
  17.     sstr = 2.7
  18.     amnt = 255
  19.     uv2  = uv
  20.     STR  = string(sstr)
  21.     AMN  = string(amnt)
  22.     clp=last
  23.  
  24.     vblur  = clp.mt_convolution("50 99 50","1",U=uv,V=uv)
  25.     hblur  = clp.mt_convolution("1","50 99 50",U=uv,V=uv)
  26.     masky  = mt_luts (vblur, hblur, mode="avg", pixels=mt_circle(1)+string(0), expr="x y - abs 2 > 255 0 ?" )
  27.     vblur = mt_merge(clp,vblur,masky)
  28.  
  29. # limiting to no less than pixel change of 13 to exclude faint checkerboard blur
  30.     mt_lutxy(clp,vblur,"x y - abs 13 < x y ?")
  31. blurred=last
  32. ####################################
  33. gdapt
  34.     RatioResize(320.0,"adjust2w",kernel="point")
  35.     r = ShowRed("YV12")
  36.     g = ShowGreen("YV12")
  37.     b = ShowBlue("YV12")
  38.     interleave(r,g,b)
  39. gdapt=last
  40. ####################################
  41.  
  42. # get difference of both approaches
  43. mt_lutxy(blurred,gdapt," x y - abs",u=-128,v=-128)
  44. # ensure we always get the highest change regardless of plane
  45. mt_logic(mt_logic(SelectEvery (3, 0), SelectEvery (3, 1),"max"),SelectEvery (3, 2),"max")
  46. # cleaning 1px dots
  47. removegrain(1)
  48. # strengthen the mask
  49. mt_binarize(25,u=-128,v=-128) # sames as mt_lut(yexpr=" x 25 > 255 0 ?")
  50.  
  51. # mix my original approach with source using the diff of gdapt/blurred as a mask
  52. mt_merge(raw,blurred,last.invert,luma=true)
  53.  
  54. mergergb(SelectEvery (3, 0), SelectEvery (3, 1), SelectEvery (3, 2))
  55.  
  56. RatioResize(640.0,"adjust2w",kernel="point")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement