View Full Version : Make a Function
Mounir
12th April 2014, 17:11
I'd need to turn the following code into a function so i can use applyrange in my script to selectively filter the frames i want, thanks for your help
noisy = last
nonoise = RemoveDirtMC.fft3dfilter(sigma=7.0,sigma2=7.0,sigma3=7.0,sigma4=7.0, bt=1, bw=32, bh=32, ow=16, oh=16,plane=0, sharpen=0.0,interlaced=false,dehalo=0.0)
diff = 10 # Difference between denoised and noisy clips
m = mt_lutxy(noisy,nonoise,"y x - "+string(diff)+" - 255 *")
mt_merge(noisy,nonoise,m)
in the end i would use this:
ApplyRange(225,229,"MyFunction")
raffriff42
12th April 2014, 18:26
Easy :Dfunction MyFunction(clip C)
{
Last = C
noisy = last
nonoise = RemoveDirtMC.fft3dfilter(sigma=7.0,sigma2=7.0,sigma3=7.0,sigma4=7.0,
\ bt=1, bw=32, bh=32, ow=16, oh=16,plane=0,
\ sharpen=0.0,interlaced=false,dehalo=0.0)
diff = 10 # Difference between denoised and noisy clips
m = mt_lutxy(noisy,nonoise,"y x - "+string(diff)+" - 255 *")
mt_merge(noisy,nonoise,m)
return Last
}
Mounir
12th April 2014, 18:31
you're the man, works like a charm
creaothceann
12th April 2014, 20:03
Fixed ;)
function MyFunction(clip Source) {
Difference = 10 # difference between source and cleaned clip
Cleaned = Source.RemoveDirtMC.FFT3DFilter(sigma=7.0, sigma2=7.0, sigma3=7.0, sigma4=7.0, bt=1, bw=32, bh=32, ow=16, oh=16, plane=0, sharpen=0.0, interlaced=false, dehalo=0.0)
Mask = MT_LUTxy(Source, Cleaned, "y x - " + string(Difference) + " - 255 *")
MT_Merge(Source, Cleaned, Mask)
}
raffriff42
12th April 2014, 20:07
I was was demonstrating the general way to convert any block of code into a function :)
bxyhxyh
13th April 2014, 14:28
plane=0, sharpen=0.0, interlaced=false, dehalo=0.0 are default values of fft3dfilter.
So they are not needed.
Maybe you would use different sigma and diff values for different sources.
function MyFunction(clip Source, float "sigma", float "sigma2", float "sigma3", float "sigma4", int "diff")
{
diff = default(diff,10) # difference between source and cleaned clip
sigma = default(sigma,7.0)
sigma2 = default(sigma2,7.0)
sigma3 = default(sigma3,7.0)
sigma4 = default(sigma4,7.0)
Cleaned = Source.RemoveDirtMC.FFT3DFilter(sigma=sigma, sigma2=sigma2, sigma3=sigma3, sigma4=sigma4, bt=1, bw=32, bh=32, ow=16, oh=16)
Mask = MT_LUTxy(Source, Cleaned, "y x - " + string(diff) + " - 255 *")
MT_Merge(Source, Cleaned, Mask)
}
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.