Skip to content

Commit ff198f4

Browse files
feat(camera): improve capture guidance accuracy
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
1 parent 1e6ac34 commit ff198f4

10 files changed

Lines changed: 406 additions & 44 deletions

File tree

.flow/epics/fn-16-7jn.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"branch_name": "fn-16-camera-accuracy",
3+
"created_at": "2026-01-30T11:38:52.151351Z",
4+
"depends_on_epics": [],
5+
"id": "fn-16-7jn",
6+
"next_task": 1,
7+
"plan_review_status": "unknown",
8+
"plan_reviewed_at": null,
9+
"spec_path": ".flow/specs/fn-16-7jn.md",
10+
"status": "open",
11+
"title": "Camera accuracy & capture feedback improvements",
12+
"updated_at": "2026-01-30T11:38:52.151735Z"
13+
}

.flow/specs/fn-16-7jn.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# fn-16-7jn Camera accuracy & capture feedback improvements
2+
3+
## Overview
4+
Improve live camera guidance accuracy and post-capture validation so users get more reliable “ready to capture” feedback and fewer misclassified shots.
5+
6+
## Scope
7+
- CameraService + FaceDetector (Vision orientation, quality metrics, lighting/sharpness evaluation)
8+
- Live guidance stability (multi-frame smoothing)
9+
- Post-capture validation in CameraPreviewView
10+
- Update PhotoStandardizationMetadata mapping as needed
11+
12+
## Approach
13+
1) Orientation-aware Vision: derive correct CGImagePropertyOrientation from camera position + sample buffer, feed Vision requests accordingly, add VNDetectFaceCaptureQualityRequest to improve sharpness/quality accuracy, and replace lighting heuristic with downsampled CIAreaAverage.
14+
2) Live smoothing: maintain a rolling window of PhotoCondition snapshots and compute a consensus/median result, only mark isReady after N stable frames.
15+
3) Post-capture validation: run a full-quality pass on the captured image; if it fails, present retake guidance and mark metadata accordingly.
16+
17+
## Quick commands
18+
<!-- Required: at least one smoke command for the repo -->
19+
- `make test`
20+
21+
## Acceptance
22+
- [ ] Vision requests use correct orientation and capture quality metrics
23+
- [ ] Live guidance uses multi-frame smoothing to reduce jitter
24+
- [ ] Post-capture validation prompts users on failed conditions
25+
- [ ] Tests/linters pass
26+
27+
## References
28+
- SkinLab/Core/Utils/CameraService.swift
29+
- SkinLab/Features/Analysis/Views/CameraPreviewView.swift

.flow/tasks/fn-16-7jn.1.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"assignee": null,
3+
"claim_note": "",
4+
"claimed_at": null,
5+
"created_at": "2026-01-30T11:39:27.557346Z",
6+
"depends_on": [],
7+
"epic": "fn-16-7jn",
8+
"id": "fn-16-7jn.1",
9+
"priority": null,
10+
"spec_path": ".flow/tasks/fn-16-7jn.1.md",
11+
"status": "todo",
12+
"title": "Add orientation-aware Vision analysis and capture quality scoring",
13+
"updated_at": "2026-01-30T11:40:05.919920Z"
14+
}

.flow/tasks/fn-16-7jn.1.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# fn-16-7jn.1 Add orientation-aware Vision analysis and capture quality scoring
2+
3+
## Description
4+
Update CameraService/FaceDetector to use correct Vision orientation, add VNDetectFaceCaptureQualityRequest, and replace lighting estimation with downsampled CIAreaAverage so live quality signals are more accurate.
5+
## Acceptance
6+
- [ ] Vision handlers receive correct orientation for front/back camera frames
7+
- [ ] Capture quality score is used for sharpness/quality evaluation
8+
- [ ] Lighting estimation uses downsampled CIAreaAverage
9+
- [ ] make test passes
10+
## Done summary
11+
- Added Vision orientation mapping for live frames and captured images.
12+
- Integrated VNDetectFaceCaptureQualityRequest and used it to derive sharpness.
13+
- Replaced lighting analysis with CIAreaAverage-based brightness.
14+
## Evidence
15+
- Commits:
16+
- Tests: make format-check, make lint, xcodebuild test -project SkinLab.xcodeproj -scheme SkinLab -destination "platform=iOS Simulator,name=iPhone 16e,OS=26.2" -enableCodeCoverage YES -resultBundlePath TestResults.xcresult
17+
- PRs:

.flow/tasks/fn-16-7jn.2.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"assignee": null,
3+
"claim_note": "",
4+
"claimed_at": null,
5+
"created_at": "2026-01-30T11:39:27.691507Z",
6+
"depends_on": [],
7+
"epic": "fn-16-7jn",
8+
"id": "fn-16-7jn.2",
9+
"priority": null,
10+
"spec_path": ".flow/tasks/fn-16-7jn.2.md",
11+
"status": "todo",
12+
"title": "Stabilize live guidance with multi-frame smoothing",
13+
"updated_at": "2026-01-30T11:40:15.751272Z"
14+
}

.flow/tasks/fn-16-7jn.2.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# fn-16-7jn.2 Stabilize live guidance with multi-frame smoothing
2+
3+
## Description
4+
Add multi-frame smoothing for PhotoCondition (rolling window consensus/median) and require stable readiness across N frames to reduce jittery guidance.
5+
## Acceptance
6+
- [ ] Live guidance uses smoothed PhotoCondition derived from multiple frames
7+
- [ ] Ready state requires N consecutive acceptable frames
8+
- [ ] make test passes
9+
## Done summary
10+
- Added rolling window smoothing for PhotoCondition to stabilize guidance.
11+
- Added stableReady gating and stability suggestion when conditions are otherwise good.
12+
## Evidence
13+
- Commits:
14+
- Tests: make format-check, make lint, xcodebuild test -project SkinLab.xcodeproj -scheme SkinLab -destination "platform=iOS Simulator,name=iPhone 16e,OS=26.2" -enableCodeCoverage YES -resultBundlePath TestResults.xcresult
15+
- PRs:

.flow/tasks/fn-16-7jn.3.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"assignee": null,
3+
"claim_note": "",
4+
"claimed_at": null,
5+
"created_at": "2026-01-30T11:39:27.856617Z",
6+
"depends_on": [],
7+
"epic": "fn-16-7jn",
8+
"id": "fn-16-7jn.3",
9+
"priority": null,
10+
"spec_path": ".flow/tasks/fn-16-7jn.3.md",
11+
"status": "todo",
12+
"title": "Post-capture validation and retake UX",
13+
"updated_at": "2026-01-30T11:40:25.498109Z"
14+
}

.flow/tasks/fn-16-7jn.3.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# fn-16-7jn.3 Post-capture validation and retake UX
2+
3+
## Description
4+
Run a full-quality validation pass after capture and prompt retake when conditions are not acceptable; ensure metadata reflects the validated conditions.
5+
## Acceptance
6+
- [ ] Captured photo is re-evaluated with high-precision validation
7+
- [ ] Failed validation triggers retake guidance UI
8+
- [ ] Stored PhotoStandardizationMetadata reflects validated results
9+
- [ ] make test passes
10+
## Done summary
11+
- Added post-capture validation for full-quality checks before accepting a photo.
12+
- Added retake prompt with optional user override and metadata capture.
13+
## Evidence
14+
- Commits:
15+
- Tests: make format-check, make lint, xcodebuild test -project SkinLab.xcodeproj -scheme SkinLab -destination "platform=iOS Simulator,name=iPhone 16e,OS=26.2" -enableCodeCoverage YES -resultBundlePath TestResults.xcresult
16+
- PRs:

0 commit comments

Comments
 (0)