So if the pixel of the webcam is transparent, then you can see what's behind it. So let's start with a very simple color matrix, where the values are the identity metrics. So the identity matrix basically says every input pixel is mapped to the exact same pixel in the output. So not a really interesting equation, it just takes the same pixel and maps them. I'm looking for something green to show you, but I'll find it later.
This basically does nothing, which is not what we want. We want a green screen filter. But what we want is just to affect this. This is the alpha. So for example, if I make this zero, then you can see everything is fully transparent, which is not what we want, right? We want everything to be opaque, except for the green pixels. So what we can do is say, okay, if a pixel is green, let's reduce the opacity. How do we do it? For example, we can take the green pixel and multiply it by minus one. And now we get this weird effect where everything is a bit darker, sorry, more transparent. And that's because we have a smooth function, right? If the input pixel is one in the green, then we'll have minus one plus one, which is zero, which is fully transparent. But most pixels have, you know, a value somewhere between zero and one.
So what we want to do is add the component transfer, a discrete component transfer like we had before. And we want to tell it, okay, the values should be either completely opaque or completely transparent, which is basically what we want with the green screen filter. But what you see now is like my shirt is white. Why is it doing this filter? Because white has a very strong component of green inside it, right? White is just 255, or one green, one red, and one blue. So what we really want to say, we don't just want to take pixels with a strong component of green. We want to take the pixels with where the component of green is much stronger than the components of red and blue. So what we can do is say, okay, if the pixel is red, let's add opacity. If the pixel is green, let's remove opacity. And if it's blue, let's add opacity. And I'm going to get something green just to show you. So as you can see, this is green. But we don't see any effect. Why? Because red and blue are winning. And we have this one, like we start with a base of one.
Comments