estimating-relative-rotation-and-symmetry
pythonr = run( ctx, reference_frame=ref_cam, reference_mask=ref_mask, frame=cam, mask=mask, symmetry_order=1 ) # a face-up domino: the pips break the 180-degree symmetry if r["route"] == "rotation_found": turn = r["rotation_deg"] # current = reference turned by this, clockwise + in the image # any turn + k * r["period_deg"] is equivalent: take the one inside the wrist's limits
- Outline: elongation sqrt(lambda1 / lambda2) of each mask's pixel covariance.
Over 1.3 the outline is 2-fold: angle = principal axis, mod 180. Otherwise
it is 4-fold: angle = the side of
cv2.minAreaRect, mod 90. The turn is the difference, folded into the period. symmetry_order(default: the outline's) says how many turns look the same. Equal to the outline's: done,rotation_foundmodulo 360 / order.- Lower (a face-up domino, a printed part): each of the outline's candidate
turns (refined +-4 deg in 0.5 deg steps) is tried by rotating the
reference patch about its centroid and correlating it with the current
patch inside both masks (normalised, grey). The best wins if it beats the
next by more than 0.05; otherwise
symmetric_ambiguous.
The skill only uses appearance when told the part's look is asymmetric. Under directional light a plain 2 x 4 brick turned by 180 deg looks different in its shading, and that is not information about the part: asked to pick among a plain brick's half-turns by appearance, the correlation chose the wrong one in about half the pairs, with clear margins (0.3-0.8). The symmetry of a known part comes from its catalogue entry (domino face-up 1, face-down 2; brick 1 x N or 2 x N 2; N x N 4).
Measured
80 pairs of the same part in two wrist views (left wrist D405 intrinsics, 0.15-0.25 m over the
table, up to 12 deg tilt, random camera yaw, random turn between the views). Parts: LEGO bricks
and plates 1 x 1 - 2 x 4, DUPLO 2 x 2 - 2 x 4, dominoes face-up (pips) and face-down. They were
rendered in MuJoCo and composited on real wrist frames, with the true turn from the projected
part axis; see tools/README.md for the renders. Error = |reported - true| modulo the reported
period. Reproduce with tests/bundles/_relative_rotation_eval.py.
| method | masks | within 5 deg | within 10 deg | median error | face-up dominoes: half-turn resolved | GPU |
|---|---|---|---|---|---|---|
| this skill (catalogue symmetry) | rendered | 80 / 80 | 80 / 80 | 0.34 deg | 10 / 12 right, 2 ambiguous, 0 wrong | none |
| this skill | SAM 2.1 base-plus from the box (mask IoU 0.98) | 78 / 80 | 79 / 80 | 0.46 deg | 11 / 12 resolved: 10 right, 1 wrong; 1 ambiguous | none |
| this skill, outline only (symmetry not given) | rendered | 80 / 80 | 80 / 80 | 0.34 deg | (reports modulo 180) | none |
| Orient Anything V2, crops masked to white | rendered | 53 % | 72 % | 4.1 deg | 1 / 6 half-turns | 7.2 GB |
| Orient Anything V2, raw crops | -- | 8 % | 14 % | 40 deg | 0 / 6 | 7.2 GB |
- By outline: elongated parts 0.56 deg median, square parts 0.37 deg (the rectangle fit; the principal axis gave 6 deg on them).
- Orient Anything V2's symmetry order on masked crops: 17 of 19 square parts right, but 45 of 49 2-fold parts called 4-fold. It is trained on object-level renders; a 2-3 cm part seen from above is out of its domain. It was not ported.
- Time on the CPU: 2.4 ms per pair (median; 2.6 ms p90) from the outline, 10 ms (14 ms p90) with the appearance test.
Limits
- Image-plane turn: the camera must look roughly down on the part (tilt up to 12 deg tested) at a similar height in both views. A big height change scales the patch; the outline turn is unaffected, the appearance test degrades.
- Rendered parts on real backgrounds, not real photographs of the parts.
- A part touching another: segment it alone first (its mask decides the outline).


