So, the Colbert Report posted a green screen challenge to make McCain exciting ( colbertnation.com/?cat=22 ). I thought I'd see what Processing ( processing.org ) could do with a green screen video. I learned a few things:
1. The green background is not pure green as I expected. I figured pure green would be the easiest green to work with: just look for pixels that were essentially all green, negligible red and blue. But most of this video's green is 41-214-15 (RGB-wise), so you have to be a little more particular about which pixels you decide are background. I ended up just saying a pixel was green if the green component was large, and it was also significantly larger than the red and the blue components (something like G>100 && G>1.5R && G>1.5B). This worked only okay, and was greatly helped by the fact that McCain was not wearing a green tie.
2. The edges around McCain are a pain, and look pretty bad. McCain's edges actually "fade to green", so there are pixels on the edge that look green, but aren't quite green enough to consider background. This initially caused a green halo effect around McCain. I fix to this is just to make McCain black-and-white, so his green halo is no longer green. Still, the edge looks bad, as it's not anti-aliased at all. I'll have to work on that if I want something that looks good.
3. Trichonosis can be spread among rats via cannibalism.
This was the first video I've done with Processing using two separate video inputs. It works well, but I'm not sure I'm doing it the most efficient way.
Finally, the audio was processed with Csound, using a vocoder I wrote that uses filtered white noise to recreate an audio sample.