Is there a script for AviSynth that will do chroma keying?
+ Reply to Thread
Results 1 to 13 of 13
-
Hi,
I'm not sure if you're talking the same thing here, but have you tried using
the chroma smoother fitler built-into virtualdub v1.5.10 ??
It has 6 chroma settings.. including one for DV (4:1:1) but it has to be an
honest suffer of the chroma bug to work (be noticable) .
-vhelp -
ColorKeyMask(clip clip, int color, int tolerance)
the selected color will then be transparent. Now just layer that clip with another clip, and you got it. Here's an example:
Code:clip1=colorbars(720,480).converttorgb32() transparent=resetmask(clip1).colorkeymask($0DB40C, 128) clip2=version().bicubicresize(720,480).converttorgb32() layer(clip2, transparent)
-
Lets suppose that clip1 is you walking around on a green screen. Clip2 is a beautiful video of a beach somewhere.
I would recommend you take a screenshot, and open the screenshot in a paint program to determine the appx color. (I used virtualdub to get the screenshot, and paintshop pro to determine the color). Then adjust the tolerance if you need more/less.
Code:clip1=avisource("MeAndTheGreenScreen.avi").converttorgb32() transparent=resetmask(clip1).colorkeymask($0DB40C, 128) clip2=avisource("BeautifulScenery.avi").converttorgb32() layer(clip2, transparent)
-
So if my green screen is slighly darker on one side than the other, I can just try to find a shade of green inbetween the light and dark side for the transparent color?
-
Yes, try to find a shade that it the average 'green', then adjust the tolerance. The larger the value in the tolerance, the more that will be transparent. Below is the function's documentation from www.avisynth.org
ColorKeyMask [RGB32]
ColorKeyMask(clip clip, int color, int tolerance)
Sets the alpha-channel (similar as Mask does) but generates it by comparing the color. Each pixel with a color differing less than tolerance is set to transparent, otherwise it is left unchanged (it is NOT set to opaque). -
Great thread. I looked into this a while back with no results. My questions is, what makes "green" equate to $0DB40C? What's blue then? etc, etc...
-
$0DB40C is the color if the 'green' portion of the colorbars example. pure green would be $00ff00 Blue would be $0000ff. As I mentioned before, take a screenshot and open in a paint program to determine the color needed to key out. (Paintshop pro has a tool for determining the color of a pixel.)
-
The gimp also has a tool for picking a color. It will give it to you in three values, ie. Red=97 Green=176 Blue=111. There is a handy converter on the web that will change these numbers into a hex number for you. It is found at http://www.321webmaster.com/colorconverter.php
Thanks for this post. It has helped me out a lot. -
Cool. Thank you very much for the interesting thread. I found the function in the documentation but couldn't figure out the variables.
On a related issue, I don't suppose it would be possible to lift out (to a transparent background) objects moving on a multicolored background if the contrast between them and the background was sufficient? Weeding out certain colours will weed them out globally, from both the objects and the background.
Is there some nifty trick for tracking movement of a certain object and "lifting it out" the rest of the clip? -
I think it might be possible with the 'mask' function, but only if it meets the proper criteria. For example, suppose you have a camera on a tripod, filming a still set (nothing is moving in the frame). you can take athat one frame with nothing moving and use that as some type of base. you would then need some type of function that would compare the still image with the actual videoclip. Everything that is the same (or equal) make transparent, otherwise, let the video show through. Ideally, that function would create a alpha layer (black being transparent, and white being opaque) which could be used with the mask function.
Masktools (a pluging package for avisynth) might have just the tool for that job, but I am not sure. If I have some time this week, ill look into it.
Similar Threads
-
Complex chroma key matting problem
By Morality124 in forum EditingReplies: 33Last Post: 7th Nov 2010, 15:36 -
Can Premiere CS4 do quality chroma key? I can't
By MAtkins in forum Newbie / General discussionsReplies: 35Last Post: 26th Mar 2010, 02:49 -
My first attempt at a bluescreen chroma key
By CogoSWSDS in forum EditingReplies: 4Last Post: 16th Apr 2009, 22:11 -
Chroma Key workflow for large number of clips
By pablogott in forum MacReplies: 0Last Post: 27th Jun 2007, 19:21 -
An alternative to the Chroma Key.
By fr4nk in forum EditingReplies: 10Last Post: 8th Jun 2007, 13:45