Mug Funky
24th June 2003, 15:06
hi again to everyone. i've been posting a bit lately, so sorry if that's getting annoying...
my university finally got itself a green screen, so i've been testing it out a tad. i thoght it would be great to write a script to do it for me, because premiere and after effects weren't giving me terrifically good results. so after a few hours playing about and some heavy thinking, i came up with something that works okay.
i'd like to give you some example footage, but i don't think my friend who appears in it would be happy with that :( ... also i'm on a dialup etc...
to test it yourself just chage the avisource bits and use some footage with a lot of bright green in it...
# Load source with green screen visible
clip=avisource("f:\captures\green screen.avi").separatefields()
# Make a blank grey clip to put chroma onto (important for later)
grey=blankclip(clip,color=$808080,pixel_type="yuy2")
# Load up some background footage
base=avisource("c:\ack\uni\clouds.avi").separatefields()
# make chroma only clip, kill all but green, turn it into a b/w clip good as an alpha
# you will need to play with the levels on the end of this to change tolerances.
mymask=mergechroma(grey,clip).converttorgb32().rgbadjust(0,1,0,0).greyscale().levels(94,.5,76,0,255).convertbacktoyuy2().SpatialSoften(1,128,128).converttorgb32()
# convert the original clip to RGB32 so it can have an alpha attached
rgbclip=clip.converttorgb32()
# Attach the alpha to the source clip in rgb32
goodclip=mask(rgbclip,mymask)
# Overlay the clips.
layer(base,goodclip, level=255, op="add").convertbacktoyuy2()#.bob().bicubicresize(384,288,.333,.333)
# Merge fields into interlaced frames again
weave()
NOW... one thing i'd like to be able to do here is have a way to isolate one colour channel as a greyscale clip (like in photoshop, you can select one channel and copy it as greyscale).
that way i'd be able to get a LOT more tonal range to play with when matting.
another thing that'd be awesome is for this to be automated into a single filter with the same flexibility. (here's where i wish i knew C++).
any thoughts?
my university finally got itself a green screen, so i've been testing it out a tad. i thoght it would be great to write a script to do it for me, because premiere and after effects weren't giving me terrifically good results. so after a few hours playing about and some heavy thinking, i came up with something that works okay.
i'd like to give you some example footage, but i don't think my friend who appears in it would be happy with that :( ... also i'm on a dialup etc...
to test it yourself just chage the avisource bits and use some footage with a lot of bright green in it...
# Load source with green screen visible
clip=avisource("f:\captures\green screen.avi").separatefields()
# Make a blank grey clip to put chroma onto (important for later)
grey=blankclip(clip,color=$808080,pixel_type="yuy2")
# Load up some background footage
base=avisource("c:\ack\uni\clouds.avi").separatefields()
# make chroma only clip, kill all but green, turn it into a b/w clip good as an alpha
# you will need to play with the levels on the end of this to change tolerances.
mymask=mergechroma(grey,clip).converttorgb32().rgbadjust(0,1,0,0).greyscale().levels(94,.5,76,0,255).convertbacktoyuy2().SpatialSoften(1,128,128).converttorgb32()
# convert the original clip to RGB32 so it can have an alpha attached
rgbclip=clip.converttorgb32()
# Attach the alpha to the source clip in rgb32
goodclip=mask(rgbclip,mymask)
# Overlay the clips.
layer(base,goodclip, level=255, op="add").convertbacktoyuy2()#.bob().bicubicresize(384,288,.333,.333)
# Merge fields into interlaced frames again
weave()
NOW... one thing i'd like to be able to do here is have a way to isolate one colour channel as a greyscale clip (like in photoshop, you can select one channel and copy it as greyscale).
that way i'd be able to get a LOT more tonal range to play with when matting.
another thing that'd be awesome is for this to be automated into a single filter with the same flexibility. (here's where i wish i knew C++).
any thoughts?