This project develops a classical (non-deep-learning) computer vision system that detects and localises the University of Ghana logo in still images using OpenCV
# Classical Object Detection and Localisation System
Target object: University of Ghana logo (procedural placeholder crest — see note below)
## Quick start
## python data_generator.py builds data/ (70 test images + template + annotations.json)
```bash
pip install opencv-python numpy matplotlib
python experiments.py # runs every experiment in the report, writes results/plots/
```
## Layout
```
data_generator.py dataset + ground-truth generation
detector/
utils.py IoU, non-max suppression
masked_ncc.py masked mean-subtracted NCC (see docstring for derivation)
template_matcher.py multi-scale masked-NCC detector
sliding_window.py window/step search, NumPy-scored
feature_matcher.py ORB + RANSAC homography detector
evaluation.py IoU matching -> Precision / Recall / F1
visualize.py box drawing, image-grid panels
experiments.py every experiment + plot used in the report
data/ generated dataset (templates/, test/images/, annotations.json)
results/plots/ all figures and JSON result dumps referenced in the report
```
## Two real bugs fixed during development (documented in the report, Sections 3.1 & 5.1–5.2)
- An early template with unmasked black corners produced strongly *negative*
correlation at the true object location because test backgrounds weren't
black. Fixed with alpha-channel masking.
- OpenCV's only built-in masked correlation mode (`TM_CCORR_NORMED`) is not
mean-subtracted and scored ~0.86 almost everywhere regardless of structure.
Fixed by deriving and implementing a proper masked, mean-centred NCC from
scratch (`detector/masked_ncc.py`).