# 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