Skip to content

Integrate face anonymization for photogrammetry scans #170

Open
harmening wants to merge 22 commits into
devfrom
face-removal-clean
Open

Integrate face anonymization for photogrammetry scans #170
harmening wants to merge 22 commits into
devfrom
face-removal-clean

Conversation

@harmening

Copy link
Copy Markdown
Contributor

Integrate face anonymization for photogrammetry scans (builds on #166)

Builds on @Mah-diaa's #166, which contributed the whole face-anonymization algorithm and its test suite. Thanks a lot for that work!
This PR mostly wires it into cedalion's conventions and tightens a few edge cases; the method is unchanged.

What changed vs #166

  • Module layout. pipeline.py is now a thin anonymize_scan orchestrator, shared helpers are consolidated in _utils.py, all mask logic (including the landmark carve-outs) lives in mask.py, and preprocessing owns the framing steps.
  • CRS/units integration. The pipeline stays in xarray + pint and reuses the existing points.apply_transform and affine_transform_from_numpy. Transforms carry their CRS: revert_to_einstar_frame takes an AffineTransform and derives the target frame from it instead of a hardcoded string. anonymize_scan validates that surface and landmarks share the same CRS.
  • API consistency. Renamed normalize_axes -> orient_y_anterior and align_axes_from_landmarks -> align_to_ctf, 4×4 transforms throughout, and cap parameters grouped into a frozen CapDetectionParams.
  • Broader inputs + guards. Works also on textureless meshes now; fixes cap detection when the profile peaks at the first bin; head isolation warns instead of silently keeping the body; ValueError on degenerate landmarks (LPA==RPA, Nz on the ear axis); RuntimeError if masking removes most of the mesh.
  • Tests + docs. Expanded the tests (including the CRS-mismatch and textureless paths) and added a Photogrammetry docs page.

Original implementation: @Mah-diaa (#166).

@harmening harmening changed the title Face removal clean Integrate face anonymization for photogrammetry scans Jun 23, 2026
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.

2 participants