Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KeepR

A field hockey goalkeeper performance tracking app for iOS, built with SwiftUI and powered by Apple's Vision framework for automatic ball detection.

Features

  • Automatic Ball Tracking — Uses Vision framework contour detection and object tracking to follow the ball in real time, no manual input needed.
  • Auto Goal Detection — Automatically identifies the goal using rectangle detection and determines whether each shot was a goal or a save.
  • Landscape Camera View — Forces landscape orientation during recording for maximum field of view.
  • Video Clip Export — Continuously records during a match and exports trimmed clips (±3 seconds around each event) to the Photos library.
  • Match Management — Create matches, track goals conceded and saves, and review match history.
  • Statistics Dashboard — View save percentage, total saves, and performance trends across matches.
  • Shot Map — Visual representation of shot events during a match.

Requirements

  • iOS 17.0+
  • Xcode 15.0+
  • iPhone with rear camera (camera features unavailable in Simulator)

Getting Started

  1. Clone the repository:
    git clone https://github.com/brendonhumphreys/KeepR.git
  2. Open KeepR.xcodeproj in Xcode.
  3. Select a development team under Signing & Capabilities.
  4. Build and run on a physical device.

How It Works

  1. Create a match — Enter the opponent name and venue.
  2. Start camera tracking — The app opens in landscape with the rear camera.
  3. Automatic detection — The Vision framework scans for the ball and goal:
    • Ball tracking uses VNTrackObjectRequest with contour-based re-detection when tracking is lost.
    • Goal detection uses VNDetectRectanglesRequest to find the goal frame, running every ~1 second.
  4. Event recording — When the ball enters and stays in the goal zone for multiple frames, a goal is logged. If it approaches but leaves, a save is logged.
  5. Clip export — On ending the session, video clips are trimmed around each detected event and saved to Photos.

Architecture

KeepR/
├── KeepRApp.swift              # App entry point + AppDelegate for orientation lock
├── ContentView.swift           # Tab bar + shared components
├── Models/
│   ├── Match.swift             # SwiftData match model
│   └── ShotEvent.swift         # SwiftData shot event model
├── Camera/
│   ├── CameraManager.swift     # AVCaptureSession, recording, goal evaluation
│   ├── BallTrackerService.swift # Vision ball tracking + goal rectangle detection
│   └── CameraPreviewView.swift # UIViewRepresentable camera preview
└── Views/
    ├── HomeView.swift          # Home tab + new match form
    ├── LiveMatchView.swift     # Live match timer and camera launcher
    ├── CameraTrackingView.swift # Full-screen landscape camera overlay
    ├── MatchHistoryView.swift  # Match list with swipe-to-delete
    ├── MatchDetailView.swift   # Match detail with timeline
    ├── ShotMapView.swift       # Visual shot map
    └── StatsView.swift         # Statistics dashboard

License

Copyright (c) 2026 Brendon Humphreys. All rights reserved.

This project is licensed under the MIT License — see the LICENSE file for details.

About

Field hockey goalkeeper tracking app with Vision-based automatic ball detection

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages