- select all blue pixels above a threshold as a mask
- create a shadow image that is gray outside and white inside the mask
- move the shadow by 20 pixels
- copy the shadow onto the white part of the main picture
Note that some blue pixels do not turn white, because changing the threshold would distort the gate too much.
.. literalinclude:: shadow.py