Processing an image to extract green-screen mask
Use conditional indexing:

RED, GREEN, BLUE = (2, 1, 0) # Your numbers

empty_img = numpy.zeros((height, width, 3), numpy.uint8)

reds = img[:, :, RED]
greens = img[:, :, GREEN]
blues = img[:, :, BLUE]

empty_img[(greens &lt; 35) | (reds &lt;= greens &gt;= blues)][BLUE] = 255


Edit:

empty_img[(greens &lt; 35) | ((reds &lt;= greens) &amp; (blues &lt;= greens))][BLUE] = 255


I was wondering if the compound relation would work. Sadly, not. This should. If it doesn't you can try composing it step by step - look at just the greens &lt; 35 case, then the reds &lt;=greens, etc.