Skip to content

feat: add AI-assisted red-eye correction - #1469

Open
dimafa wants to merge 3 commits into
CyberTimon:mainfrom
dimafa:feat/red-eye-mask
Open

feat: add AI-assisted red-eye correction#1469
dimafa wants to merge 3 commits into
CyberTimon:mainfrom
dimafa:feat/red-eye-mask

Conversation

@dimafa

@dimafa dimafa commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add one-click AI-assisted red-eye detection to the masking panel
  • lazily download and cache OpenCV YuNet for face and eye landmark detection
  • refine landmarks against coherent red pupil pixels and create ordinary radial masks
  • apply HSL Reds saturation and luminance adjustments of -100 to the generated Red Eye mask
  • avoid duplicate pupil masks and append missing detections to an existing Red Eye group
  • add localized UI text for every supported locale

Why

RapidRAW does not have a dedicated red-eye workflow. Manually creating and positioning radial masks for every affected pupil is repetitive, especially across event and family photo collections.

YuNet provides face and eye landmarks, while the pixel refinement step limits corrections to strongly red, coherent pupil regions. The additional landmark geometry, region-size, and color checks reject corrected pupils, neutral eyes, warm skin, and unreliable profile-face landmarks.

User impact

The new eye button in the Masking panel detects red pupils and creates an editable Red Eye group containing standard radial masks. Running detection again is idempotent: existing overlapping pupils are skipped, and missing pupils are appended to the existing group.

The model is downloaded only when the feature is first used and is verified with a pinned SHA-256 checksum.

Validation

  • cargo fmt --manifest-path src-tauri/Cargo.toml -- --check
  • cargo check --manifest-path src-tauri/Cargo.toml
  • cargo test --manifest-path src-tauri/Cargo.toml red_ -- --nocapture — 10 passed
  • npm run build
  • npm run i18n:runtime-check — 952 plural resolutions across 12 locales
  • npx tauri build --debug --bundles app
  • exact regression images:
    • IMG_1762-5.JPG: expected 0, detected 0
    • _MG_3246.JPG: expected 2, detected 2
    • IMG_2201.JPG: expected 2, detected 2
    • IMG_1686-5.JPG: expected 2, detected 2
    • IMG_6647.JPG: expected 2, detected 2
    • public before/after composite: expected 2 / 0, detected 2 / 0
  • manually tested on macOS across approximately 40 photos with and without red eye

Repository-wide npm run typecheck, npm run lint, npm run format:check, and the extraction phase of npm run i18n:check still report unrelated pre-existing failures on current upstream/main. The changed frontend and locale files pass targeted formatting, the production Vite build passes, and the i18n runtime validation passes.

Screenshots

RedEye1 RedEye-2 RedEye3

@dimafa
dimafa marked this pull request as ready for review August 4, 2026 07:11
@dimafa
dimafa requested a review from CyberTimon as a code owner August 4, 2026 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant