This article is about Chroma Key 2 parameters and their properties. By the end of this article, you will understand what all the parameters of this plugin are responsible for. To use this plugin, you need to set the property "gpu_pipeline" as true. How to do that is written in this article.
Chroma Key 2 plugin has lots of adjustable parameters which allow you to precisely tune the color spectrum to be cut out. This plugin uses HSV palette scheme to work with colors. One of the possible representations of this color palette can be represented as a three-dimensional cylinder:
To have a more convenient example of how Chroma Key 2 plugin works and what parameters are responsible for what, a picture of a flat part of the HSV palette is used as the image on which colors are going to be cut out. Here is the picture:
Please, note that this picture doesn't contain all the possible colors due to limitations in the representation of the HSV palette on a flat image. So, there are no colors here whose saturation (S) and value (V) values are less than 100 at the same time. At least one of those two parameters always equals 100. Simply put, there are no grays or semi-grays in this image.
We will also use another picture to demonstrate what kind of influence the Chroma Key parameters have on the colors to be cut. The second picture represents planes of the HSV palette, with grays and semi-grays. Here is the second example image:
The Chroma Key MPlatform sample can be found here: "C:\Program Files (x86)\Medialooks\MPlatform SDK\Samples Basic\C#\Mixer Sample\bin\x64\Debug\Mixer Sample.exe",
The Chroma Key MFormats sample can be found here: "C:\Program Files (x86)\Medialooks\MFormats SDK\Samples\C#\Sample Mixer Chroma Key\bin\x64\Debug\Sample Mixer Chroma Key.exe".
Choosing a primary reference color
Here is a window that is in charge of chroma key settings. Here are parameters that define the color spectrum to be cut. To start work with Chroma Key 2 plugin, first of all, you need to click on the primary color to cut. Relative to the primary color you choose, the width, height, blurring, and translucency of the color spectrum to be cut out will be calculated according to the first 4 parameters. Let's choose cyan (H = 180, S = 100, V = 100) color as an example. This color is located exactly in the center of the image.
Pay your attention, only HUE value of chosen color matters. So, if you select a darker or lighter version of the selected color, you will get the same result (S and V values of the chosen color don't influence the color cut result).
Background parameters (determining the vertical boundaries of the cut spectrum)
HUE values of the first two parameters ("Background, distance to left bound" and "Background, distance to right bound") define the width of the cut spectrum. Background, distance to left bound value defines the location of the left edge of the cut spectrum, and the opposite for the right one:
V (Value) and S (Saturation) values defines power of blurring for shades of gray and semi-gray. Due to the fact that the first image doesn't have grayscale colors, it's needed to use the second picture to show the influence of V and S parameters:
|S = 100, V = 100||S = 100, V = 0|
|S = 0, V = 100||S = 0, V = 0|
In other words, parameters V and S determine the strength of the chroma key effect on half-gray colors of the defined spectrum.
Foreground parameters (blurring of the vertical boundaries of the spectrum)
HUE values of the third and fourth parameters ("Foreground, distance to left bound" and "Foreground, distance to right bound") define the length of blurring for the vertical boundaries of the cut spectrum. "Foreground, distance to left bound" is in charge of the left border, and "Foreground, distance to right bound" is in charge of the right border. Here are some examples:
|"Foreground, distance to left bound" HUE = 0
"Foreground, distance to right bound" HUE = 0
|"Foreground, distance to left bound" HUE = 20
"Foreground, distance to right bound" HUE = 100
|"Foreground, distance to left bound" HUE = 100
"Foreground, distance to right bound" HUE = 20
S and V values of these parameters are in charge of nothing. They are needed just to define reference colors themselves. Only HUE parameters matter.
Cancel Parameters (horizontal boundaries of the spectrum adjustments)
S and V values of the fifth parameter define the top and bottom border of the cut out spectrum. They are responsible for the position of the horizontal boundaries of the cut spectrum. S defines the upper one, V defines the bottom one.
Here are some more examples:
|S = 90, V = 20||S = 20, S = 90|
Colors Parameters (post-processing)
The last sixth parameter is in charge of adjusting colors of the result picture. Via "Saturation" and "Alpha" parameters, you are able to adjust the saturation and the transparency of the final frames:
|Saturation = 0.50, Alpha = 1.00||Saturation = 0.00, Alpha = 1.00|
|Saturation = 1.00, Alpha = 0.70||Saturation = 1.00, Alpha = 0.20|
Adding more chromakeys
Sometimes, it's needed to cut more than one color when you work with different chromakeys. In MPlatforms and MFormats it's possible and easy to add additional color spectrums to be cut. To do that, you just need to increment "Key" field and adjust all the parameters you want. Adding more chromakeys is also useful when you have a bad picture with large fluctuations of chromakey colors.
To implement a much more difficult color field to be cut, the exclude mode might be useful for you. When two color spectrums to be cut intersect, exclude mode performs a material implication operation on the overlapping area. To enable this mode, it's needed to check "Exclude mode" checkbox:
Numbers 1 and 2 are the color spectrums for cutting out.