cwolf
29th May 2006, 17:52
I don't know which to blame, but this script doesn't work to all the frames in the range but the first:
function patch(clip p,string "f",int "x",int "y", int "w",int "h",string "type")
{p
type == "f" ? scriptclip("freezeframe(current_frame,current_frame,"+f+")"): \
type == "m" ? mipsmooth(spatial=0,temporal=0,spatial_chroma=255, temporal_chroma=255,
\ scenechange=15, method="superstrong", scalefactor=0.65,downsizer ="bilinear",weigh=false) : \
scriptclip("applyflash(current_frame,1,"+f+")")
#stackhorizontal(last.crop(0,0,-160,-0),p.crop(352-160,0,-0,-0))
mt_lutxy(p,last,offx=x,offy=y,w=w,h=h,y=3,u=3,v=3,expr="y")
}
example of usage:
applyrange(12641,12644,"patch","12645",0,160,-1,-1,"f")
I use it to treat dirty in a part of the frame, like a patch to cover a hole in a cloth, when there's strong movement and the usage of a temporal filter would spoil more than cure if applyed to the whole frame. I know freezeframe is working but mt_lutxy ignores it after the first frame. I tried using value 4 for the y/u/v parameters but it slowed tremendously and didn't work. I had a similar problem with the script "applyflash", and solved that swapping freezeframe for trim¹. As a workaround I'm calling applyrange for each frame. I attached the source frames I want to clean (frames 1-5).
I'd appreciate if someone could figure out what's going on...
¹ The original script is here (http://forum.doom9.org/showthread.php?t=87187)
function applyflash(clip a, int fn, int qt,float "reducer",bool "resize")
{a
redutor = default(reducer,1)
resize = default(resize,true)
eval ("""applyrange (fn,fn+qt-1,"flash",fn,qt,reducer,resize)""")
}
function flash (clip f, int "first", int "qty", float "reducer", bool "resize")
{
scriptclip(f,"first = " +string(first) +chr(13)+
\ "qty = " +string(qty) +chr(13)+
\ "reducer= " +string(reducer) +chr(13)+
\ "resize = " +string(resize) +chr(13)+
\ """x= trim(first -1,-1)+trim(first+qty,-1)
x=x.vaguedenoiser(nsteps=6,chromat=3,threshold=3,method=3)
resize == true ? x.lanczos4resize(1024,512) : x
d= DePanEstimate(zoommax=2,fftw=true,trust=1)
offs= 1. / ( qty + 1.) * (current_frame - first + 1.) * reducer
DePan(x, data=d, offset=offs,info=false,mirror=15)
#subtitle (string(offs)+" "+string(first)+" "+string(qty),y=200)
#stackhorizontal(x.trim(0,-1).crop(0,0,360,0),x.trim(1,-1).crop(360,0,0,0))
""")
}
function patch(clip p,string "f",int "x",int "y", int "w",int "h",string "type")
{p
type == "f" ? scriptclip("freezeframe(current_frame,current_frame,"+f+")"): \
type == "m" ? mipsmooth(spatial=0,temporal=0,spatial_chroma=255, temporal_chroma=255,
\ scenechange=15, method="superstrong", scalefactor=0.65,downsizer ="bilinear",weigh=false) : \
scriptclip("applyflash(current_frame,1,"+f+")")
#stackhorizontal(last.crop(0,0,-160,-0),p.crop(352-160,0,-0,-0))
mt_lutxy(p,last,offx=x,offy=y,w=w,h=h,y=3,u=3,v=3,expr="y")
}
example of usage:
applyrange(12641,12644,"patch","12645",0,160,-1,-1,"f")
I use it to treat dirty in a part of the frame, like a patch to cover a hole in a cloth, when there's strong movement and the usage of a temporal filter would spoil more than cure if applyed to the whole frame. I know freezeframe is working but mt_lutxy ignores it after the first frame. I tried using value 4 for the y/u/v parameters but it slowed tremendously and didn't work. I had a similar problem with the script "applyflash", and solved that swapping freezeframe for trim¹. As a workaround I'm calling applyrange for each frame. I attached the source frames I want to clean (frames 1-5).
I'd appreciate if someone could figure out what's going on...
¹ The original script is here (http://forum.doom9.org/showthread.php?t=87187)
function applyflash(clip a, int fn, int qt,float "reducer",bool "resize")
{a
redutor = default(reducer,1)
resize = default(resize,true)
eval ("""applyrange (fn,fn+qt-1,"flash",fn,qt,reducer,resize)""")
}
function flash (clip f, int "first", int "qty", float "reducer", bool "resize")
{
scriptclip(f,"first = " +string(first) +chr(13)+
\ "qty = " +string(qty) +chr(13)+
\ "reducer= " +string(reducer) +chr(13)+
\ "resize = " +string(resize) +chr(13)+
\ """x= trim(first -1,-1)+trim(first+qty,-1)
x=x.vaguedenoiser(nsteps=6,chromat=3,threshold=3,method=3)
resize == true ? x.lanczos4resize(1024,512) : x
d= DePanEstimate(zoommax=2,fftw=true,trust=1)
offs= 1. / ( qty + 1.) * (current_frame - first + 1.) * reducer
DePan(x, data=d, offset=offs,info=false,mirror=15)
#subtitle (string(offs)+" "+string(first)+" "+string(qty),y=200)
#stackhorizontal(x.trim(0,-1).crop(0,0,360,0),x.trim(1,-1).crop(360,0,0,0))
""")
}