[Bf-committers] image keyer / inpaint node: mission accomplished!

Peter Schlaile peter at schlaile.de
Sun Jul 29 12:19:49 CEST 2012


Hi,

two weeks ago, I wrote something about an inpaint node and why it is
necessary to implement something like the nuke IBK-Keyer using Blender
nodes.

Well:

Following the ideas mentioned in this blog post (you have to scroll
down):
http://www.vfxtalk.com/archive/index.php/t-16044.html

"IBK is a color difference keyer with a very simple basic algorithm. In
case of a green screen the math is g-(r*rw+b*bw), where rw is the red
weight and bw is the blue weight with a default value of 0.5 for both.
What makes it sophisticated (among other things) is the way it uses
another image to scale the result of the above mentioned equation.

Every keyer scales (normalizes) the result of it's basic algorithm so
that, on one end, you get 1 for the pixels that match the chosen screen
color, and 0, on the other end, for the pixels that contain no or little
of the primary color of the backing screen (this is afterward inverted
so you end up with black for the transparent parts of the image and
white for the opaque parts).

Keylight, for example, scales the result of it's basic algorithm (which
is g-(r*0.5+b*0.5), the same as IBK by default) by dividing it with the
the result of gc-(rc*0.5+bc*0.5), where rc,gc and gc are the red, green
and blue values of the chosen screen color. IBK does the same if you set
"pick" as the screen type and select the backing screen color. If you
set screen type to "C-green" or "C-blue" instead of using a single value
for normalizing the result of the basic equation (i.e. the unscaled
matte image), it processes a "control" image with the gc-(rc*rw+bc*bw)
formula pixel by pixel, and then divides the unscaled matte image with
the processed control image."

I managed to arrive here:

http://peter.schlaile.de/blender/inpaint/network_image_keyer1.jpg
http://peter.schlaile.de/blender/inpaint/network_image_keyer2.jpg

with virtually *no* tuning necessary(!). 
It doesn't even need a seperate despill step!

It's still not a silver bullet, but comes pretty darn close :)

The funniest part: the math behind it is *really* mindbogglingly simple
as you can see in the second node network (or the cited blog post
above).

Have fun!

Cheers
Peter

P.S.: Anyone wants to review my inpaint node or 
      should I just hit "svn commit"... ?






More information about the Bf-committers mailing list