Spaces:
Running

aditya-rAj19 commited on
Commit
f008eb7
·
1 Parent(s): 0ab4ea6

Refuse a head swap when the two heads face different ways, and say so

Browse files

full_head_swap fits a 2D similarity transform, so it can slide, spin and scale
the source head but cannot turn it. Transplanting a head that is nodded down
onto a body with its chin up lands visibly crooked however well the seam is
blended, and nothing downstream can correct it.

Measured against the Library target (pitch +14, yaw 0): of four test photos,
one differed by 26 degrees of pitch, one by 27 of yaw, one by 30 and 20. Those
are exactly the results that come out misaligned.

The pose delta is now checked before transplanting. Past 25 degrees of pitch or
yaw the head swap is skipped and the clean face swap is used instead; between 15
and 25 it runs but says the alignment may be imperfect. Roll is excluded on
purpose — it is in-plane and the transform already corrects it. A 20-degree case
was checked by eye and still looks right, so the cut sits above it.

The frontend never rendered the warnings array at all, so this explanation — and
the pre-existing "face is very small" notes — would have gone nowhere, and a
skipped head swap would just look like the toggle did nothing. Results now show
them.

14 tests pass; frontend builds.

3 files changed +83
Files changed (3)
core/head_swap.py+48
frontend/src/pages/AppPage.jsx+19
web_app.py+16