Chromakey
Chromakey is also known as blue screening (or green screening) and is basically removing a blue or green background from behind an actor/actors and replacing it with another.
The following script can be used for blue screening:

Basically what it does is check every pixel and if the sum of the red and green values is less than the blue value (ie it is more blue than anything else), then it sets the pixel to white. (You can save the image below by right clicking and try it out for yourself)
| BEFORE | AFTER |
|
|
![]() |
We can use this idea to set the dog onto a different background. We will start off with the two images below: (Note that the image for the background must be the same size or slightly larger than the foreground image.)
|
|
|
| Foreground | Background |
Now using the code below, we will get the following result:
|
![]() |



