[Douglas] hometown Goshen, Indiana takes the state’s motto ‘The Crossroads of America’ seriously, at least when it comes to trains. The city is the meeting point of three heavily frequented railroad tracks that cross near the center of town, resulting in a car-traffic nightmare. When everybody agrees that a situation is bad, it is time to quantify exactly how bad it is. [Douglas] stepped up for this task and delivered.
He describes himself as cheap, and the gear he used to analyze the railroad traffic at a crossing visible from his home certainly fits the bill: a decades-old webcam, a scratched telephoto lens and a laptop with a damaged hinge.
With the hardware in place, the next step was to write the software to count and time passing trains. Doing this in stable conditions with reasonable equipment would pose no problem to any modern image processing library, but challenged with variable lighting and poor image quality, [Douglas] needed another solution.
Instead of looking for actual trains, [Douglas] decided to watch the crossing signals. His program crops the webcam image and then compares the average brightness of the left and right halves to detect blinking. This rudimentary solution is robust enough to handle low light conditions as well as morning glare and passing cars.
The rest is verifying the data, making it fit for processing, and then combining it with publicly available data on car traffic at the affected intersections to estimate impact. The next council meeting will find [Douglas] well prepared. Traffic issues are a great field for citizen science as shown in Stuttgart earlier. If the idea of bolting old lenses to webcams intrigues you, we got you covered as well.