leon1789
13th August 2011, 23:06
Hello
Let's have a look about this little code : it's compute a mask depanding of local means and variances of two clip v and w.
function mean (clip v)
{
st = "1 1 1 1 1 1 1"
v.mt_convolution(st,st,y=3,u=3,v=3)
}
function variance (clip v)
{
w = v.mean
mt_lutxy(v,w,"x y - 2 ^",y=3,u=3,v=3).mean
}
function mask (clip v, clip w)
{
vv = v.mean
ww = w.mean
mask_mean = mt_lutxy(vv,ww, "y x - 2 ^ 50 *", y=3,u=3,v=3)
vm = merge(v,w).variance
mv = merge(v.variance, w.variance)
mask_var = mt_lutxy(vm,mv, "y x - 2 ^ 50 *", y=3,u=3,v=3)
mt_lutxy(mask_mean, mask_var, "255 x - y -", y=3,u=3,v=3)
}
The problem : this code is quiet slow... Is there a tool to do similar calculus in "high speed way" ?
I will use this function mask in order to merge a source clip (v) with a denoised (w) in order to increase the compressibility of the video (v). For instance
w = v.deen()
m = mask(v, w)
mt_merge(v, w, m, y=3,u=3,v=3)
Any suggestion (about the code or other adea) is welcome.
Thanks!
Let's have a look about this little code : it's compute a mask depanding of local means and variances of two clip v and w.
function mean (clip v)
{
st = "1 1 1 1 1 1 1"
v.mt_convolution(st,st,y=3,u=3,v=3)
}
function variance (clip v)
{
w = v.mean
mt_lutxy(v,w,"x y - 2 ^",y=3,u=3,v=3).mean
}
function mask (clip v, clip w)
{
vv = v.mean
ww = w.mean
mask_mean = mt_lutxy(vv,ww, "y x - 2 ^ 50 *", y=3,u=3,v=3)
vm = merge(v,w).variance
mv = merge(v.variance, w.variance)
mask_var = mt_lutxy(vm,mv, "y x - 2 ^ 50 *", y=3,u=3,v=3)
mt_lutxy(mask_mean, mask_var, "255 x - y -", y=3,u=3,v=3)
}
The problem : this code is quiet slow... Is there a tool to do similar calculus in "high speed way" ?
I will use this function mask in order to merge a source clip (v) with a denoised (w) in order to increase the compressibility of the video (v). For instance
w = v.deen()
m = mask(v, w)
mt_merge(v, w, m, y=3,u=3,v=3)
Any suggestion (about the code or other adea) is welcome.
Thanks!