This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Greenscreen keying on the edge

Tags: None
(comma "," separated)
markoc
Registered Member
Posts
342
Karma
1

Re: Greenscreen keying on the edge

Sun Mar 25, 2012 7:44 am
Still working on this...

Checked the Blender code, but it uses the old "Vlahos" style keying, where the key is one of the primary colors. In Kdenlive (Frei0r) we have more flexible keying, that can use any color as the key, so I had to find other ways to clean the spill.

In the end, I decided to simply move the colors radially away (in color space) from the key color, and it seems to work quite well. Besides that, I'll include the possibility to move towards a "target" color, to desaturate, and to change the luma.

The other thing is how to find the pixels that need cleaning. I decided for three methods: similarity to key color, partial transparecy, and proximity to the edge.

I already have working code for most of this, but since there are so many possible combinations, I am scratching my head about what the parameter set should be, to give the biggest flexibility.
markoc
Registered Member
Posts
342
Karma
1

Re: Greenscreen keying on the edge

Tue May 29, 2012 7:31 pm
The key spill mop up plugin is now available in frei0r, if you compile with script, it will be available under "Misc".
However, without the effect description file, it is mostly useless, as all parameters are not shown, and defaults won't be set.

So, to use it, put the attaced file (remove "_.txt") into kdenlive's effect directoty. Image
markoc
Registered Member
Posts
342
Karma
1

Re: Greenscreen keying on the edge

Tue May 29, 2012 7:33 pm
The README for the keyspillm0pup is this:

DESCRIPTION

After some experimentation with chroma keying, it looked to me that
there is no single method of key cleaning, that works in all
situations, like keyspill on bright, keyspill on dark, etc.
So I included several cleaning options, which can be used alone
or in combination.
In short, it offers three ways of pixel selection (masking), that
can be combined with four types of color changing operations.
The three selection / masking modes are based on
- similarity to key color
- transparency
- closeness to the edge
and the four things that can be done to the selected pixels are
- move away from the key color (De-Key)
- move towards an target color (Target)
- desaturate
- luma (brightness) adjust.


MASKS

Color difference masks are based on the color of the image, and do
not depend on the alpha from the preceding keying, except for
ignoring the 100% transparent areas, to increase speed.

Transparency and Edge masks are based on the alpha channel from the
preceding keying operation.
Transparency masks will affect only the parts that are neither 100%
opaque nor 100% transparent, based on the alpha values from the
preceding keying operation. The effect will be proportional to the
transparency.
NOTE: if a "hard key" was used in the preceding keying, there will be
no areas that T operations could affect.
Edge maskss will affect only pixels close to the edge, with the effect
diminishing away from the edge. The outer edge is the edge of the
fully opaque part, where the alpha from the preceding keying
is 1.0 (255).
NOTE: the edge masking algorithm is not yet what I would like it
to be. I will have to look some more into this, and improve it, so
consider it a "temporary solution" that will change in the future.

All masks can be further pruned with two parameters: an "hue gate",
which will limit the mask to hues close to the key hue, and an
"saturation threshold", which will limit the mask to areas with
color saturation above a threshold.


CASCADING

This plugin can be cascaded, but it is not possible to get the same
color based mask in the second instance, because the colors will be
changed by the first instance. To enable two operations with the
same mask, each plugin instance can do two opertions.
With transparency and edge masks, cascading is a bit easier.
If the hue gate and saturation threshold are not used, transparency
and edge masks can be exactly the same in cascaded plugins.


PARAMETERS:

Key color:
This should be the same or similar to the key color used for the
preceding keying operation.

Target color:
This is only used when "Target" operation is used with one of the
masks. The colors in the affected areas will be moved towards this
color, according to the "Amount" parameter.

Mask type:
Selects the type of mask that will determine where the color
altering operations will occur.

Tolerance:
For the color difference mask, the range of colors around the key,
that will be 100% affected.
For the transparency mask, the "amplification".
For the edge mask, the width of the affected area.

Slope:
For the color difference mask, the range of colors outside of
"Tolerance", that will be gradually less affected.
No function for the transparency and edge masks.

Hue gate:
Reduces the mask according to difference from key hue, to prevent
change to pixels that are within the mask, but not polluted by key.

Saturation threshold:
Reduces the mask according to color saturation, to avoid affecting
the neutral areas.

Operation 1:
Selects which of the four possible operations will be done on the
mask-selected pixels. Apart from no operation, there are four
possibilities: De-key, Target, De-saturate and Luma adjust.

Amount 1:
The amount of the selected operation 1, how much the colors will
change.

Operation 2, Amount 2:
Enable a second operation to be performed with the same mask.

Show mask:
This will show the selected mask as a greyscale image, to help with
fine tuning of the masks. Shoud be OFF for the final render.

Mask to Alpha:
Copies the active mask to the alpha channel.
For all normal spill cleaning operations, this should be OFF.
By seting it ON, the keyspillm0pup itself can be used as a keyer,
or to generate some special effects.
ttill
Registered Member
Posts
372
Karma
0

Re: Greenscreen keying on the edge

Tue Jun 12, 2012 8:52 pm
The xml description is now in git and the effect is available in the "alpha manipulation" group. So if you use the latest development versions of frei0r and Kdenlive no further action is required.

Thanks again Marko for this amazing effect.
User avatar
Kubuntiac
Registered Member
Posts
786
Karma
2

Re: Greenscreen keying on the edge

Sun Aug 12, 2012 6:07 am
I don't see it, and I'm using the build script, which as far as I'm aware compiles the latest versions of Kdenlive and fri0r...

Under "alpha manipulation" I only see:
alpha gradient
alpha operations
alpha shapes
blue screen
color selection
mak0mate
rotoscoping

...has it moved or changed name?
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Greenscreen keying on the edge

Mon Aug 13, 2012 1:43 pm
It comes under Effects - Misc

I have created an alphabetical index of effects and transtions - so I can find them when I forget where they live.

http://userbase.kde.org/Kdenlive/Manual/Effects_And_Transitions
browndavid
Registered Member
Posts
1
Karma
0

Re: Greenscreen keying on the edge

Mon Nov 23, 2015 2:38 am
presently, November 23 2015 what code would i use to get perfect green screen effect in Kdenlive . Any suggestions would be truly thankful for. browndavid
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS

Re: Greenscreen keying on the edge

Sat Nov 28, 2015 6:04 am
You can use Colour selection https://userbase.kde.org/Kdenlive/Manua ... _Selection or Blue screen https://userbase.kde.org/Kdenlive/Manua ... lue_Screen

Neither of which will give you a "perfect" green screen effect if you don't go to a lot of effort to light your scene evenly. From my experience it is a real pain in the but to light so that you have not shadows of subjects on the screen. And these shadows are what makes chroma keying properly a real ****.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]