A lightweight Go application using GoCV and Haar Cascade for real-time webcam-based face detection. Features a live preview with a heads-up display (HUD) showing FPS and hotkeys, plus eye validation to reduce false positives.
- Real-time Preview: Webcam feed with HUD showing FPS and hotkeys.
- Face Detection: Haar Cascade with eye validation for accuracy.
- Hotkeys:
ESC: Exit the application.S: Save a snapshot.F: Flip (mirror) the feed.G: Toggle grayscale mode.E: Apply Canny edge detection.N: Revert to normal mode.
- OS: macOS (tested on Apple Silicon)
- Go: ≥ 1.21
- OpenCV: 4.x (via Homebrew)
- Tools:
pkg-config
brew update
brew install opencv pkg-configAdd OpenCV to PKG_CONFIG_PATH:
echo 'export PKG_CONFIG_PATH="$(brew --prefix opencv)/lib/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.zshrc
source ~/.zshrcVerify OpenCV installation:
pkg-config --modversion opencv4git clone <repository-url>
cd <repository-directory>
go mod tidyRun the application:
go run .ESC: QuitS: Save snapshotF: Flip feedG: GrayscaleE: Canny edgesN: Normal mode
- Fork the repository.
- Create a branch (
git checkout -b feature/your-feature). - Commit changes (
git commit -m 'Add feature'). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
Ensure code follows the project’s style and includes tests.