Computer Vision · AI Agent

Computer Vision Focus

My role. Developer

Project description

Computer Vision Focus is a desktop app that watches you through the webcam and keeps you focused. It tracks your face, gaze and hands in real time.

When you look away, a NO FOCUS alarm goes off. If you pick up your phone, an AI agent takes a snapshot and asks why you’re on it. If you leave your desk, it shouts at you to get back to the table.

The interface is an iOS-style live dashboard: a face mesh, head pose, gaze, blinks, hand skeletons and boxes around objects in your hands.

How it works: webcam → computer vision (face, hands, objects) → focus logic (Focused / Distracted / Absent) → AI agent (siren, snapshot, voice) → live UI.

Computer vision

  • OpenCV: camera capture and JPEG encoding
  • MediaPipe Face Landmarker (478 points): head pose (yaw, pitch, roll), iris gaze and blink detection (EAR)
  • MediaPipe Hand Landmarker: 21 points per hand
  • MediaPipe Object Detector: EfficientDet-Lite0, 80 object classes
  • NumPy for the geometry math

AI agent

  • An event-driven agent inside the app: it reads what the camera sees, decides what’s happening (phone in hand, looking down, gone from the desk) and acts with a siren, a snapshot or a voice line
  • Runs in a background thread, so the UI never freezes
  • Google Gemini TTS through the Interactions REST API, with a separate voice style for each situation: stern for the phone, shouting when you’re gone
  • Prototyped: a local vision LLM through Ollama (Qwen3-VL) and offline speech recognition (Vosk)

AI automation

  • The voice cache fills itself in the background: every line is voiced once, ahead of time, with a pause between requests to stay within the API rate limit
  • Lines are stored on disk (SHA-256 keys, safe atomic writes) and play instantly after the first time

Desktop, UI and audio

  • PySide6 / Qt 6: QThread, signals and slots
  • QtWebEngine, with a QWebChannel bridge between Python and JavaScript
  • Canvas 2D rendering with requestAnimationFrame
  • iOS-style design with a Dynamic Island
  • Audio: sounddevice (PortAudio), WAV/PCM processing and a siren generated with NumPy

Engineering and testing

  • Clean architecture: pure functions, immutable dataclasses, dependency injection through Protocols
  • Multithreading, with backpressure for the video stream
  • Security: the API key is kept in .env, never in a URL or the logs
  • 430 automated tests with pytest and pytest-cov, built test-first (TDD)
  • Tooling: uv, pyproject, a git-ready project structure and crash logging

AI-assisted development

  • Built together with Claude Code, an AI coding agent by Anthropic
  • A multi-agent workflow: parallel agent sessions and specialized review agents (Python, TypeScript)
  • The agent runs the tests and smoke tests on the real camera, and checks the UI in a browser

Skills and deliverables

  • Computer Vision
  • MediaPipe
  • OpenCV
  • Python 3.12
  • AI Agents
  • Google Gemini TTS
  • PySide6 / Qt 6
  • JavaScript
  • HTML5
  • CSS3
  • NumPy
  • Ollama
  • Multithreading
  • pytest
  • TDD
  • Claude Code
The app tracking a face with a mesh and head angles, the hands and a phone in the hand, with the head and gaze radar
In focus: face mesh, head angles, hand skeletons and a phone detected in the hand, at 29 FPS.
Alarm screen: NO FOCUS!!! over the camera view, alarm number 10 and the AI agent's messages
Out of focus for 10 seconds: alarm #10, and the AI agent calls me back to the desk.

Loud sound. The alarm in this video is loud, so turn your volume down before you play it.

Demo: the app catching me looking away and picking up my phone.

Roman's AI assistant

online

Hey! I'm Roman's AI assistant. Ask me about his projects, skills, experience, or what he's currently building.