Screening Decomposite/Recomposite Tutorial

Keying the Squid

Squid Image:Kevin Weller
Image may not be re-published in any venue without written permission from Kevin Weller
Tutorial:Walt Richmond
Version:rev E
Designed for 800- to 1000-pixel wide browser displays

Overview

The objective of this tutorial is to demonstrate the concept of "screening" in WinImages FX.

Screening is the technique of lifting an object off of a uniformly colored backdrop by essentially treating the color of that backdrop as transparency. This is an approach that has three main implications:

  1. Where the backdrop color shows in the image or animation, the result should be 100% transparent.

  2. Where the backdrop color does not show in the image or animation, the result should be 100% opaque.

  3. And finally, where the subject matter is partially transparent itself, that is, the backdrop is partially showing through the subject such as might be the case with a diaphanous dress, then the result should be partially transparent to the degree that the subject was transparent.

This approach differs a from color-sensitive regional selection approaches (in other words, selections that use a "magic wand") in that it is not sufficient to separate the subject from the image backdrop by outlining it, and additionally, in that quite often, a correct result will not be simply a matter of opaque regions and transparent regions but will also contain partially transparent regions.

It is these differences that dictate the choice of screening with color-keying techniques, rather than masking with regional selection tools, to generate the master transparency.

This tutorial shows how you go about creating a screen in a situation where a partially transparent subject is present over a relatively uniform backdrop.

First we'll explain what to do, then we'll explain what is happening.

Original unretouched squid. This image is intentionally shown at 1/2 resolution; you can right click and select Save Picture As (in Internet Explorer v5, may be different in other browsers) and the browser will save the full resolution image.

Squid Image Credit: Kevin Weller
Image may not be re-published in any venue without written permission from Kevin Weller
The Original Squid

Recomposited squid This image is intentionally shown at 1/2 resolution; you can right click and select Save Picture As (in Internet Explorer v5, may be different in other browsers) and the browser will save the full resolution image.
The Screened and Keyed Squid
Recomposited, with soft shadow
and recovered transparency

Want to see our layered result? You can right-click here and select "Save Target As" to download a 673 KB layered ELF format image for WinImages R7 if you are using Internet Explorer V5.

Screening the Squid

Note: Title bar names in this tutorial will not exactly match the names in your work, because in order to create the tutorial, other images were created and saved, and reloaded - just follow the steps and please ignore the names of the images as shown in our screen captures.)

Begin by starting WinImages FX and loading the squid image. This is done using the File menu, Load submenu item. This may look a little unusual to you because of the submenus; these keep a memory of the last few places you've been loading images from. You'll find them very convenient once you've used them a bit, they are more efficient than normal load dialogs for many kinds of work. Navigate to the file system location where the squid image is saved, and load it.

Once the image is loaded, use the left mouse button and click once on the Windows symbol at the upper left corner of the image, just to the left of the word "View" in the image title bar. This will drop the image's context menu.

Select the Layers command as shown below:


Selecting the Layers command

You will probably (depending on your preferences settings) be asked if you want to convert this image to a layered image. Answer OK.

Once the layers dialog opens, click once on the squid image in the list so that it is selected, and press the Duplicate command button in the set of buttons at the left. Now you'll have two layers named the same. Left-click on the layer at the top (L1) and then press the Rename Layer command button. Type "Key" into the dialog and press enter, or click OK.

At this point, the dialog should look almost the same as the image below, with the exception of the name of layer two (L2) which will have your image name in it, which is fine.


The Layers dialog after duplicating the layer and renaming it

At this point, left-click Done command button in the Layers dialog, and it will close.

Now select the Polygon area tool as shown below from the area toolbox:


Area Toolbox

Now we need to select the Remove Feature operator. To do this, left-click once on the Filter button in the bottom portion of the toolbar. This will bring the filter tools into view on the top portion of the toolbar. Then left-click once on the Remove tool. The tool's dialog will open, set to 20, which is fine. Refer to the image below for locations of the toolbar buttons:


Toolbar Detail

We're ready to do the most involved part now. At this point, you have three images on-screen. One is the Master image (the composite result of the layered image), one is layer two, and one is layer one. Bring the Layer one image to the front (easily identified because the title bar will have the name "Key" and [L-1] in it) and stretch the image by left clicking and dragging it's edges so that it is as large as the available working area. This will add precision to the job of creating the selection. You can use the "V" key to cycle through the images as long as any View window's title bar is active, or you can just move them around with the mouse, or you can select the layer you want to work on from the Windows menu, it'll be in the list at the bottom of the menu.

Now, once the image is stretched to the largest area you have available, what you want to do is create a polygonal selection around the squid; this selection should be close to the squid (see the example selection below) but it is very important that you leave a little bit of the sandy color between the selection and the squid. This, in turn, means that the selection doesn't have to be that precise (again, as you can see in the example below) - just get as close as is easily done, and leave at least a couple of pixels of sand color between the selection and the squid. Precision is not the issue here, leaving a little sand is. Creating the selection should take just a few seconds.

Tip: Polygonal selections are made by left clicking each vertice along the polygon down, and then for the final, closing point, right clicking to close the last segment.


The Polygonal Selection, not yet closed

When you finish this selection, the squid will disappear from the image, as shown below:


Remove Feature operator result

Now, select the context menu for any of the layers or the master image, and select the Layers command again. The layers dialog will open. Click on Layer 1 and then drop the Mode list, and select Inverted RGB Key (soft).

Next, set the Factor control to 222 (you can adjust this to taste, but 222 seems to work well.) The result of these actions is shown below:


Setting the Key layer mode

Finally, click the Done command button, which will close the Layers dialog.

At this point, the Master image should look similar to the image above. You do need to keep in mind that this example was made with a low-resolution image that was originally posted to a web site; if the image you are attempting to key using this approach is higher resolution, you should get slightly different results, usually superior because you can get closer to the subject matter and still retain a border of the backdrop color.

We want to convert the master image into a flat, atomic image now (because you can't edit a master image, only the layers that make it up.) To do this, select the Clone Image from the Quick Ops submenu of the Master image's context menu. This will produce a clone of the Master that is not layered and contains the alpha transparency created thus far.


Cloning the Master

You probably want to save the layered image at this point in the layered format in case you want to work further with it later. Use a submenu off of "File", "Save Image As" to do this; select any layer of the layered image, or the master, to actually save from the list offered, then click "Save All Layers as ELF file", this is WinImages advanced layered image format - it will retain the special keying modes and so on for you.

It is important to recognize that this keying technique identifies and creates a key region that is the general color gradient of the sand (using the Remove Feature operator.) Where the unmodified squid layer is the same color as the key layer, it will key.

Generally, this is great; for instance, it means where the sand is visible through the wings, the wings will become transparent to a degree proportional to the degree the sand was showing though, and that in turn means that in later compositing, the image will be similarly transparent.

A little bit of very easy touch-up is now required, though, because some areas of the squid are colored similarly to the sand, yet it is obvious that these are actually colors in the squid. One such area is the eye; there are others on the back.

To touch up the transparency, select Alpha from the bottom potion of the toolbar, then left-click on the Make Alpha button in the top section. The operator dialog will open. Change the mode to Add to existing Alpha.


Selecting the Make Alpha operator

Select the ellipse tool from the area toolbox:


Select the Ellipse area-tool

Pull out an ellipse as shown below to encompass the eye region. This will place 255 (opaque) alpha into the image.


Touching up unintended similar-color keys


After four applications of Make Alpha touch ups

Finally, save this image using a 32-bit save mode. We suggest Targa-32. This is highly compatible with other graphics applications, and you can continue working with the image in Photoshop, Paint Shop Pro, WinImages or any other application by saving in this common format.


Same Image Recomposited as a layer above other art


And again, this time with a soft shadow added for drama.

So What Happened Here?

The heart of this procedure is WinImages Inverted RGB Key (soft) layer mode.

This layer mode develops opacity for the subject matter region by comparing the color in the higher layer, which is the layer that has the keying mode selected and represents the background, to the layer(s) beneath. Where the colors match exactly, the layer mode develops 0% opacity (100% transparency.) Where the colors do not match exactly, but are close, slight opacity develops, and where the colors are quite different, opacity is strong. The Factor control for this layer mode affects just how quickly opacity develops. This layer keying mode has the extremely useful quality of being able to key a non-uniform backdrop without artifacts or errors, even when the backdrop is extremely noisy and inconsistent, as long as the region directly annular to the subject matter is of a clean, unbroken color gradient.

Setting Factor to 222 provides a bit more than double the usual keying effort; opacity develops a bit more than twice as quickly because of this setting.

Another important part of the process is the Remove Feature operation. This tool, designed to remove wires from film and camera shots, replaces objects with a 2D color gradient that blends across the area selection. The color of the gradient depends on samples taken around the edge of the selection (that's why you had to make sure the selection allowed for a margin of sand around the squid.) The higher the resolution is for the image being keyed, the closer you can get to the subject (the squid, in this case) and still keep a border of the backdrop color between the selection edge and the subject. This will produce a superior quality gradient that is strongly related to the backdrop where it meets the edges of the subject matter.

On the other hand, when you have a high quality backdrop (see screening tips) - for instance, when you are actually compositing in front of a professional blue- or green-screen - you can afford to make a more general selection around the subject. This is because with these types of screens, the backdrop is extremely uniform and so the region created by the remove feature operation will be accurate even if it is generated from colors not directly annular to the subject itself. This makes the selection process easier, which in turn makes it faster.

The process relies on the idea that the background behind the object is of relatively uniform color. This is always true in green and blue screening; it is also true of this squid example.

Screening (blue, green or even "sand"...) is the act of putting something in front of a uniform color backdrop so it can be most easily extracted from the backdrop and re-composited... this is very common in film and video work. One of the things that we try to do when we create a screen on purpose (like a film blue-screen) is try to make sure that there is as little of the screen color as possible in the subject to be extracted. Here on the sand, we don't have control of the backdrop color viz-a-viz the color of the subject. And, unfortunately, the squid actually does have some sandy colors on it. This is why we have to do some alpha (transparency) repair before the image is ready to go.

Once the gradient is built, the key has a color related to the sand at every point underneath the squid; so it matches the squid against that gradient, and where the match is close (in the wings, for example), only slight opacity develops. Where the match is not close (the green above the eyes, for example) the result is high opacity, or slight transparency, depending on how you prefer to look at the situation.

Areas in the key image layer outside of the Remove Feature region match exactly with the unmodified image in the layer below, so these regions become 100% transparent, even when there are significant departures from the sandy color, as in the larger pebbles and debris evident in the original squid image and the key layer with the squid itself removed. Since the debris and pebbles provide a 100% RGB match between the key and the subject image, they are 100% removed by the keying mode, even though they are not uniform in color.

This keying method can be animated using WinImage's Timeline, and can be pressed into service in almost any color keying workflow.

Need more Info?

Tell me how to improve this tutorial, and I'll get right on it:

support@blackbeltsystems.com

Walt Richmond
for Black Belt Systems


Some Professional Screening Tips from Walt

  • Illuminate the screen as evenly as possible.

  • You do not have to illuminate the screen brightly - just evenly!

  • Locate the subject well in front of the screen so that the reflected light from the screen (blue- or green- or other-color-wash) reflects as little as possible from the sides of the subject.

  • You can reduce the effect of blue wash to some extent from the screen by illuminating the rear of the subject with yellow light, or green-screen wash by rear-illuminating with purple light. Whatever color the screen is, there is another color that, when added to the screen color, will produce a white light (and hence not color your subject "funny". Use that color. Hint: Think in red, green and blue components to work out what color you need to fight screen wash. See the sidebar for more explanation of this.

  • Illuminate the subject separately from the screen - use different lights.

  • Carefully avoid colors in the subject that are close to the color of the screen. If such colors exist in the subject, you'll end up having to touch-up the key. Be really careful if you have such colors, that they are never on the edge of the subject, or you'll end up with really troublesome areas needing significant edge repairs after the keying process.

  • Think outside the box (of crayons?) Blue was originally picked as a screen color because it was primary and was easily processed. Green is used in movies because vivid greens are also easily processed with older keying mechanisms, and bright green isn't any more common than blue in most subject matter, and neither are present in the normal range of skin tones. With the keying capabilities in WinImages FX, you can just as easily use orange, magenta or ribald pink as your key color. So don't think you have to choose between a subject with no green or blue, just set up a screen with some radially different color on it, and have at it.

  • Want a really nice, evenly lit blue screen that won't wash your subjects at all, costs nothing to set up, and where even the lighting is free? Set up outside on a calm, clear day and shoot your subjects profiled against the sky. Just remember to avoid blue in the subjects themselves. Watch out for feet; try to keep your subjects entirely profiled, which means where they stand either cannot show, or you'll have to hand-mask it out as we show here.

Blue wash diagram
Yellow lamp counteracts blue wash, adds to blue to become white light for processing in an RGB environment such as WinImages. Bluescreen is illuminated with white lights - but only blue will reflect back from it, as the blue pigment absorbs all other colors. Since the subject is then getting extra blue light, you need to provide the remainder of the spectrum, red and green, or yellow in RGB terms. For a green screen, the same thing applies, only you need to provide red and blue, or violet light.

Keeping the subject far from the blue screen will also reduce the amount of reflected, or "wash", light that reaches them.