Bird-safe gap check: measuring gaps in bird-safe window markings with OpenCV 5

Bird-friendly glass guidance calls for exterior markings with no gap wider than 2 inches (50.8 mm). Dot treatments go on by hand, and one missing dot on a 40 mm grid opens the gap to about 61 mm. I built a phone check that measures those gaps and entered it in the OpenCV AI Competition 2026.

How it works

  1. A printed ChArUco sheet gives scale. CharucoDetector, findHomography (RANSAC) and warpPerspective flatten the photo to millimetres.
  2. Top-hat and black-hat filters plus findContours find the dots, keeping only blobs with roundness 0.80 or more and the right size.
  3. Glare and blur are marked as unreadable, so they never count as covered or as a gap.
  4. distanceTransform (DIST_C) gives the largest empty square, checked against 50.8 mm.
  5. An ordered rule table decides PASS, REPAIR (with a target) or RETAKE (with the reason). The next photo, a retake or a recheck after a repair, joins the same scan.

It runs on AWS Lambda arm64 behind a plain HTML phone page. Photos are processed in memory and never stored.

It still misses dots. In 4 of the 6 readable real photos, a top-row dot was missed against a bright sky reflection. So far it’s tested on one window and one dot product. I’d welcome ideas on separating dots from bright sky reflections.

demo-repair-pass

Code and technical report: GitHub - Endokelp/Bird_safe_OpenCV · GitHub
Devpost: https://devpost.com/software/bird-safe-gap-check