View Single Post
Old 31st August 2008, 00:22   #10  |  Link
Avisynth_challenged
Registered User
 
Join Date: Dec 2007
Posts: 117
Quote:
Originally Posted by Didée View Post
To get you started, here's your suggestion as a working script:

Code:
Clip1      = last
Shiftr_2px = Clip1.crop(0,0,-2,-0).addborders(2,0,0,0)
Mask1      = Shiftr_2px.mt_edge("min/max",4,48,0,255,U=-128,V=-128) # try different "modes" and 
Shiftr_4px = Clip1.crop(0,0,-4,-0).addborders(4,0,0,0)
Mask2      = Shiftr_4px.mt_edge("min/max",4,48,0,255,U=-128,V=-128) # thresholds for tweaking
Mask2i     = Mask2.mt_invert(U=2,V=2)
Maskhalo   = mt_logic(Mask1,Mask2i,"min") # "min" is for greyscale masks what "and" is for B/W masks
Halofix    = Clip1.crop(2,0,-0,-0).addborders(0,0,2,0)
Final      = mt_merge(Clip1,Halofix,Maskhalo,U=2,V=2)

interleave(Clip1,Final)

return(last)
Result: not quite perfect.

Thank you so much, Didée. I've been messing around with this script for hours.

I've taken another approach - using a ghost correction filter to generate a greyscale clip in hopes that it could be used for masking. Here's an example:


ORIGINAL FRAME (with halos):


GREYSCALE CLIP (halo mask?):



Can the greyscale clip be used as a halo correction mask? I didn't use masktools to make the clip, so I wasn't sure. Here's the script that did make the clip, which is called "diff2"


### BEGIN SCRIPT ###
# This line loads the source
source=DirectshowSource("...source.avi")
############
sourcex=source.converttoyv12

start=source.spatialsoften(1,255,127).converttoyv12.greyscale.Tweak(0.0, 1.0, 0, 1.0, true, false)
ghostA=source.spatialsoften(1,255,127).converttoyv12.LGhost(3, 4, -128).greyscale.Tweak(0.0, 1.01, 0, 1.25, true, false)
diffA=Subtract(ghostA, start).Levels(127, 1, 129, 0, 255).invert().undot()

ghostB=source.spatialsoften(1,255,127).converttoyv12.LGhost(3, 0, -128).greyscale.Tweak(0.0, 1.01, 0, 1.25, true, false)
diffB=Subtract(ghostB, start).Levels(127, 1, 129, 0, 255).invert().undot()

diff2=Subtract(ghostA, ghostB).invert()
return diff2
### END SCRIPT ###

Thanks to all for feedback and comments

Last edited by Avisynth_challenged; 31st August 2008 at 16:03. Reason: Fixed typo
Avisynth_challenged is offline   Reply With Quote