View Full Version : Spill suppression script?
NerdWithNoLife
22nd August 2008, 20:30
I'm able to do green screening with AviSynth with the help of Cinegobs Keyer but I'm looking for a way to achieve spill suppression via AviSynth.
In the method I'm using I save an alpha channel from Cinegobs (it's a greyscale video), which I use to layer the finished video together in a script.
But in doing it this way, I cannot make use of Cinegob's spill suppression - since the alpha layer only determines which parts of the clip are transparent - but it doesn't change colors of the clip to hide the green that bleeds through from the screen.
Does anyone have ideas on minimizing that annoying green glow via AviSynth?
mikeytown2
22nd August 2008, 21:07
Post some example footage, and your script
http://www.cinegobs.com/index.php?page=CineGobs_Keyer
In the mean time
http://avisynth.org/mediawiki/Layer#ColorKeyMask
http://expsat.sourceforge.net/Colorize_ex.htm
http://forum.doom9.org/showthread.php?p=777956#post777956
http://avisynth.org/mediawiki/MaskTools2
NerdWithNoLife
23rd August 2008, 01:45
Here is the link to a sample:
http://rapidshare.com/files/139383873/sample.zip.html
Just unzip the files to the same folder. The script is in the zip file, but here it is too:
hand=avisource("hand.avi") #This is the part I want to modify.
key=avisource("key.avi")
bg=imagesource("bg.png",pixel_type="rgb32").assumefps(hand).trim(0,4)
hand=mask(hand,key)
layer(bg,hand,"add",255)
The lighting is horrible - but the only thing I want to focus on in this example is the green around the edges of my hand (I left a little extra for demonstration purposes). That is what I want to minimize - by modifying the clip labeled "hand" in the script.
mikeytown2
24th August 2008, 19:15
@NerdWithNoLife
Rapidshare is giving me trouble with the file.
Edit: finally got it, guess Rapidshare is not 100% uptime.
mikeytown2
25th August 2008, 01:08
thread that I found
http://forum.doom9.org/showthread.php?t=69464
@NerdWithNoLife The alpha/key clip is 2 bit, there is no dithering of the mask. The way you are currently using Cinegobs Keyer isn't working that well... That is why it looks bad. I recommend a complete avisynth approach because your source is grainy and the greenscreen is not lit up that well.
Here's a script for you to try
#load sources
hand=avisource("hand.avi")
key=avisource("key.avi")
bg=imagesource("bg.png",pixel_type="rgb32").assumefps(hand).trim(0,5)
#Create Mask/Key/Matte
matte = hand.ConvertToYUY2().FFT3DFilter(sigma=4,plane=4,bt=5).vtoy()
matte = matte.Spline16Resize(hand.width,hand.height)
matte = matte.levels(130,1,136,0,255)
outA= overlay(bg,hand,mask=matte.ColorYUV(levels="TV->PC"),opacity=1).ConvertToYUY2()
#NerdWithNoLife
handB=mask(hand,key)
outB=layer(bg,handB,"add",255)
#NerdWithNoLife with blured, shrunk, blured mask
keyC=key.Blur(1.58).Blur(1.58).levels(64,1,255,0,255).Blur(1.58)
handC=mask(hand,keyC)
outC=layer(bg,handC,"add",255)
#Compare results
a=StackHorizontal(matte,outA)
b=StackHorizontal(key,outB).ConvertToYUY2()
c=StackHorizontal(keyC,outC).ConvertToYUY2()
StackVertical(a,b,c)
Anyone know how to use masktools with a green screen? Seems like a natural fit.
NerdWithNoLife
25th August 2008, 03:38
I've lit better green/blue screen footage - was just trying to get something up quick on short notice. Usually I do internet videos so AviSynth/Cinegobs is an OK no budget solution (since my Mac with Final Cut Pro crashed!). The benefit of Cinegobs keyer is the ability to play around with it with different methods of keying. The only problem I've had with it is - it can't (to my knowledge) overlay the keyed footage over a moving background - that's where AviSynth comes in.
Again, it usually looks better when I take more time to light it well. And usually I use blue instead of green which spills less (in my tests, anyway). But there is some old green screen footage I can't reshoot that could use some spill suppression.
IanB
25th August 2008, 07:54
This will set the saturation of matching areas to 0, it may be enough to make it less obvious....
greenHue=180 # Hue of leaking green
greenSat=100 # Saturation of leaking green
Tweak (sat=0, startHue=greenhue-2, endHue=greenHue+2, maxSat=greenSat+5, minSat=greenSat-5)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.