Inspiration

A camera can detect motion against the traffic, yet the moving object might be a car, a bird or a leaf. Turning every pixel finding into an alarm creates false positives. We built a reusable, evidence-bound workflow between measurement and action, with a traffic control room as its most visible example.

What it does

VisionFlow is a configurable OpenCV 5 workflow core with a Python API, CLI and browser GUI. Image, video or camera input goes through a JSON workflow: analyze, observe, branch, ask for more evidence, request model feedback, involve a human and produce a bounded result. The same controller can check a document photo, follow movement in a video or monitor a road.

The traffic example follows one ticket through four stations:

  1. Camera: OpenCV measures motion and direction from the rendered pixels. Injecting a scenario changes the image; it does not itself create a detection.

  2. Assessment: a visual finding opens a numbered ticket. The server seals an immutable H.264 evidence clip, with five seconds before and ten seconds after the finding, and binds it to the case with SHA-256.

  3. Decision: the human reviews the same clip and confirms or rejects the hazard. The server gives the operator a real 60-second decision deadline.

  4. Deadline and report: an unanswered ticket is reported automatically to a simulated authority inbox. A later rejection sends a linked all-clear rather than overwriting the original report.

The public demo uses clearly labelled, fixed offline model answers. They do not inspect the clip or classify its contents. Selecting the bird profile supplies a predefined bird/no-hazard answer; selecting the pending profile requests human review. Pixel analysis, case transitions, clip export, deadlines and simulated receipts are real. No emergency service is contacted.

Optional local Gemini video review sends the bound clip only with an explicit cost opt-in. Our five live-provider requests returned HTTP 503 or exceeded the 30-second bound, exercising the human-review fallback. We make no live-model accuracy claim.

How we built it

OpenCV 5.0.0 supplies native grayscale patch tracking, direction and motion analysis, sharpness measurements and the synthetic RoadWorld renderer. Direction matching uses 21-by-21 patches, normalized correlation, a unique-peak check and a forward/backward consistency check. It receives pixels, not simulator event labels.

A bounded DAG controller enforces frame, observation-time and model-call budgets. Approval is tied to the reviewed content and version; retries are idempotent. The web server uses sessions, ownership checks and CSRF protection.

The AWS architecture uses Graviton EC2 behind nginx and CloudFront HTTPS. The application stays loopback-bound in public-demo mode: synthetic road sources only, uploads disabled, bounded concurrent sessions and storage. CodeBuild supplies the reproducible cloud-test recipe.

AI coding assistants supported implementation, independent review, testing and UI iteration. The fictional comic portraits and decorative icons were generated with OpenAI image generation. These graphics are not sensor inputs or evidence.

Evaluation and lessons

The frozen synthetic evaluation keeps failures visible. Across 36 known horizontal-direction sequences: TP 9, FP 0, TN 24, FN 3. Across 16 RoadWorld sequences, direction candidates occur for normal traffic 0/4, wrong-way 4/4, birds 4/4 and leaves 4/4. Interpreting this pixel stage as a vehicle detector would instead give TP 4, FP 8, TN 4, FN 0. The later decision stages exist precisely because motion is not vehicle identity.

A source-bound macOS browser acceptance passed 16 checks, including the real 60-second deadline, automatic reporting, late correction and a predefined bird answer closing a case. Desktop and narrow-screen layout checks covered the subsequent header and patrol-image changes. A loaded Windows live run analyzed only 74 frames in 60 seconds and missed the injected event; frame cadence and hardware matter. Parameters were tuned on known sequences, not a blinded holdout. This is not evidence of real-road safety.

Reproduction and final acceptance

The public repository contains the reusable core, technical report, architecture and pinned reproduction instructions. Public main a6d5b2c6d31ec7f83a0f67d5feeb4f6d06a51517 has the same Git tree as source 7a4bac8f534357b478e0f127a3ef9c3382f65d92, which the hosted demo serves. It adds the fixes of 15 October 2026: owner-scoped ticket recovery after reload or language switch, bounded raw-frame retention that protects running reviews and exports, a complete final recording when a source reaches its byte budget, an MIT license and a Windows/Edge browser CI job. For this source, GitHub CI passed 652 tests on Windows and 651 on Linux with one platform skip, plus 44 real Windows/Edge browser checks; the CLI demos and a genuinely installed wheel were verified outside the checkout.

The first submission on 14 October 2026 used source aeb214887f825e47d59f58deba748173d6ccbe2b. On that source, GitHub CI passed 616 tests on each of Linux and Windows, and final AWS CodeBuild succeeded with 615 tests passed and one platform skip; the offline OpenCV demos and integrity/cloud verifier passed. No new CodeBuild run is claimed for the later fixes.

Fresh public AWS cases demonstrated a fixed bird answer closing a detected case, and an opposing-motion case reaching a measured 59.999965-second server deadline, a simulated report and a later linked correction. In both cases, the sealed clip hash matched the case snapshot and HTTP response. On 17 October 2026 a live re-check of the hosted demo repeated the judge path: a wrong-way ticket kept its clip and deadline across a reload with language switch, was reported automatically after the real deadline and closed by a late all-clear; a bird case was closed by its fixed answer. Earlier cloud case-start and CLI failures remain documented as repaired attempts. These checks verify workflow execution and evidence binding, not real-road safety or live-model accuracy. The film records GUI revision f94289c; later revisions keep the same ticket behavior and add the recovery and resource fixes.

What's next

Privacy-controlled real-camera trials, additional OpenCV tools behind the same contracts and a visual editor for JSON workflows. The key lesson is to bind every action to observable evidence, explicit authority and a failure path the operator can inspect.

Try it

Public demo: https://d2fmnfnvxb0cs1.cloudfront.net/

Public code, technical report, architecture and reproducible instructions: https://github.com/ellmos-ai/VisionFlow

Built by Lukas Geiger, solo.

Built With

Share this project:

Updates

Submission history