Extracting the green-screen region borders
Here is a brute force algorithm. This requires some temporary storage (another image, an array, etc.) to record the visited pixels.


Start at the first pixel and continue iterating over the image until you find a green pixel. Mark each read pixel as "visited".
Extract the set of green neighbor pixels and record them. Also tag them as "visited". The idea is to find all the green pixels connected to the one found in [1].
If any pixels in the source image are left, go back to [1].


This will give you a set of contiguous green pixel regions where each pixel appears 1 or 0 times.