Chromakey (HSV) plugin for Cinelerra:

This document describes how to use the Chromakey (HSV) plugin in Cinelerra.

What is Chromakeying ?

It what you use to remove a color from a video to composite with another image. People refer to is as green screen or blue screen process (because of the color that is keyed out).

If you want to know more, check out Wikipedia:

What are the requirements ?

First off, film your subject with a good background. The lighting is crucial and good lighting during production will save your hide with much less effort than in post-production.

I'll assume that you have a good video, filmed on green (or blue) screen that you want to use.

Make sure you are using an color model that has an alpha channel !!!!!! RGBA8, RGBAFloat, YUVA8)

To change color model, go to Settings->Format->Color Model.

Where can I find the plugin ?

There's a patch to the current SVN version (as of Feb 26th, 2006) available here for download

Once you've applied the patch, you may have to copy the file hvirtual/plugins/chromakey/picon.png to hvirtual/plugins/chromakeyhsv/picon.png . Hopefully, this will be integrated in the SVN version soon.

How do I use this plugin ?

As any other effect, add it to the timeline in the main window.

You can tweak each parameter in order to improve the keying. Here is what the parameters window looks like:

Start with Hue Tolerance at 10%, Min Brightness at 0, Max brightness at 100%, Saturation offset at 0, Min Saturation at 0, In Slope at 0, Out Slope at 0, Alpha Offset at 0 (that's mid-way through), Spill Threshold at 0, Spill Compensation at 100%.

At any time, you can check what the Mask looks like by clicking on Show Mask. This will output a black and white image of the mask.

1) Select the Key color

Select the key color (green, blue or whatever) using the color wheel or the color picker. Remember, only the Hue matters, not Saturation or Value.

To use the color picker, click on the color picker icon in the Compositor window, then click on the color you want in the Compositor window. Then in the Chromakey (HSV) parameters window, click on “Use Color Picker”.

With the color wheel, you can adjust this color or make up the one you want; remember, only the Hue matters, not Saturation and Value.

2) Adjust the Hue Tolerance

Because there are slight variations in lighting or whatever, the background will not be in a uniform key color hue. Increase or decrease the Hue tolerance to mask out the background. If there are dark spots that are keyed out that shouldn't be, don't sweat it, we'll take care of them later.

3) Adjust the Brightness

Increase Min Brightness so that only the background is masked out, and not parts of the foreground. You can also reduce Max Brightness if some clear areas are keyed out (useful for very dark backgrounds).

4) Adjust the Saturation

Increase Min Saturation so that only the background is masked out, and not parts of the foreground. Saturation Offset can be used to change this, but for now leave it to 0.

5) Check what it looks like

At this stage, your mask should be pretty clean. Toggle Show Mask to check what it looks like, it should be OK. If not, repeat steps 1 to 4 to get a better key.

The rest of the controls are useful to smear the mask to help compositing later on. They will help you to make your key look much cleaner.

6) Adjust the slope

For now, the mask is a full on/ full off mask that can be really harsh and not necessarily what you are looking for. In Slope and Out Slope will help you to smooth that key. In Slope leaves more colors in the mask, Out Slope takes more colors out of the mask.

The colors that are borderline in the mask will see their alpha channel reduced by half instead of being completely on or off.

7) Adjust the alpha channel

This control offsets the whole alpha channel by some amount. You probably know what you are doing if you change it from 0 (the default value)

8) Remove spill light

This steps helps you removing the green (or blue) halo around the edges of the mask. It does so by removing the saturation of pixels that have a similar hue to the key color (turning them into grey instead of green or blue). Spill Compensation controls the amount of de-saturation.

If you start with Spill Compensation at 100%, slowly increase the Spill Threshold until the remaining green or blue areas turn grey. Then reduce Spill Compensation until the image looks good.

9) Blur the alpha channel

Now the mask is probably still very harsh, so just below the Chromakey (HSV) plugin, add a Blur effect, and select only the Alpha channel, with a radius of 2 or 3 (more if you really want to soften the edges). This will help a lot the keying.

Jerome Cornet
Last modified: Thu Feb 25 18:36:11 EST 2006