Log in

View Full Version : MaskTool command(s)


EroKaos
22nd November 2007, 04:13
I recently got a script from a friend that helped clean up some artifacts that I have never encountered before and I never had the opportunity to use MaskTools, until now. But the script he gave me looks quite complicated to me and could not make much sense of it. I tried to read the masktool faq but it did not help much. So, would it be possible for someone to explain it to me?

Here is the code:
LoadPlugin("E:\Apps\Encoding Tools\YATTA 6.118\Plugins\fft3dfilter.dll")
LoadPlugin("E:\Apps\Encoding Tools\YATTA 6.118\Plugins\MaskTools.dll")
LoadPlugin("E:\Apps\Encoding Tools\YATTA 6.118\Plugins\MSharpen.dll")
LoadPlugin("E:\Apps\Encoding Tools\YATTA 6.118\Plugins\removegrain.dll")
ImageReader("C:\Documents and Settings\Desktop\clipboard01.jpg")
ConvertToYV12()
source = last
edge = source.MSharpen(1,10).EdgeMask(thY1 = 0, thY2 = 4, thC1 = 0, thC2 = 4,type="roberts") #use 8 8 otherwise
FFT3DFilter_FFT3DFilter(sigma=4.0, plane=0)
denoised = last
Overlay(source, maskedmerge(denoised,edge), x=0, y=0, opacity=0.6, mode="blend", greymask=true, ignore_conditional=false, pc_range=false)

Any help is appreciated. Thanks

Didée
22nd November 2007, 08:45
What he propably wanted to do is: make a mask of the edge areas, apply FFT3DFilter to only the edge areas, then apply the whole to the source by 60%.

However, things are mixed up in that script. All the stuff related to edges and maskedmerge effectively does nothing but throw CPU cycles down the drain: since maskedmerge is fed with only 2 clips (denoised and edge), it takes 'implicit last' as 1st input clip, which is 'denoised' as well, so that maskedmerge effectively is merging 'denoised' onto 'denoised' by 'edges'.
Thus, the whole thing actually is equivalent to

source
merge( FFT3DFilter(..), 0.6 )

You have to write maskedmerge(source,denoised,edge) to get the intended effect. Or vice versa: maskedmerge(denoised,source,edge) ... it is impossible to say which way round the operation was intended originally.