Advertisement
Guest User

InpaintFunc v1.15

a guest
Jun 25th, 2019
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.32 KB | None | 0 0
  1. #____________________________________________________________________________________
  2. # _____ _ _ ______
  3. # |_ _| (_) | | | ____|
  4. # | | _ __ _ __ __ _ _ _ __ | |_| |__ _ _ _ __ ___
  5. # | | | '_ \| '_ \ / _` | | '_ \| __| __| | | | '_ \ / __|
  6. # _| |_| | | | |_) | (_| | | | | | |_| | | |_| | | | | (__
  7. # |_____|_| |_| .__/ \__,_|_|_| |_|\__|_| \__,_|_| |_|\___|
  8. # | |
  9. # |_|
  10. #_____________________________________________________________________________________
  11.  
  12.  
  13.  
  14. # InpaintFunc is a new delogo function using AVSInpaint.dll an AviSynth C plugin developed by AMSS.
  15. #See thread : http://forum.doom9.org/showthread.php?t=133682 to download this plugin and get
  16. #more information about it. Just an advertise : AVSInpaint plugin is rather slow so be patient ;-)
  17.  
  18.  
  19. #_______________________________________________________________________________________
  20. #
  21. # History :
  22. #_______________________________________________________________________________________
  23.  
  24.  
  25. # Actual revision : InpaintFunc v1.12
  26.  
  27. # Author : Reuf Toc
  28.  
  29. # Requirement : AVSInpaint.dll
  30.  
  31.  
  32. # Changes :
  33.  
  34. #Rev 1.00 : First release 2008/01/30
  35. #Rev 1.01 : Added debug for "mode". Removed two useless operations.
  36. #Rev 1.02 : Added "Speed" parameter.
  37. #Rev 1.03 : Fixed bug in PAR calculation. Fixed bug with non-RGB32 mask.
  38. #Rev 1.10 : Fixed bug due to overlay. Added post-processing + a lot of things.
  39. #Rev 1.11 : Added Show parameter and InpaintAssist function. Process in RGB24 instead of RGB32.
  40. #Rev 1.12 : Fixed bug in "loc" calculation
  41. #Rev 1.13 : Fixed bug for .ebmp creation (did not happen in several cases)
  42. #Rev 1.14 : Fixed RepairEdge bug resulting from a bug fix in Levels for RGB (http://forum.doom9.org/showthread.php?t=159652) [StainlessS).
  43. #Rev 1.15 : Affect loc area only [StainlessS).
  44.  
  45. #______________________________________________________________________________________
  46. #
  47. # About Inpainting :
  48. #______________________________________________________________________________________
  49.  
  50.  
  51. # Image Inpainting is the art of restoring destroyed parts of an image by using information
  52. #of valid parts of the image in a way, so that the human eye does not recognize the damaged
  53. #areas (at least not at a first sight). In video processing image inpainting is often applied
  54. #to videos in order to remove TV station logos.
  55.  
  56.  
  57. #______________________________________________________________________________________
  58. #
  59. # Function parameters :
  60. #______________________________________________________________________________________
  61.  
  62.  
  63.  
  64.  
  65. # =======================================================
  66. # InpaintAssist
  67. # =======================================================
  68.  
  69.  
  70. # This subfunction can be used to help you in order to set your own crop values to isolate the logo to remove. With HD footage, the delogo
  71. # process is slow due to the resolution (especialy for analysis) and to maximize speed, it is adviced to reduce the size of the cropped clip
  72. # by setting your own crop values.
  73.  
  74.  
  75. # If you don't specify a loc value, this function will display your clip divised in 9 parts (the nine loc preset of InpaintFunc) with the crop values for each one in order
  76. # to give you an idea about the values to use.
  77.  
  78. # After that step, you can enter your own loc values and check they are correct. The selected area will be hightlighted.
  79. # Keep in mind you have to keep a little border around the logo since inpainting use nearby pixels to compute the hidden ones.
  80.  
  81. # string "loc" : Select the part of the picture where is the logo to remove. Same as InpaintFunc loc parameter
  82.  
  83. # String "alignment" : Alignment of the text. "Top", "Center" and "Bottom" are allowed
  84.  
  85.  
  86.  
  87. # =======================================================
  88. # InpaintFunc
  89. # =======================================================
  90.  
  91.  
  92.  
  93. # Given this function use AVSInpaint.dll and given AVSInpaint is an avisynth C plugin
  94. #don't forget to add loadCplugin("xxx\AVSInpaint.dll") in your script before calling this function !!!
  95.  
  96.  
  97.  
  98.  
  99. # String "loc" : Select the part of the picture where is the logo to remove.
  100. # See the table :
  101.  
  102.  
  103. # ______________ ______________
  104. # | TL | TC |TR | | X1 | X2 |X3 |
  105. # |____|____|___| |____|____|___|
  106. # | ML | MC |MR | or | Y1 | Y2 |Y3 |
  107. # |____|____|___| |____|____|___|
  108. # | BL | BC |BR | | Z1 | Z2 |Z3 |
  109. # |____|____|___| |____|____|___|
  110.  
  111.  
  112. # If the logo you want to remove is in the top right corner, then you can choose
  113. # either loc="TR" or loc="x3".
  114.  
  115. # If you don't want to use one of these preset, you can enter manually the crop values to isolate the logo.
  116. # example : loc = "0,300,-440,-20". Spaces are not allowed in "loc" parameter. You can use function
  117. # InpaintAssist to help you to set crop values.
  118.  
  119.  
  120.  
  121.  
  122. # String "mask" : Path to the mask of the logo. The mask is a black and white picture. Parties where the logo
  123. # is are white, the others are black.
  124.  
  125. # example : mask="C:\my_mask.bmp"
  126.  
  127.  
  128.  
  129. # String "mode" : 3 Choices (default both) :
  130.  
  131. # -Deblend : If the logo is transparent, use this mode.
  132. # -Inpaint : If the logo is opaque, use this mode.
  133. # -Both : If the logo is both opaque and transparent, use this mode.
  134.  
  135.  
  136.  
  137. # Float "AR" : The Sample Aspect Ratio of your video. E.g. : 16/9, 4/3... (Default 1.0).
  138. # This value is used to calculate the PAR of your video. If you don't set this parameter, then
  139. # PAR will be set to 1:1. It's not really important if you don't set this value.
  140. # When you set the AR, take care to add ".0" to your values if you use exact value (16/9 or 4/3).
  141. # example : AR=16.0/9.0 or AR=4.0/3.0
  142.  
  143.  
  144.  
  145. # Int "Speed" : With this parameter you can speed up this function by trimming the clip analyzed by
  146. # AnalyseLogo. A value of 20 means that 100% of clip will be analyzed. With a value of
  147. # 1, only 5% will be analyzed. (min value 1, max value 20, default 5)
  148.  
  149.  
  150. # Int "PPMode" : If you want to apply post-processing, 3 modes are available. Default is 0 (disabled)
  151. # -Mode 1 : Blur all the area where logo was present.
  152. # -Mode 2 : Blur all the area where logo was present using TemporalSoften and SpatialSoften.
  153. # -Mode 3 : Blur only the edge of logo area using TemporalSoften and SpatialSoften..
  154.  
  155.  
  156. # Int "PP" : Strength of the post-processing. Default is 50 (min value 0, max value 100)
  157. # A 0 value will disable post processing, 100 will process at full strength.
  158.  
  159. # Bool "Reset" : InpaintFunc contain a feature that allow to not compute logo analysis when it was already done.
  160. # By setting Reset to true, logo analysis is always computed. Default is false.
  161.  
  162. # Float "radius" : Radius around a damaged pixel from where values are taken when the pixel is inpainted.
  163. # Bigger values prevent inpainting in the wrong direction, but also create more blur.
  164.  
  165. # Float "sharpness" : Higher values can prevent blurring caused by high Radius values.
  166.  
  167. # Float "preblur" : Standard deviation of the blur which is applied to the image before the structure tensor is computed.
  168. # Higher values help connecting isophotes which have been cut by the inpainting region, but also
  169. # increase CPU usage. PreBlur=0.0 disables pre-blurring.
  170.  
  171.  
  172. # Float "postblur" : Standard deviation of the blur which is applied to the structure tensors before they are used
  173. # to determine the inpainting direction. Higher values help gather more directional information when
  174. # there are only few valid pixels available, but increases CPU usage.
  175.  
  176.  
  177. # Bool "show" : Allow the user to see the differents steps of the delogoing. Are displayed the source, the
  178. # repaired, the repaired post-processed, the mask, the repair masks (edge and global), the color
  179. # mask, the alpha mask and the inpaint mask.
  180.  
  181.  
  182.  
  183.  
  184. #______________________________________________________________________________________
  185.  
  186. # Function :
  187. #______________________________________________________________________________________
  188.  
  189.  
  190. function InpaintFunc( clip clp, string "mask", string "loc", float "AR", string "mode", int "speed",
  191. \ int "pp", int "ppmode", bool "reset", float "radius", float "sharpness", float "preblur",
  192. \ float"postblur", bool "show")
  193.  
  194. {
  195.  
  196. mask = default (mask , "" )
  197. loc = default (loc , "" )
  198. AR = default (AR , 1.0 )
  199. mode = default (mode , "both")
  200. speed = default (speed , 5 )
  201. pp = default (pp , 50 )
  202. ppmode = default (ppmode , 0 )
  203. reset = default (reset , false )
  204. radius = default (radius , 8.0 )
  205. sharpness = default (sharpness , 75.0 )
  206. preblur = default (preblur , 8.0 )
  207. postblur = default (postblur , 4.0 )
  208. show = default (show , false )
  209.  
  210.  
  211.  
  212.  
  213. # debug
  214. # =====
  215.  
  216.  
  217. x = width (clp)
  218. y = height (clp)
  219. pp = (pp >= 100) ? 255 : (pp <= 0) ? 0 : int(pp*255/100)
  220. RGB = isRGB(clp)
  221. RGB24 = isRGB24(clp)
  222. RGB32 = isRGB32(clp)
  223. YUY2 = isYUY2(clp)
  224. cropval = (StrLen(loc) != 2 ) ? true : false
  225. spd = (speed != 20 ) ? true : false
  226. PAR = (AR != 1.0) ? float( y) / float( x) * AR : 1.0
  227. bugloc = (loc == "" ) ? true : false
  228. bugmode = (mode != "inpaint" && mode != "deblend" && mode != "both") ? true : false
  229. bugspeed = (speed <= 0 || speed >= 21) ? true : false
  230.  
  231.  
  232. assert ( findstr(loc," ") == 0 , """Space character is not allowed in string "loc"."""")
  233. assert ( mask != "" , """You have to define a mask (string "mymask")""")
  234. assert ( bugloc == false , """You must define "Loc".""")
  235. assert ( bugmode == false , """This mode doesn't exist. Change "mode" value.""")
  236. assert ( bugspeed == false , """"Speed" value must be between 1 and 20.""")
  237.  
  238.  
  239.  
  240. # calculation of crop values
  241. # ==========================
  242.  
  243.  
  244. null = (cropval == false ) ? eval("""
  245.  
  246. a = (Rightstr(loc,1) == "L" || Rightstr(loc,1) == "1") ? 0 : (Rightstr(loc,1) == "C" || Rightstr(loc,1) == "2") ? round((x*1/6))*2 : round((x*1/3))*2
  247. b = (leftstr(loc,1) == "T" || leftstr(loc,1) == "X") ? 0 : (leftstr(loc,1) == "M" || leftstr(loc,1) == "Y") ? round((y*1/6))*2 : round((y*1/3))*2
  248. c = (Rightstr(loc,1) == "R" || Rightstr(loc,1) == "3") ? 0 : (Rightstr(loc,1) == "C" || Rightstr(loc,1) == "2") ? -round((x*1/6))*2 : -round((x*1/3))*2
  249. d = (leftstr(loc,1) == "B" || leftstr(loc,1) == "Z") ? 0 : (leftstr(loc,1) == "M" || leftstr(loc,1) == "Y") ? -round((y*1/6))*2 : -round((y*1/3))*2
  250.  
  251. """) : eval("""
  252.  
  253. long = StrLen(loc)
  254.  
  255. posvirg1 = findstr(loc, ",")
  256. posvirg2 = findstr(rightstr(loc,long-posvirg1), ",")
  257. posvirg2 = posvirg2+posvirg1
  258. posvirg3 = findstr(rightstr(loc,long-posvirg2), ",")
  259. posvirg3 = posvirg3 + posvirg2
  260.  
  261. a = int(value(leftstr(loc,posvirg1-1)))
  262. b = int(value(leftstr(rightstr(loc,long-posvirg1),posvirg2-posvirg1-1)))
  263. c = int(value(leftstr(rightstr(loc,long-posvirg2),posvirg3-posvirg2-1)))
  264. d = int(value(rightstr(loc,long-posvirg3)))
  265. """)
  266.  
  267.  
  268. # crop of the part of the image where is the logo + mask creation
  269. # ================================================================
  270.  
  271.  
  272. cropped = clp.crop(a,b,c,d)
  273. in = (RGB32 == true) ? cropped : cropped.converttoRGB24()
  274. in2 = (spd == true) ? in.SelectRangeEvery (every=20, length=speed) : in
  275.  
  276. Masque = imagesource(mask,start=0,end=0).converttoRGB32 # ssS, Changed End=1 to End=0
  277. Masque = Masque.crop(a,b,c,d).levels(127,1,128,0,255)
  278. Masque = Masque.mask(Masque)
  279.  
  280. BlendedMask = Masque.DirtyBlur().levels(0,1,75,0,255)
  281. BlendedMask = BlendedMask.mask(BlendedMask)
  282. RepairMask = BlendedMask.levels(0,1,255,0,pp)
  283. #RepairEdge = Masque.DirtyBlur().levels(0,1,255,0,900) # ssS fix (removed)
  284. RepairEdge = Masque.DirtyBlur().IPF_Mask() # ssS fix (added)
  285. RepairEdge = RepairEdge.DirtyBlur().levels(0,1,75,0,pp)
  286.  
  287.  
  288. # check for an existing computed mask. If it doesn't exist or if reset = true --> computation
  289. # ===========================================================================================
  290.  
  291.  
  292. ID = mask + "InpaintFunc" + string(a) + string(b) + string(c) + string(d) + string(speed)
  293.  
  294. Logo = (reset == true) ? eval("""
  295.  
  296. in2.analyzelogo(Masque).trim(0,-1).converttoRGB32
  297. imagewriter(ID,0,1,"ebmp")
  298.  
  299. """) : eval("""
  300.  
  301. try
  302.  
  303. {imagesource(ID + "%06d.ebmp",0,0)}
  304. catch (dummy)
  305.  
  306. {in2.analyzelogo(Masque).trim(0,-1).converttoRGB32
  307. imagewriter(ID,0,1,"ebmp") }""")
  308.  
  309.  
  310. # Creation of the masks used for DeblendLogo and InpaintLogo
  311. # ==========================================================
  312.  
  313.  
  314. LogoColor = Logo.Crop(0,0,0,Logo.Height/2).converttoRGB24
  315.  
  316. LogoAlpha = Logo.Crop(0,Logo.Height/2,0,0)
  317. Logoalpha = LogoAlpha.mask(LogoAlpha)
  318.  
  319. LogoInpaint = LogoAlpha.mask(masque.dirtyblur().levels(0,1,32,0,255))
  320.  
  321.  
  322. # InpaintLogo and DeblendLogo are applied depending on the value of "mode"
  323. # ==========================================================================
  324.  
  325.  
  326. repaired = (mode == "both") ?
  327. \ in.DeblendLogo(LogoColor,LogoAlpha).
  328. \ InpaintLogo(LogoInpaint,radius=radius,sharpness=sharpness,preblur=preblur,postblur=postblur,PixelAspect=PAR).converttorgb32:
  329. \ (mode == "deblend") ?
  330. \ in.DeblendLogo(Logocolor,Logoalpha).converttorgb32 :
  331. \ in.InpaintLogo(LogoInpaint,radius=radius,sharpness=sharpness,preblur=preblur,postblur=postblur,PixelAspect=PAR).converttorgb32
  332.  
  333.  
  334. # Finalization of the repaired with post-processing
  335. # ==========================================================
  336.  
  337. repairedpp = (ppmode == 1) ? repaired.layer(repaired.DirtyBlur( ).mask(RepairMask)) :
  338. \ (ppmode == 2) ? repaired.layer(repaired.DirtyBlur(2).mask(RepairMask)) :
  339. \ (ppmode == 3) ? repaired.layer(repaired.DirtyBlur(2).DirtyBlur().mask(RepairEdge)) : repaired
  340.  
  341.  
  342. output = in.converttorgb32.Layer(repairedpp.Mask(BlendedMask))
  343.  
  344.  
  345. # Overlay of the cleaned portion over the original clip
  346. # =====================================================
  347.  
  348.  
  349. (show == true) ? Eval("""
  350.  
  351. cropped = cropped.subtitle("source").converttoRGB32
  352. masque = masque.subtitle("mask")
  353.  
  354. repairmask = repairmask.subtitle("repair mask")
  355. repairedge = repairedge.subtitle("repair edge")
  356.  
  357. Logoalpha = Logoalpha.subtitle("Logo alpha")
  358. Logocolor = Logocolor.subtitle("Logo color").converttoRGB32
  359. Logoinpaint = Logoinpaint.subtitle("Logo inpaint")
  360.  
  361. repaired = repaired.subtitle("repaired")
  362. repairedpp = repairedpp.subtitle("repaired pp")
  363.  
  364. l1 = Stackhorizontal(cropped,repaired,repairedpp)
  365. l2 = Stackhorizontal(masque,repairmask,repairedge)
  366. l3 = Stackhorizontal(logocolor,logoalpha,logoinpaint)
  367.  
  368. stackvertical (l1,l2,l3)
  369. return spline36resize(last,width(last),height(last))
  370.  
  371. """) : Eval("""
  372.  
  373. # v1.15, removed below, ssS
  374. # clp = (RGB32 == true) ? clp : clp.converttoRGB32
  375. # fullclip = clp.layer(output,x=a, y=b)
  376. # fullclip = (RGB == true) ? (RGB32 == true) ? fullclip : fullclip.converttoRGB24() : (YUY2 == true) ? fullclip.converttoYUY2() : fullclip.converttoYV12()
  377. # return fullclip
  378.  
  379. fullclip = clp.Overlay(output,x=a, y=b) # v1.15, Affect only loc area. ssS.
  380. return fullclip
  381.  
  382. """)
  383.  
  384. }
  385.  
  386.  
  387. #==========================================================================================================
  388. #==========================================================================================================
  389. #==========================================================================================================
  390.  
  391.  
  392. function InpaintAssist ( clip clp, string "loc", string "alignment") {
  393.  
  394.  
  395. loc = default (loc, "")
  396. x = width (clp)
  397. y = height (clp)
  398. alignment = default (alignment, "top")
  399. align = (alignment == "top") ? 8 : (alignment == "center") ? 5 : (alignment == "bottom") ? 2 :8
  400. framecount = framecount(clp)
  401.  
  402.  
  403. # I "Loc" parameter is not specified, split the clip in 9 parts et show crop value for each part
  404. # ==============================================================================================
  405.  
  406.  
  407. loc == "" ? Eval("""
  408.  
  409. white = blankclip(width=round(x/3),height=round(y/3),color=$FFFFFF,length=framecount)
  410. black = blankclip(width=round(x/3),height=round(y/3),color=$000000,length=framecount)
  411.  
  412. l1 = stackhorizontal(white,black,white)
  413. l2 = stackhorizontal(black,white,black)
  414. background = stackvertical(l1,l2,l1).converttoRGB32.spline36resize(x,y)
  415. clp = clp.converttoRGB32
  416.  
  417. a1 = string(0)
  418. a2 = string(round((x*1/6))*2)
  419. a3 = string(round((x*1/3))*2)
  420.  
  421. b1 = string(0)
  422. b2 = string(round((y*1/6))*2)
  423. b3 = string(round((y*1/3))*2)
  424.  
  425. ca1 = string(-round((x*1/3))*2)
  426. ca2 = string(-round((x*1/6))*2)
  427. ca3 = string(0)
  428.  
  429. d1 = string(-round((y*1/3))*2)
  430. d2 = string(-round((y*1/6))*2)
  431. d3 = string(0)
  432.  
  433. c1 = clp.crop(0 , 0 , -round((x*1/3))*2, -round((y*1/3))*2)
  434. \ .subtitle("TL (" + a1 + "," + b1 + "," + ca1 + "," + d1+ ")",align=8)
  435. c2 = clp.crop(round((x*1/6))*2, 0 , -round((x*1/6))*2, -round((y*1/3))*2)
  436. \ .subtitle("TC (" + a2 + "," + b1 + "," + ca2 + "," + d1+ ")",align=8)
  437. c3 = clp.crop(round((x*1/3))*2, 0 , 0 , -round((y*1/3))*2)
  438. \ .subtitle("TR (" + a3 + "," + b1 + "," + ca3 + "," + d1+ ")",align=8)
  439.  
  440. c4 = clp.crop(0 , round((y*1/6))*2 , -round((x*1/3))*2, -round((y*1/6))*2)
  441. \ .subtitle("ML (" + a1 + "," + b2 + "," + ca1 + "," + d2+ ")",align=8)
  442. c5 = clp.crop(round((x*1/6))*2, round((y*1/6))*2 , -round((x*1/6))*2, -round((y*1/6))*2)
  443. \ .subtitle("MC (" + a2 + "," + b2 + "," + ca2 + "," + d2+ ")",align=8)
  444. c6 = clp.crop(round((x*1/3))*2, round((y*1/6))*2 , 0 , -round((y*1/6))*2)
  445. \ .subtitle("MR (" + a3 + "," + b2 + "," + ca3 + "," + d2+ ")",align=8)
  446.  
  447. c7 = clp.crop(0 , round((y*1/3))*2, -round((x*1/3))*2, 0)
  448. \ .subtitle("BL (" + a1 + "," + b3 + "," + ca1 + "," + d3+ ")",align=8)
  449. c8 = clp.crop(round((x*1/6))*2, round((y*1/3))*2, -round((x*1/6))*2, 0)
  450. \ .subtitle("BC (" + a2 + "," + b3 + "," + ca2 + "," + d3+ ")",align=8)
  451. c9 = clp.crop(round((x*1/3))*2, round((y*1/3))*2, 0 , 0)
  452. \ .subtitle("BR (" + a3 + "," + b3 + "," + ca3 + "," + d3+ ")",align=8)
  453.  
  454. output = stackvertical(stackhorizontal(c1,c2,c3), stackhorizontal(c4,c5,c6), stackhorizontal(c7,c8,c9))
  455. output = output.spline36resize(x,y)
  456. clip1 = background.layer(output.mask(blankclip(output,color=$DEDEDE)))
  457.  
  458.  
  459. """) : nop
  460.  
  461.  
  462. # If "Loc" is specified, hightlight the part choosen by user
  463. # ==========================================================
  464.  
  465.  
  466. (strlen(loc) == 2) ? Eval("""
  467.  
  468. a = (Rightstr(loc,1) == "L" || Rightstr(loc,1) == "1") ? 0 : (Rightstr(loc,1) == "C" || Rightstr(loc,1) == "2") ? round((x*1/6))*2 : round((x*1/3))*2
  469. b = (leftstr(loc,1) == "T" || leftstr(loc,1) == "X") ? 0 : (leftstr(loc,1) == "M" || leftstr(loc,1) == "Y") ? round((y*1/6))*2 : round((y*1/3))*2
  470. c = (Rightstr(loc,1) == "R" || Rightstr(loc,1) == "3") ? 0 : (Rightstr(loc,1) == "C" || Rightstr(loc,1) == "2") ? -round((x*1/6))*2 : -round((x*1/3))*2
  471. d = (leftstr(loc,1) == "B" || leftstr(loc,1) == "Z") ? 0 : (leftstr(loc,1) == "M" || leftstr(loc,1) == "Y") ? -round((y*1/6))*2 : -round((y*1/3))*2
  472.  
  473. """) : (strlen(loc) != 0) ? eval("""
  474.  
  475. long = StrLen(loc)
  476. posvirg1 = findstr(loc, ",")
  477. posvirg2 = findstr(rightstr(loc,long-posvirg1), ",")
  478. posvirg2 = posvirg2+posvirg1
  479. posvirg3 = findstr(rightstr(loc,long-posvirg2), ",")
  480. posvirg3 = posvirg3 + posvirg2
  481.  
  482. a = int(value(leftstr(loc,posvirg1-1)))
  483. b = int(value(leftstr(rightstr(loc,long-posvirg1),posvirg2-posvirg1-1)))
  484. c = int(value(leftstr(rightstr(loc,long-posvirg2),posvirg3-posvirg2-1)))
  485. d = int(value(rightstr(loc,long-posvirg3)))
  486.  
  487. """) : nop
  488.  
  489.  
  490. (loc != "") ? eval("""
  491.  
  492. hightlight = blankclip(width=x-a+c,height=y-b+d,color=$96ff2d).converttoRGB32
  493. clip2 = clp.converttoRGB32.layer(hightlight.Mask(blankclip(hightlight, color=$444444)),x=a,y=b)
  494. return clip2.subtitle("Crop value : " + string(a) +", " +string(b) +", " +string(c) +", " +string(d), align=align, size=20 )
  495.  
  496. """) : clip1
  497.  
  498.  
  499. return last
  500. }
  501.  
  502.  
  503. #==========================================================================================================
  504. #==========================================================================================================
  505. #==========================================================================================================
  506.  
  507.  
  508.  
  509. function dirtyblur(clip clp, int "mode") {
  510. mode = default (mode, 1)
  511.  
  512. o = (mode == 1) ? clp.blur(1.58).GeneralConvolution (matrix="40 75 40 75 100 75 40 75 40").blur(1.58).blur(1.58).blur(1.58) :
  513. \ clp.converttoYUY2.temporalsoften(1,64,64,mode=2,scenechange=6).spatialsoften(2,255,255).converttoRGB32
  514.  
  515. return o
  516. }
  517.  
  518. Function IPF_Mask(clip c) { # ssS fix (added), Correction for fixed Levels bug. Returns RGB32
  519. c.ShowGreen(pixel_type="YV12").Mt_Lut(Mt_Polish("(x >= 164) ? 0 : x"))
  520. Return MergeRGB(Last,Last,Last).Levels(0,1.0,255,0,900)
  521. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement