From Trammell Hudson's Projects
Each flag has a ping-pong ball illuminated with a red or green LED and the player wears a life vest with a blue LED on the center. The webcam has a dark filter so that only the bright LED points are visible and the software computes the angles for the two flags from these three points. The OpenCV program sends the decoded letter and a confidence value to the Unity game engine over OSC.
Source code is available from github/nycresistor/Semaphore-Hero if you want to play at home.