Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- #
- # File: RemoveSpots.avsi
- #
- # RemoveSpots and moution compensated RemoveSpots functions
- #
- # Functions:
- #
- # function NullClip(clip clp)
- #
- # function RemoveSpots(clip clp, int "limit", bool "_grey")
- # function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
- #
- # function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
- #
- # function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
- #
- # function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
- #
- # function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
- #
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEFLICKER_25_DLL_20040816\deflicker.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DESPOT_3_6_1\despot.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depan.dll")
- # LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depanestimate.dll")
- # ############ ONLY EDIT LOCATIONS BELOW
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\RemoveDirtSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\removedirtSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\RepairSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\RemovegrainSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\RepairTSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\RemoveGrainT.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\mvtools2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\removedirtSSE2.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\fluxsmooth.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\vaguedenoiser.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\deflicker.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\despot.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\mt_masktools-25.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\masktools.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\fft3dfilter.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\depan.dll")
- LoadPlugin("C:\PROGRAM FILES (x86)\AVISYNTH 2.5\PLUGINS\depanestimate.dll")
- (_use_VDub_ == true) ? LoadVirtualDubPlugin("C:\PROGRAM FILES\VIRTUALDUB 1.9.11\PLUGINS\spotremover.vdf", "SpotRemover", 11) : NOP()
- function NullClip(clip clp)
- {
- return BlankClip(clp, length=0)
- }
- # =============================================================================
- #
- #
- function RemoveSpots(clip clp, int "limit", bool "_grey")
- {
- _grey = Default(_grey, false)
- limit = Default(limit, 16)
- clmode = 17
- clensed = Clense(clp, grey=_grey, cache=4)
- sbegin = ForwardClense(clp, grey=_grey, cache=-1)
- send = BackwardClense(clp, grey=_grey, cache=-1)
- alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
- restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
- clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
- dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
- return clp
- }
- function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
- {
- _grey = Default(_grey, false)
- limit = Default(limit, 16)
- Vectors = Default(Vectors, 1)
- Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
- super = MSuper(clp, pel=2, sharp=2)
- bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
- backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
- backw1 = MFlow(clp, super, bvec1)
- forw1 = MFlow(clp, super, fvec1)
- forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
- forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
- clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
- (Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
- interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
- clp = RemoveSpots(clp, limit=limit, _grey=_grey)
- clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
- (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
- SelectEvery(clp, 7, 3)
- return clp
- }
- # =============================================================================
- #
- # SpotRemover() function VirtualDub
- #
- function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
- {
- # Constant
- #
- TypeMax = 4
- # Variables
- #
- type = Default(type, 1)
- show = Default(show, false)
- Vectors = Default(Vectors, 2)
- type = (type < 1) ? 1 : (type > TypeMax) ? TypeMax : type
- Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
- # create auxialiary smooth clip for easier motion detection
- #
- filter = clp.DeFlicker(noise=6).Blur(1.58)
- # this is for internal use by MVtools functions. MVtools' version must be 2.0 or higher.
- #
- super = MSuper(clp, pel=2, sharp=2)
- superfi = MSuper(filter, pel=2, sharp=2)
- # calculate the motion vectors
- #
- bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
- bvec2 = MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
- bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
- fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
- fvec2 = MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
- fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
- # create 6 additional clips: two predicted backward and two predicted forward
- #
- backw3 = (Vectors == 3) ? MCompensate(clp, super, bvec3) : NullClip(clp)
- backw2 = (Vectors >= 2) ? MCompensate(clp, super, bvec2) : NullClip(clp)
- backw1 = MCompensate(clp, super, bvec1)
- forw1 = MCompensate(clp, super, fvec1)
- forw2 = (Vectors >= 2) ? MCompensate(clp, super, fvec2) : NullClip(clp)
- forw3 = (Vectors == 3) ? MCompensate(clp, super, fvec3) : NullClip(clp)
- # clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
- # MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
- clpdeg = clp
- # combine the 5 frames (2 + 1 + 2), the central one undergoes the degrain filter
- # combine the 3 frames (1 + 1 + 1), the central one undergoes the degrain filter
- # combine the 7 frames (3 + 1 + 3), the central one undergoes the degrain filter
- #
- clp = (Vectors == 1) ? interleave(backw1, clpdeg, ff1) : \
- (Vectors == 2) ? interleave(backw2, backw1, clpdeg, forw1, forw2) : \
- interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
- # run SpotRemover over each block of 5 (3, 7) frames
- # removing spots only, no smoothing
- # !!! change to DSD:0 to turn the debug mode off
- # !!! change to DSD:1 to turn the debug mode on
- #
- # SSI - Smooth Strength Intensity
- # SSC - Smooth Strength Color
- # SKW - Smooth Kernel Width
- # SLI - Smooth Locking level for Intensity
- # SLC - Smooth Locking level for Color
- # SLD - Smooth Locking Debug
- # DLS - Detect Level for Spot detection
- # DLC - Detect Level for Clearance
- # DPC - Detect Perimeter Clearance
- # DSF - Detect Spot Fullness factor
- # DSD - Detect Spot Debug
- # MTX - Motion Table X (columns)
- # MTY - Motion Table Y (columns)
- # MTL - Motion Table Level to flag cells
- # MDX - Motion Distance X
- # MDY - Motion Distance Y
- # MIH - Motion Interrupted History
- # CBR - Color BRightness
- # CCO - Color COntrast
- # CSA - Color SAturation
- # CBA - Color Balance
- # CSR - Color Shift Red
- # CSB - Color Shift Blue
- # FCI - Frame Control Interlaced
- clp = clp.ConvertToRGB32()
- clp = (type == 1) ? (show == false) ? \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:0 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:1 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : clp
- clp = (type == 2) ? (show == false) ? \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
- clp = (type == 3) ? (show == false) ? \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
- clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
- clp = (type == 4) ? (show == false) ? \
- clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
- clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
- # clp = clp.ConvertBackToYUY2()
- clp = clp.ConvertToYV12()
- # discard extra frames, keep only the central one
- #
- clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
- (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
- SelectEvery(clp, 7, 3)
- # compensate for the SpotRemover lag. We will loose the last frame in the movie, but the audio will be in sync
- #
- # clp = clp.Trim(1, 0) # Maybe not needed
- # enhance the contrast (optional)
- #
- # clp = clp.ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80, cont_u=0, cont_v=0)
- return clp
- }
- global Width2 = 768
- global Height2 = 576
- # =============================================================================
- #
- # DeSpot() function
- #
- function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
- {
- # Constants
- #
- _thSCD1 = 400
- Vectors = Default(Vectors, 3)
- Show = Default(Show, 0)
- Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
- Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
- filter = DeFlicker(clp, border=150, percent=70, lmin=5, lmax=240)
- super = MSuper(clp, pel=2, sharp=2)
- superfi = MSuper(filter, pel=2, sharp=2)
- bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
- backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
- backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
- forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
- forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
- forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
- # clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
- # MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
- clpdeg = clp
- clp = (Vectors == 1) ? Interleave(backw1, clpdeg, forw1) : \
- (Vectors == 2) ? Interleave(backw2, backw1, clpdeg, forw1, forw2) : \
- Interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
- clp = clp.Deflicker(percent=99, lag=5, scene=15, info=false)
- # ==== ??????? ?????? ????? ====
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
- # ==== ??????? ????? ????? ====
- clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
- pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
- # ==== ????????? ????? ? ???? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
- pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- # ==== ????????? ?????????? ????? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
- # ==== ?????, ???????? ? ??????? ? ?????????, ???????? ??????? ???????? ====
- clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
- pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- # ====================================
- clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
- motpn=true, fitluma=true, mark_v=255)
- clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
- motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
- color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
- clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
- color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
- blur=2, ranked=true, interlaced=false, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
- show=Show, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
- p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
- motpn=true, fitluma=true, blur=1, mark_v=255)
- clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
- mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
- clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
- merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, \
- blur=1, mark_v=255)
- clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
- merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
- # big black spots
- # clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, mark_v=255)
- # thin white lines
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, mark_v=255)
- # thick hair lines (avoid real hair)
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, mark_v=255)
- # lines contacting motion, avoid motion areas
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, mark_v=255)
- # small dots and dust
- # clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, mark_v=255)
- # Long horizontal scratches
- # clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
- # Small compact spots
- # clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
- clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
- (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
- SelectEvery(clp, 7, 3)
- return clp
- }
- # =============================================================================
- #
- # DeSpot() function
- #
- function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
- {
- # Constants
- #
- _thSCD1 = 400
- _ml = 100
- Vectors = Default(Vectors, 1)
- Show = Default(Show, 0)
- Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
- Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
- filter = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
- super = MSuper(clp, pel=2, sharp=2)
- superfi = MSuper(filter, pel=2, sharp=2)
- bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
- fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
- backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
- backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
- backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
- forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
- forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
- forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
- sadb = MMask(clp, bvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
- sadf = MMask(clp, fvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
- msadb = MT_Binarize(sadb, 20, upper=true)
- msadf = MT_Binarize(sadf, 20, upper=true)
- msad = MT_Logic(msadf, msadb, "or")
- msad = MT_Expand(msad)
- msadi = Interleave(msad, msad, msad)
- clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
- (Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
- Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
- # ==== ??????? ?????? ????? ====
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ??????? ????? ????? ====
- clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
- pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ??????? ????? ???? ????? (???????? ???????? ?????) ====
- clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=24, interlaced=false, median=false, p1=15, p2=13, \
- pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ?????, ???????? ? ??????? ? ?????????, ???????? ??????? ???????? ====
- clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
- pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ????????? ????? ? ???? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
- pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ??????? ?????????????? ?????? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=100, pheight=2, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
- # ==== ????????? ?????????? ????? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
- # ====================================
- clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
- motpn=true, fitluma=true, extmask=msadi)
- clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
- motpn=true, extmask=msadi)
- clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, extmask=msadi)
- clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, extmask=msadi)
- clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
- color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, extmask=msadi)
- clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
- color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
- blur=2, ranked=true, interlaced=false, extmask=msadi)
- clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
- color=true, motpn=true, extmask=msadi)
- clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
- show=Show, extmask=msadi)
- clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, \
- extmask=msadi)
- clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
- p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
- motpn=true, fitluma=true, blur=1, extmask=msadi)
- clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
- mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, \
- extmask=msadi)
- clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
- merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
- mark_v=255, extmask=msadi)
- clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
- merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255, \
- extmask=msadi)
- # big black spots
- # clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, extmask=msadi)
- # thin white lines
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, extmask=msadi)
- # thick hair lines (avoid real hair)
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, extmask=msadi)
- # lines contacting motion, avoid motion areas
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, extmask=msadi)
- # small dots and dust
- # clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, extmask=msadi)
- # Long horizontal scratches
- # clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
- # Small compact spots
- # clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
- clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
- (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
- SelectEvery(clp, 7, 3)
- return clp
- }
- # =============================================================================
- #
- # DeSpot() function
- #
- function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
- {
- Vectors = Default(Vectors, 1)
- Show = Default(Show, 0)
- Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
- Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
- d = clp.DePanEstimate(trust=3, range=1)
- clp = clp.DePanInterleave(data=d, prev=Vectors, next=Vectors)
- # ==== ??????? ?????? ????? ====
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
- # ==== ??????? ????? ????? ====
- clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
- pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
- # ==== ????????? ????? ? ???? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
- pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- # ==== ????????? ?????????? ????? ====
- clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
- pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
- blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
- # ==== ?????, ???????? ? ??????? ? ?????????, ???????? ??????? ???????? ====
- clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
- pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
- blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
- # ====================================
- clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
- motpn=true, fitluma=true, mark_v=255)
- clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
- motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
- color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
- clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
- color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
- blur=2, ranked=true, interlaced=false, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
- color=true, motpn=true, mark_v=255)
- clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
- show=Show)
- clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show)
- clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
- show=Show, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
- clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
- p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
- motpn=true, fitluma=true, blur=1, mark_v=255)
- clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
- mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
- clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
- merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
- mark_v=255)
- clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
- merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
- # big black spots
- # clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show)
- # thin white lines
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show)
- # thick hair lines (avoid real hair)
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show)
- # lines contacting motion, avoid motion areas
- # clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show)
- # small dots and dust
- # clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show)
- # Long horizontal scratches
- # clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show)
- # Small compact spots
- # clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show)
- clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
- (Vectors == 2) ? SelectEvery(clp, 5, 2) : \
- SelectEvery(clp, 7, 3)
- return clp
- }
Advertisement
Add Comment
Please, Sign In to add comment