---
convoy: improve-scan-card-detection
brief_number: 1
depends_on: []
recommended_model: composer-2.5-fast
model_tier: fast
files:
  - lib/scanner-card-warp.js
  - lib/scanner-card-detection.js
  - test/lib/scanner-card-warp.test.js
  - test/lib/scanner-card-detection.test.js
---

# Brief 1: Quad corner detection + perspective warp

## Goal

Replace axis-only Sobel box hunt with four-corner refinement and a
homography warp helper that produces rectified card JPEGs.

## Acceptance criteria

- [ ] `lib/scanner-card-warp.js` exports `orderQuadCorners`,
      `computeHomography`, `warpCardCaptureFromVideo`
- [ ] `detectCardShapesFromFrame` returns `corners` in video space
- [ ] Tracker merge preserves `corners` on tracked cards
- [ ] Unit tests for warp math + corner refinement
