Files
CheapRetouch/specs/10-object-removal.md
jared 1049057d7d Add Ralph Wiggum agent setup and project specifications
- Add project constitution with vision, principles, and autonomy settings
- Add 15 feature specifications covering full app scope
- Configure agent entry points (AGENTS.md, CLAUDE.md)
- Add build prompt and speckit command for spec creation
- Include comprehensive .gitignore for iOS development

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 23:19:41 -05:00

1.5 KiB

Foreground Object Removal Feature

Description

Remove foreground objects via tap detection with smart brush fallback.

Acceptance Criteria

  • User taps object in photo with Object tool selected
  • VNGenerateForegroundInstanceMaskRequest attempts to isolate object
  • If mask found: preview shown, user confirms, inpaint executes
  • If no mask found: "Use brush to select" prompt displayed
  • Smart brush fallback:
    • User paints rough selection over object
    • App refines selection to nearest strong edges
    • Edge refinement uses gradient magnitude analysis
    • Refined mask preview shown
    • User confirms refined mask
  • Brush tool settings: size slider (1-100px)
  • Edge refinement toggle available
  • Clear messaging about limitations:
    • "Works best on objects that stand out from background"
    • "Low-contrast objects may require manual selection"
  • Performance: detection < 500ms, edge refinement < 200ms

Technical Notes

  • Vision detects visually distinct foreground regions
  • It separates by contrast, not semantic understanding
  • Edge refinement: compute gradient magnitude, snap brush stroke to nearby edges
  • EdgeRefinement.swift utility for gradient-based snapping

Edge Cases

  • Object blends with background: Vision returns no mask, prompt brush
  • Very large object: may affect inpaint quality, warn if >30% of image
  • Object at image edge: handle boundary in mask and inpaint
  • User brush stroke misses object: edge refinement helps, but may need retry