@rig-c/pose 0.16.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -14
- package/cli.ts +73 -17
- package/package.json +1 -1
- package/src/clean.ts +346 -10
- package/src/legs.ts +423 -41
- package/src/map.ts +49 -3
- package/src/pose.ts +322 -24
- package/src/reduce.ts +167 -7
- package/src/retarget.ts +159 -48
- package/src/run.ts +251 -27
- package/src/switch.ts +31 -8
- package/src/verify.ts +29 -4
package/README.md
CHANGED
|
@@ -25,17 +25,18 @@ The map names **chains**: each limb as bones that descend from one another, pare
|
|
|
25
25
|
## Clean first: `rig-pose clean`
|
|
26
26
|
|
|
27
27
|
```sh
|
|
28
|
-
rig-pose clean --pose dance.scan.json --out dance.pose.json [--loop] [--legs 5] [--rest 7] [--hips-inferred]
|
|
28
|
+
rig-pose clean --pose dance.scan.json --out dance.pose.json [--loop] [--legs 5] [--rest 7] [--hips-inferred] [--hold off] [--hold-speed 0.015] [--hold-reach 0.03]
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
`retarget` reads only a sequence that `clean` wrote ([#67](https://github.com/rig-c/pose/issues/67)). A pose model reads each frame alone, so a hanging wrist moves ±20 px a frame and a cloak-hidden leg jumps 100+ px, and every key carries that shake. `clean` takes it out once, at the sequence, where it can be inspected. A sequence without the record is refused by name (`POSE_NOT_CLEANED`), and the message is the `clean` command to run on that file. There is no flag to skip the step. Windows of 1 (`--legs 1 --rest 1`) are a legitimate run that smooths nothing, and they are recorded as such.
|
|
31
|
+
`retarget` reads only a sequence that `clean` wrote ([#67](https://github.com/rig-c/pose/issues/67)). Where the video's camera moves, the order is **scan → clean → retarget** ([#80](https://github.com/rig-c/pose/issues/80)): a zoom step is a jump of the picture, and `clean`'s spike and smoothing steps would read it as motion of the body, so `tools/scan.py` takes the camera out of the raw sequence first and `clean` reads what it writes. A pose model reads each frame alone, so a hanging wrist moves ±20 px a frame and a cloak-hidden leg jumps 100+ px, and every key carries that shake. `clean` takes it out once, at the sequence, where it can be inspected. A sequence without the record is refused by name (`POSE_NOT_CLEANED`), and the message is the `clean` command to run on that file. There is no flag to skip the step. Windows of 1 (`--legs 1 --rest 1`) are a legitimate run that smooths nothing, and they are recorded as such.
|
|
32
32
|
|
|
33
33
|
The steps, in this order, each printed with its figures:
|
|
34
34
|
|
|
35
35
|
1. **Spikes.** A joint more than 0.2 trunk lengths from its 5-frame median takes the median. The trunk is neck → mid-hip, the median over the clip. Each replacement is listed by frame and joint (`SPIKE`). Without `--loop`, a clip end cuts the window of the first and last two frames. There the median is a neighbour's value, and a joint moving steadily would read as a spike. Those frames are **not tested**, and the `SPIKES` line and the record name them. Reflecting the window does not help: the median of `[x2, x1, x0, x1, x2]` is still `x1`.
|
|
36
36
|
2. **Occlusion.** A joint whose state is not `observed` (or `inferred`), or whose score is under 0.3, takes its 3-frame median (`OCCLUDED`).
|
|
37
37
|
3. **Smoothing.** A quadratic Savitzky–Golay per joint: the legs (both hips, knees and ankles) over `--legs` frames (default 5), every other joint over `--rest` (default 7). A window is 1 (none) or odd and at least 5. 3 is refused because a quadratic through 3 points passes through all three. Without `--loop`, the window is cut at the ends. Where fewer than three frames have a position, the degree drops to fit the ones that do.
|
|
38
|
-
4. **Floor.** Only with `--loop`: the whole figure moves in y by one constant, so that the lowest ankle over the cycle is where it was before smoothing.
|
|
38
|
+
4. **Floor.** Only with `--loop`: the whole figure moves in y by one constant, so that the lowest ankle over the cycle is where it was before smoothing. A loop is also written with `"travel": "in-place"` ([#92](https://github.com/rig-c/pose/issues/92), the `TRAVEL` line): one cycle of a gait, repeated, does not travel, whatever its supporting foot does in the picture ([below](#the-pose-rig-pose-sequence1)).
|
|
39
|
+
5. **Hold** ([#91](https://github.com/rig-c/pose/issues/91)). A joint that has stopped is written at one position (`HOLD`), because detector noise on a still joint is not motion, and no smoothing window removes it without also smearing the movement into the stop. Below.
|
|
39
40
|
|
|
40
41
|
A **median** is taken per coordinate (x and y apart), over the window's frames on which the joint has a position, its own frame included, whatever its state. An even count takes the mean of the middle two. **`--loop`** says the sequence is one cycle, such as a gait from strike to strike. Every window then wraps, the last frame running into the first, so nothing is untested; a cycle shorter than its widest window is refused (`CLEAN_LOOP`). **Nothing is invented.** A joint with no position on a frame gets none: `retarget` holds it and prints a `HOLD` line. States and scores are written as they were read. `--coco` reads COCO-17 (below) and converts it first. `--person` picks the person when there is more than one, and only that person is written.
|
|
41
42
|
|
|
@@ -50,7 +51,43 @@ The output carries the record, here the dancer's from the table below:
|
|
|
50
51
|
|
|
51
52
|
`jitter` is the mean |second difference| of y, in px/f², over every joint and every three consecutive frames that have a position, wrapping with `--loop`. It is measured on the sequence as read and on the cleaned positions. `retarget` prints the record as its `CLEAN` line and copies it into `--report`.
|
|
52
53
|
|
|
53
|
-
**`--hips-inferred`** ([#63](https://github.com/rig-c/pose/issues/63)) declares that the hips are not seen: under a skirt or a cloak the pose model still places them, but where it puts them is its guess. After the
|
|
54
|
+
**`--hips-inferred`** ([#63](https://github.com/rig-c/pose/issues/63)) declares that the hips are not seen: under a skirt or a cloak the pose model still places them, but where it puts them is its guess. After the steps, `r_hip` and `l_hip` are marked `inferred` on every frame where they have a position (`INFERRED`), and the record's params carry `"hipsInferred": { "by": "declared" }` — the person running `clean` said so. Positions and scores are unchanged, so `retarget`'s keys are the same with the flag and without it. What changes is the `POSTURE` line, which does not read a hip tilt off inferred hips (below), and the `CLEAN` line, which ends `hips inferred (declared at clean)`.
|
|
55
|
+
|
|
56
|
+
**The stillness hold** ([#91](https://github.com/rig-c/pose/issues/91)) runs on the cleaned positions, after the smoothing and the floor, **joint by joint**: stillness is a property of a joint, so a hand that has stopped is held while the elbow beside it still settles. A joint's speed on a frame is its movement from the frame before, in trunk lengths, taken as a 5-frame median. A **hold** of a joint is a span of at least 0.5 s (the first frame's time to the end of the last) on every frame of which its median speed is under `--hold-speed` (default 0.015 trunk lengths a frame), and over which it stays within `--hold-reach` (default 0.03 trunk lengths) of its own span median. Speed alone cannot tell a slow drift from stillness, because a drift accumulates. For each joint the span is chosen greedily, left to right: from a still frame it grows one frame at a time while the reach holds on the grown span, its median read again each time, and stops at the first frame that breaks it. If what it reached lasts 0.5 s it is a hold and the search resumes after it; if not, the search moves one frame on. A span does not cross a loop's seam.
|
|
57
|
+
|
|
58
|
+
On every frame of a hold the joint takes its per-coordinate median over the span. It blends in linearly over the 6 frames before it (the 6th stays as cleaned, the frame before the span is ⅚ of the way) and out over the 6 frames after it, mirrored. A blend frame inside another hold of the same joint is not touched; where two blends of one joint meet, the larger weight wins. Where one hold of a joint ends on frame k and the next starts on k + 1 + g, with a gap g of under 6 frames (a **seam**: the reach broke while the joint was still moving slowly, or a few frames between two holds failed a test), the two medians differ, and the joint would jump between them. A seam cross-fades over 6 + g frames, symmetric about the gap's centre: frames k − 2 … k + 3 + g take 1/(2(6 + g)), 3/(2(6 + g)), … of the way from the first median to the second (for g = 0: 1/12, 3/12, … 11/12, the blend's sixths placed symmetric about the seam), so no frame moves more than 1/(6 + g) of the step. The cross-fade replaces the blends on the gap's frames. Each seam is printed (`SEAM`) and recorded with the joint, the second hold's first frame, the step in trunk lengths and the gap. A hold that carries a cross-fade has a non-zero jitter after: the ramp's own curvature, printed as `(ramp)`, not noise. A joint that fails keeps its cleaned track. A joint with no position on a frame gets none, and states and scores are kept.
|
|
59
|
+
|
|
60
|
+
Each hold is printed (`HOLD`, joint by joint, with its largest speed and reach) and recorded with the joint's jitter inside it, before and after. Where some joints are held, every run of the same frames (the held spans joined where they overlap or touch) on which a joint has no hold is named with the test it fails there and its figure (`UNHELD`, and the record's `unheld`): `speed` (its largest median speed), else `reach` (its largest distance from its median over the run), else `short` (it is still, but for under 0.5 s; the figure is its seconds), else `span` (it passes all three, and its spans broke elsewhere).
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
"params": { "loop": false, "legs": 5, "rest": 7, "hold": { "speed": 0.015, "reach": 0.03, "minSeconds": 0.5, "blend": 6 } },
|
|
64
|
+
"holds": [{ "joint": "nose", "frames": [first, last], "jitter": { "before": before, "after": 0 } }, …],
|
|
65
|
+
"seams": [{ "joint": "neck", "frame": second hold's first frame, "step": trunk lengths, "gap": frames }, …],
|
|
66
|
+
"unheld": [{ "joint": "l_elbow", "frames": [first, last], "test": "reach", "value": figure }, …]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The `CLEAN` line names, for each region, the joints held over which frames and the frames not held with their test and figure and the seams cross-faded (`HOLD frames a–b: held nose, neck, … a–b; seams cross-faded: neck f (step …); not held: l_elbow c–d (reach … > 0.03)`), or says `no HOLD`. `--hold off` turns the step off: the positions are those of a clean without it, and the record carries `"hold": "off"` and none of `holds`, `seams` and `unheld`. A record written before #91 names none of them, and is read as it was.
|
|
70
|
+
|
|
71
|
+
**Measured hips: `tools/pelvis.py`** ([#86](https://github.com/rig-c/pose/issues/86), not shipped) reads the pelvis line where the eye reads it under a skirt, off the skirt's waistband, and runs after `clean`: scan → clean → pelvis → retarget. It takes the video and a sequence `clean` wrote without `--hips-inferred`. It refuses by name, writing nothing:
|
|
72
|
+
|
|
73
|
+
- a sequence with no `cleaned` record (`PELVIS_NOT_CLEANED`);
|
|
74
|
+
- one whose hips are already marked (`PELVIS_HIPS_INFERRED`);
|
|
75
|
+
- a frame count other than the video's (`PELVIS_FRAMES`);
|
|
76
|
+
- a clip on which no frame gives a reading (`PELVIS_NO_READING`).
|
|
77
|
+
|
|
78
|
+
On each frame it reads the top edge of the dark region at the waist. The region is set by the hips and the frame's trunk length. The tool keeps the edge's flattest high run, since a flaring skirt's sides are steep and are not the pelvis line, and fits a line to it.
|
|
79
|
+
|
|
80
|
+
A frame gives no reading, declined with the reason, when:
|
|
81
|
+
|
|
82
|
+
- a wrist lies in front of the waist (the picture under it is not the skirt's dark);
|
|
83
|
+
- the edge is too broken or too far from a line;
|
|
84
|
+
- the reading is over 25° from level, or a lone outlier: further, per frame, than the misread guard allows from both the read before it and the reading after it.
|
|
85
|
+
|
|
86
|
+
The tool never draws a line through a hand in front. A declined frame does not fall back to the detector's hip line, which is the value known to be wrong there. If two reads lie close in time on either side, the frame takes the interpolation between them. Otherwise it holds the earlier read to the end of its run, so the written angle changes only at a read; at the clip's start, with no earlier read, it holds the later one.
|
|
87
|
+
|
|
88
|
+
Both hips are marked `inferred` on every frame and turned about their midpoint to the frame's angle, keeping the midpoint and the width. The record says which frame is which: `"hipsInferred": { "by": "measured", "method", "read", "interpolated", "held": [[first, last], …], "declined": [{ "frames": [first, last], "why" }] }`. Every frame is in exactly one of `read`, `interpolated` and `held`, and `declined` lists exactly the interpolated and held frames. Runs are frame indices inside the sequence, increasing and disjoint. A malformed record is refused by name (`POSE_CLEANED`).
|
|
89
|
+
|
|
90
|
+
`tools/pelvis_selftest.py` is its synthetic check. A planted wrist on a hand in front of the waist reads "covered", and with the hand moved away the edge's angle is read again. The misread guard, the interpolation and the hold are checked frame by frame. Its mutant (`--no-cover-check`) must read a line through the hand, and the check asserts that it does.
|
|
54
91
|
|
|
55
92
|
**Measured** on HQ's references ([#67](https://github.com/rig-c/pose/issues/67)'s bars):
|
|
56
93
|
|
|
@@ -91,23 +128,24 @@ and what the run cannot decide for you it lists:
|
|
|
91
128
|
- `FLIP` — a segment that turns more than `--flip` degrees in one frame (with `--flip <deg>`; off by default) is spread over the frames around the jump; one line per spread, with the chain, the segment, the jump, the frames and h. Below.
|
|
92
129
|
- `BEND` — with `--bends clamp`, a hinge bent the wrong way is straightened on that frame instead of refusing.
|
|
93
130
|
- `FOLD` — `rigc render --folds` over the new animation: every mesh that folds, and when. A reading, not a gate.
|
|
94
|
-
- `POSTURE` — when the map has a pelvis chain (joints `r_hip`, `l_hip`) and a `translate`: the hip line's tilt range, and the sway — the x-range of mid_hip − mid_shoulder — in rig units and in shoulder widths, the pose's beside the posed rig's. A reading, not a gate. A frame on which either hip is `inferred` is left out of the tilt. When that is every frame, as after `clean --hips-inferred`, the line is `hip tilt not read: hips inferred (declared at clean)` and the report's `posture` has `"tilt": null` with `"tiltWhy"`; on some frames only, the tilt is read over the others and the line counts the frames left out (`posture.hipsInferred`). The source is read from the clean record, or is `source not stated` when the joints carry the state and the record does not. The sway reads the hips as before.
|
|
131
|
+
- `POSTURE` — when the map has a pelvis chain (joints `r_hip`, `l_hip`) and a `translate`: the hip line's tilt range, and the sway — the x-range of mid_hip − mid_shoulder — in rig units and in shoulder widths, the pose's beside the posed rig's. A reading, not a gate. A frame on which either hip is `inferred` is left out of the tilt. When that is every frame, as after `clean --hips-inferred`, the line is `hip tilt not read: hips inferred (declared at clean)` and the report's `posture` has `"tilt": null` with `"tiltWhy"`; on some frames only, the tilt is read over the others and the line counts the frames left out (`posture.hipsInferred`). The source is read from the clean record, or is `source not stated` when the joints carry the state and the record does not. With a `measured` record ([#86](https://github.com/rig-c/pose/issues/86)), the read, interpolated and held frames are the measurement, so the tilt is read on all three. The line adds `tilt measured (<method>) on N frame(s): R read, I interpolated, H held (held: <spans>)`. The report's `posture` carries `tiltMeasured: { method, frames, read, interpolated, held, heldSpans }`. The sway reads the hips as before.
|
|
95
132
|
- `SWITCH` — with `alternates` in the map ([below](#alternate-drawings-alternates)): each span on which a set of alternate drawings shows, its slots, its frames, how far the pose was from the set's key skeleton, how far each bone with a `drawn` angle was turned from it, and where each of its boundaries was moved to (`moved`, [below](#alternate-drawings-alternates)).
|
|
96
133
|
- `UNCOVERED` — with `alternates` in the map: every fold on a frame where no switch took the folding mesh off screen. This is the list of poses still to paint.
|
|
97
134
|
- `RANGE` — a chain's `range` ([below](#a-joints-range-range)): a bone whose rotate key the pose asks past its range, outside every span of a set depicting its chain, is clamped at the limit; one line per run, with the frames, the seconds and the largest overflow. The demand for an alternate.
|
|
98
135
|
- `ART-RANGE` — inside a set's span: a bone with a `drawn` angle in the set, turned from it past its limits — the set's `turn` for that bone (held at the limit) or, without one, its chain's `range` (the bone follows the pose). Listed as the pose asked it either way: the demand for another drawing of that set.
|
|
99
136
|
- `RAISED` — with `--raised-by-head` ([below](#alternate-drawings-alternates)): one line per span of a set that draws an arm raised, per chain. It gives the frames and the median eye distances (the rig's in units, the reference's in px). It gives the wrist's offset from the head centre in eye distances: the median of the reference's, of where the wrist was placed, of the rig's on the pose's angles, and of the rig's as keyed. It gives the worst |rig − reference| before and after, the worst |after − placed|, and the frames whose upper arm the set's `turn` held. `RAISED none` when the flag is given and no such set showed.
|
|
100
|
-
- `
|
|
137
|
+
- `BY-HIP` — with a set's `"place": "by-hip"` ([below](#alternate-drawings-alternates)): the `RAISED` line against the hip, one per span of such a set per chain it places. The unit is the hip width, the offset is from the mid-hip. `BY-HIP none` when the map has such a set and none of its spans showed.
|
|
138
|
+
- `REACH` — with `--raised-by-head`, or a `"by-hip"` set: a placed span whose target was out of the arm's reach, too far or too near. It names the frames, which way, and the shortfall in eye distances (hip widths for `"by-hip"`). The wrist was placed at the reach limit instead. This is not `ART-RANGE`: the rig's proportions were the limit, not the art's range. A too-near frame is placed at the limit like a too-far one, and graded at the placed distance.
|
|
101
139
|
- `LEG-SCALE` — with `--leg-scale` ([below](#the-legs-foreshortening-and-planted-feet)): per leg segment, its straight length, the spread of its picture length over it, and the frames clamped at each limit.
|
|
102
140
|
- `PIVOT` — when the map translates a bone and has both legs: the translated bone's origin against its thigh roots' midpoint at setup, in units and hip widths — the pivot every hip turn swings the legs about.
|
|
103
141
|
- `FEET` — when the map has both legs: the supports and jumps read off the reference ankles (planted or not), and on the posed build, outside the jumps, the lowest ankle's vertical range and each support span's worst vertical range and horizontal drift of the supporting ankle, in leg lengths.
|
|
104
|
-
- `STANCE` — with `--stance` ([below](#the-legs-foreshortening-and-planted-feet)): one line per run of frames planted both (with the stretch keyed, its largest k) or
|
|
142
|
+
- `STANCE` — with `--stance` ([below](#the-legs-foreshortening-and-planted-feet)): one line per run of frames planted both (with the stretch keyed, its largest k), lifted, or past the tolerance below (the pose's height kept, [#114](https://github.com/rig-c/pose/issues/114)), with the free side, the frames and the tolerance; and one per run whose stretch fell past its bounds (`past the bounds`), with the k the floor needed, the bound it had and how far the foot was left from it; and, where the leg's own range set a lower bound below 0.92, one `bound from the leg's own range` line with each side's lowest.
|
|
105
143
|
- `SHEAR` — with `--leg-scale`: every scaled bone and every bone under one, how far its art is sheared and how long its world axes are against setup. A reading.
|
|
106
144
|
- `IDLE`, `IDLE-DROPPED`, `IDLE-KEPT-OUT`, `MERGE` — the rig's idle against the new animation, and what `--carry-idle` and `--merge` put back ([below](#the-idle-what-the-retarget-drops)).
|
|
107
145
|
- `REDUCE` — with `--reduce` ([below](#few-keys---reduce)): per bone, its keys before and after and its largest error, with the frame; then the total.
|
|
108
146
|
- `TURN` — a line across the body (hips, shoulders, eyes) shorter in the picture than 0.5 of its median length, or reversed, for at least 0.15 s: the body or the head turned. A reading of the pose, made whether or not the map uses the line; it changes no key. The demand for a turned-body drawing, as `END-ON` is for a foreshortened limb.
|
|
109
147
|
|
|
110
|
-
`--report <file>` writes all of it as JSON (`rig-pose-report/1`): `options` (every figure the run used, `switchTolerance`, `switchMin`, `switchAt`, `legScale`, `plantFeet`, `stance` and `raisedByHead` included), `scale`, `holds`, `short`, `endOn`, `bends`, `flips`, `gate
|
|
148
|
+
`--report <file>` writes all of it as JSON (`rig-pose-report/1`): `spec`, `rigc` (`{ version, entry }`: the rig-c that gated it), `rig`, `animation`, `frames`, `duration`, `cleaned` (the sequence's `cleaned` record, [above](#clean-first-rig-pose-clean)), `options` (every figure the run used, `switchTolerance`, `switchMin`, `switchAt`, `legScale`, `plantFeet`, `stance`, `floor` and `raisedByHead` included), `scale`, `holds`, `short`, `endOn`, `bends`, `flips`, `gate` (rig-c's gate summary, a string), `landings`, `posture`, `folds`, `legScale`, `pivot`, `feet` (`planted`, `legLength`, `supports`, `jumps`, `steps`, `changes`, `lowered`, `floor`, `shifts`, `blend`, `closure`, and the posed `reading`; a jump is an inclusive `[first, last]` pair of frames; `lowered` holds `{ frames, was, now, cause? }` runs (`cause`, where `now` is `null`: `released` or `higher`), present only with `--plant-feet` on a sequence not declared in place ([#113](https://github.com/rig-c/pose/issues/113)); `floor` is the world y every support span was planted on and `shifts` holds one `{ side, frames, shift }` per support span in world units, `null` and empty without `--plant-feet`; `blend` is `{ bounds, runs: [{ side, frames, k: { min, max } }], over: [{ side, frames, needed, left }] }`, the supporting leg stretched on the blend frames, `null` without `--plant-feet`; `closure` is `{ drift, frames }`, the hip's x drift closed over an in-place loop, `null` unless the sequence is `"in-place"` and `--plant-feet` is given), `stance` (`tolerance`, `release`, `minSeconds`, `bounds`, `runs`: `{ state, side, frames, maxHeight, maxDepth?, k, absorbed? }` (`state` is `both`, `lifted` or `below`; `maxDepth`, on a `below` run, is the free ankle's largest distance below the supporting one in leg lengths), `over`: `{ side, frames, needed, left }`; `null` without `--stance`), `shear`, `idleDropped`, `idleKeptOut` and `merged` ([below](#the-idle-what-the-retarget-drops)), `reduce` (the tolerances and each row of `REDUCE`, [below](#few-keys---reduce)), and the demand lists. The fields a run is graded by:
|
|
111
149
|
|
|
112
150
|
| field | each entry |
|
|
113
151
|
| --- | --- |
|
|
@@ -124,8 +162,9 @@ The demand lists:
|
|
|
124
162
|
- `endOn` — above, under the short hold.
|
|
125
163
|
- `turns: [{ line, joints, frames, seconds, minFraction, reversed }]` — `line` is `hip`, `shoulder` or `eye`.
|
|
126
164
|
- `range: [{ chain, bone, frames, seconds, maxOverflow, key, limits }]` — `key` is the rotate key the pose asked for on the frame of the largest overflow, before the clamp.
|
|
127
|
-
- `artRange: [{ set, chain, bone, frames, seconds, maxOverflow, turn, limits, clamped, shortfall? }]` — `turn` is the signed art turn the pose asked on that frame; `clamped` says whether the set's `turn` held the bone there. `shortfall` (with `--raised-by-head`) marks a held upper arm whose re-aimed forearm left the wrist short of its placed point: the most, in eye distances, with `turn` and `maxOverflow` the upper arm's on that frame.
|
|
165
|
+
- `artRange: [{ set, chain, bone, frames, seconds, maxOverflow, turn, limits, clamped, shortfall?, anchor? }]` — `turn` is the signed art turn the pose asked on that frame; `clamped` says whether the set's `turn` held the bone there. `shortfall` (with `--raised-by-head`, or a `"by-hip"` set) marks a held upper arm whose re-aimed forearm left the wrist short of its placed point: the most, in eye distances (in hip widths with `anchor: "hip"`), with `turn` and `maxOverflow` the upper arm's on that frame.
|
|
128
166
|
- `raised: [{ set, chain, frames, seconds, eyes: { rig, reference }, reference, placed, before, after, worst: { before, after, placed }, short, upperHeld, reach: { min, max, farthest } }]` — with `--raised-by-head`. `reference`, `placed`, `before` and `after` are the wrist's offset from the head centre on each frame of the span, `[x, y]` in eye distances, x right and y up. `eyes` holds each side's median eye distance over the span. `worst.before` and `worst.after` are the largest |rig − reference| in x and in y; `worst.placed` is the largest |after − placed|. `short` lists the `REACH` runs, each `{ frames, how, shortfall: { max, median } }`, where `how` is `far`, `near` or `missed`. `upperHeld` lists the frames whose upper arm the set's `turn` held. `reach` gives |l0 − l1|, l0 + l1 and the farthest target from the shoulder, in world units.
|
|
167
|
+
- `byHip: [{ set, chain, frames, seconds, hips: { rig, reference }, reference, placed, before, after, worst: { before, after, placed }, short, upperHeld, reach: { min, max, farthest } }]` — Present only when a set of the map declares `place`; a run without one writes no `byHip` key. Each span of a `"place": "by-hip"` set on each chain it places ([#93](https://github.com/rig-c/pose/issues/93)): `raised`'s fields against the hip, the offsets from the mid-hip in hip widths, `hips` each side's median hip width over the span, `short` in hip widths.
|
|
129
168
|
|
|
130
169
|
Runs in `turns`, `range` and `artRange` merge across a gap of one frame, as `endOn` does; `seconds` runs from the first frame's key time to the end of the last frame.
|
|
131
170
|
|
|
@@ -165,9 +204,12 @@ rig-c's `scalex` multiplies the bone's x axis, and a child with the `normal` inh
|
|
|
165
204
|
- The supporting foot is the one whose reference ankle is lower in the picture. It changes only when the other ankle has been at least **0.02 leg lengths** lower for at least **0.1 s** (timed as `END-ON` runs are); a leg length is each side's median picture length hip → ankle, and the switch compares against their mean.
|
|
166
205
|
- The new support is held where it is on the frame it takes over, and the hip blends from the old derivation to the new over **3 frames**.
|
|
167
206
|
- A **jump** — both reference ankles **and** mid_hip more than **0.05** leg lengths above their **rolling floor**, the 95th-percentile picture y over ±1.0 s around the frame, for at least **2 frames** — releases the plant: the hip follows the pose's travel from where it was, and re-plants on landing (blended the same way). The body has to lift: an ankle's picture y drifts with depth, and under one floor for the whole sequence HQ's dancer standing still (frames 0–29 and 277–312, mid_hip moving 10 and 14 px) read as jumping, 152–155 of 313 frames in all.
|
|
207
|
+
- **In place** ([#92](https://github.com/rig-c/pose/issues/92)). On a sequence with `"travel": "in-place"`, the supporting foot of a figure that does not travel moves back in the picture while the body stays. Holding it where it planted turns that slide into the body's travel, so the hip walks off and never comes back. Under the declaration each plant's anchor follows its own ankle's picture x, scaled into the rig, from the frame it planted, and keeps its y on the one floor. No step releases a foot, since a foot that follows its track has no plant to drag. Every foot may take support, and the lower one does, by the rules above. The loop is then closed: the hip's x on frame i moves by −drift · i / (n − 1), where drift is its x on the last frame less its x on the first. The last frame's hip x is then the first's, and the loop carries no net travel. The y is the floor's and is not touched. `FEET` prints the drift closed, in place of the steps line, and the report's `feet.closure` carries `{ drift, frames }` (`null` otherwise). On the tests' synthetic in-place loop (40 frames, each supporting ankle sliding back 2 px a frame, the hips still), the hip moves less than 10⁻⁹ px. The same joints without the declaration put it 60 px forward over the loop. With a slide of 0.04 leg lengths a frame, both feet are released as stepping and never re-plant without the declaration, and the supports alternate with it. Jumps are read as before.
|
|
168
208
|
- A **step** releases the plant too: while the supporting ankle moves more than **0.03** leg lengths a frame, the other foot takes support if it is planted (not itself released or moving), and otherwise the hip follows the pose's travel. The released ankle may support again once it has moved less than **0.01** leg lengths a frame for **2 frames**. On the dancer the plant held the supporting ankle through a real step (frames 176–181, 579 → 718 px) and threw the hip sideways.
|
|
169
|
-
- `
|
|
170
|
-
-
|
|
209
|
+
- **Read from the lower ankle** ([#113](https://github.com/rig-c/pose/issues/113)). On a sequence not declared `"in-place"`, a foot whose ankle is at least **0.02 leg lengths** higher in the picture than the other's never takes support: not when a plant starts, and not when a step releases the other foot. Before, a step handed support to the only foot free to take it, even a folded, lifted one, and the hip was then placed under a foot in the air. A supporting foot that the other ankle has been that much lower than for **0.1 s** hands support to it when it may take it, as before; when the lower foot may not (it is released and not yet still, or moving), the supporting foot is released, and the hip follows the pose's travel until a foot may take support. Steps and jumps are read as before, and under `"in-place"` #92's reading stands. `FEET support read from the lower ankle` names every run of frames whose support differs from the reading before #113, the side before and after (`none`: no foot supports), and for each `none` why: `released`, the supporting foot let go because the lower ankle could not take support (released by a step, or moving), or the only foot free to take support was the higher one. The report's `feet.lowered` holds them as `{ frames, was, now, cause }` (absent in place). On the tests' synthetic step under a lifted leg (the lifted ankle 0.2 leg lengths up, the grounded one stepping 0.05 leg lengths on frame 10 and still from 11), the lifted leg took support on frames 10–13 before; now frames 10–11 have no supporting foot and the grounded one supports from 12, when it is still again.
|
|
210
|
+
- **One floor** ([#85](https://github.com/rig-c/pose/issues/85)). A 2D rig has no depth, so its floor is one line, and a planted foot is on it. The picture disagrees: a step toward the camera puts the foot lower in the frame, and a camera residual puts a whole span higher, so a plant held where the picture puts each span leaves the floor stepping between spans. Every support span's supporting ankle is therefore moved in y onto one floor, the hip and everything above with it. A span's *planted height* is the world y (on the rig, posed by rig-c) its supporting ankle would be held at; the floor is the median of the spans' planted heights, or **`--floor <y>`** (world units, y up; only with `--plant-feet`, exit 2 without it). Each span's *shift* is floor − its planted height. A change of support still blends the hip over the 3 frames, now between two spans on the floor, and a planted foot does not leave the floor: on each blend frame the **supporting** leg is stretched along its chain about its root, by the factor `--stance` uses, k = (root y − floor y) / (root y − ankle y), held within **[0.92, 1.08]**, its lower bound on the frame the supporting leg's own range as `--stance`'s ([#95](https://github.com/rig-c/pose/issues/95); where that went below 0.92, a `FEET bound from the leg's own range` line, the report's `feet.blend.range`, and each blend run's `lower`). A frame that needs more is held at the bound, the rest left to the blend, and listed `FEET past the bounds` with the k needed and how far the foot was left from the floor. An ankle already within 0.01 units (the landing check's origin tolerance) is not stretched. The stretched scales are scale targets, so the landing check holds them; `--stance` then stretches the free leg, a different chain, to the supporting ankle. A jump follows the pose's travel from the hip it left, which is on the floor, and lands on the floor, held the same way over its first 3 planted frames. `--stance` is unchanged: it stretches the free leg to the supporting ankle, which is on the floor. On the tests' synthetic stick, three spans 0, 6 and 1 px apart in the picture (0, 9 and 1.5 units on the rig) plant within 0.0001 units of one floor. With the shift forced to 0 they stay 9 units apart; without the stretch, the supporting ankle leaves the floor by 6.75 units on the first blend frame.
|
|
211
|
+
- `FEET` lists the supports, the jumps and the steps (each with the side, its frames, who took support and where it re-planted; in place, the loop's closure instead), and with `--plant-feet` the floor: its world y and where it came from, each span's shift in units and in that side's rig leg at setup (thigh origin → ankle), and the shifts' range, then one line per run of blend frames whose supporting leg was stretched (`blend held on the floor`) and per run `past the bounds`. The report carries them under `feet` (`supports`, `jumps`, `steps`, `changes`, `floor`, `shifts`, `blend`, `closure`).
|
|
212
|
+
- **`--stance <leg lengths>`** (only with `--plant-feet`, which it is refused without; off by default) plants **both** feet when the free one is near the floor ([#60](https://github.com/rig-c/pose/issues/60)). On a frame with a supporting side (so outside every jump), the free ankle's height above the supporting one is read in the picture, in the free side's leg length — the leg length `FEET` uses. The tolerance is a **distance** ([#114](https://github.com/rig-c/pose/issues/114)): within it, above the supporting ankle or below it, the frame is **planted both**: every bone of the free leg's chain has its `scalex` key multiplied by k = (root y − floor y) / (root y − ankle y) on the posed rig, the root being the chain's first bone's origin and the floor the supporting ankle, so the foot reaches the floor. A free ankle within the tolerance below the supporting one is planted too: its k is under 1, since a foot slightly under the floor is the same fault as one floating above it. A free ankle **past the tolerance below** the supporting one is not a stance but a support error (the foot read as supporting is the one in the air), so that frame is never planted both and keeps the pose's height; it is named on a `STANCE past the tolerance below` line with the side, the frames and the largest distance, and read `"below"` in the report's `stance.runs`. Before #114 the gap was signed, so any free ankle below the supporting one counted as within, and a lifted foot read as supporting had the grounded leg shrunk up to it. On the tests' synthetic stance, a free ankle 0.5 leg lengths below is read below and not planted; one 0.03 below is planted with k under 1. k is held within **[0.92, 1.08]**, except that the lower bound comes from the leg's own range in the sequence ([#95](https://github.com/rig-c/pose/issues/95)): per side, r = the leg's picture length hip → ankle on the frame ÷ its straight length (the 95th percentile of that length, as `--leg-scale` reads a segment's), and the frame's lower bound is min(0.92, r), so the rig leg may fold as far as the picture folds it on that frame and never less far than 0.92. The upper bound stays 1.08, since a picture leg does not read longer than straight. A sequence whose legs never fold below 0.92 keeps exactly [0.92, 1.08]. Where the range set a bound below 0.92 on a planted-both frame, one `STANCE bound from the leg's own range` line gives each side's lowest, as does the report's `stance.range`. A frame past its bound is listed `past the bounds` with the bound it had, held at the bound and not forced. Past the tolerance above, the foot is **lifted** and keeps the pose's height. The state is read with **hysteresis** and a **shortest run** ([#87](https://github.com/rig-c/pose/issues/87)), on the distance: a planted foot leaves the stance when its distance from the supporting one goes past the tolerance, and one past it is planted again only under **0.8** of it (both figures are on the `STANCE` line). A change of state takes effect only when its condition holds for **0.1 s** (by the frames' times). A shorter crossing with the other state on both sides of it keeps their state and is listed `absorbed` with its frames and the height that crossed (`absorbed: true` in the report's `stance.runs`, beside the run that took it in). One that runs to the end of a support span is taken, since nothing of the other state follows it. A threshold read frame by frame turned noise at the threshold into a pop: one frame at 0.0708 against 0.07 dropped the stretch for one frame and the foot jumped up and back. The stretched scales are the scale targets, so the landing check holds them. Measured with `--stance 0.07` and HQ's flags (`--smooth 7 --flip 90 --short 0.35 --bends clamp --leg-scale 0.8,1.05 --plant-feet --carry-idle`): on HQ's dancer, frames 94–175 outside the jumps, the free ankle's height above the supporting one on the posed build went from median 18.3 and p90 25.4 units to 0.0 and 0.0. On a second sequence (Toca, 492 frames at 30 fps) the 29 frames labelled by eye as both feet flat, outside the jumps, read 0.0 and 0.0. Of the 6 labelled one foot lifted, 5 stay above the tolerance; the sixth (frame 360) was 0.042 leg lengths up in the picture, within the tolerance, and so planted; without `--stance` it stood 6.5 units up, also under the tolerance (22.6 units there). That is 83 %, under the 90 % the card asked.
|
|
171
213
|
- The map needs one chain ending at each ankle whose last bone is aimed `"x"` (the ankle is that bone's tip), and a `translate` the legs hang from (`LEGS_MAP`). A `range`, or a set's `turn` or `offsets`, on a bone between the hip and an ankle is refused (`LEGS_RANGE`): the plant is derived before the range clamp, and a clamp after it would move the planted foot.
|
|
172
214
|
|
|
173
215
|
Both are checked on the gated build: every scale lands, each ankle lands where the keys put it, and the hip's origin where the plant put it. The figures were fixed in #47 before the dancer was measured; the defaults stay off until they pass.
|
|
@@ -206,7 +248,10 @@ The retarget writes one key per pose frame on every mapped bone. That is faithfu
|
|
|
206
248
|
- **Kept regardless:** the first and last frame; the frames either side of a switch boundary, on the chains the switch changes; and the first and last frame of every `FLIP` spread, `SHORT` span and `RANGE` run, on that bone.
|
|
207
249
|
- **The landing check holds the dense targets** with the tolerance added (0.01° + `deg`; 0.01 + `units`), and it is posed by rig-c as always.
|
|
208
250
|
- **On HQ's dancer** (`--smooth 7 --flip 90 --short 0.35 --bends clamp`; 313 frames, 11 mapped bones): `--reduce 1 --reduce-hip 1` takes the rotate keys from 3443 to 588 (5.86×), 296 of the spans curved, and the hip's translate keys from 313 to 96. The gate is green. rig-c's poser lands every bone within 0.9998° of the dense target (head) and the hip within 0.901 units. At 0.5° the keys drop 3.92×; at 2°, 8.38×.
|
|
209
|
-
- **
|
|
251
|
+
- **It runs last, on the final keys** (rig-c/pose#94): after `--plant-feet`'s plant, its one floor, the blend and `--stance` stretches and the in-place closure. Their keys are reduced like any other, and every landing check is run again on the reduced motion.
|
|
252
|
+
- A scaled bone's `scalex` track is thinned within 5e-5 of its setup length: half of the scale landing check's 1e-4, so a reduced curve cannot fail that check.
|
|
253
|
+
- A mapped bone under a scaled bone (keyed through its parent's posed matrix by `--leg-scale`) is solved again through its parent as reduced. Its rotate is then thinned with the error read as the world aim it lands on, and its `scalex` with the error read as the world length it lands on. Its world error is its own fit error, as down any other chain.
|
|
254
|
+
- Each ankle is held to the plant's tolerance plus the most the reduction may move it: the hip's tolerance (with `--reduce-hip`), plus the leg from the hip to the ankle (each bone's setup offset from its parent and the last bone's length) times the largest scale asked, times the angle tolerance in radians plus 5e-5. The ankle's `LAND` line prints that tolerance.
|
|
210
255
|
|
|
211
256
|
Exit codes: `0` written, `1` refused (every reason printed, nothing written), `2` bad invocation. `rig-pose --help` has every flag.
|
|
212
257
|
|
|
@@ -230,12 +275,19 @@ Exit codes: `0` written, `1` refused (every reason printed, nothing written), `2
|
|
|
230
275
|
- Joints are body-18 (`nose neck r_shoulder r_elbow r_wrist l_shoulder l_elbow l_wrist r_hip r_knee r_ankle l_hip l_knee l_ankle r_eye l_eye r_ear l_ear`); `r`/`l` are the **subject's** sides. `state` is `observed`, `occluded` or `missing`, as in the keypoints file, or `inferred` ([#63](https://github.com/rig-c/pose/issues/63)): a position the detector supplied but did not see. An `inferred` joint carries `at` (one without it is refused, `POSE_JOINT_AT`), and `retarget` keys it as it keys `observed`. An unlisted joint is missing.
|
|
231
276
|
- Two differences from the keypoints file: the unit is `picture-px`, and `at` may lie outside the picture (a hand leaves the frame; the score says how much to believe it).
|
|
232
277
|
- More than one person: `--person <id>`.
|
|
278
|
+
- `travel` (optional, [#92](https://github.com/rig-c/pose/issues/92)) is the clip's frame of reference. Its one value is `"in-place"`: a gait filmed without the figure travelling, such as a treadmill or reel walk, or a loop. `clean --loop` writes it, and it may be written by hand on any sequence. Any other value is refused by name (`POSE_TRAVEL`). Without it the figure's travel in the picture is its travel. It changes only `--plant-feet` ([below](#the-legs-foreshortening-and-planted-feet)).
|
|
233
279
|
- `score` is whatever the pose model gives. RTMPose's goes above 1, so `--min-score` is a cut on that model's scale, not a probability.
|
|
234
280
|
|
|
235
281
|
**From COCO-17** — the layout most pose models and datasets use — `rig-pose clean --coco in.json --out pose.json`, which converts and cleans in one step. `rig-pose convert --coco` converts only, and its output still needs `clean`. `retarget --coco` is refused (`POSE_NOT_CLEANED`), naming the `clean --coco` command. The input is `{ "format": "coco17-sequence/1", "width", "height", "source", "frames": [{ "t", "keypoints" }] }`, keypoints in COCO's order as 17 `[x, y, score]` or 51 numbers, or `null` for a frame with nobody. The mapping: COCO's `left_*`/`right_*` → body-18's `l_*`/`r_*` (both are the subject's sides), a score of 0 → `missing`, and body-18's `neck`, which COCO lacks, is the shoulders' midpoint scored the lower of the two (OpenPose's definition).
|
|
236
282
|
|
|
237
283
|
|
|
238
|
-
**The camera** ([#63](https://github.com/rig-c/pose/issues/63)). A sequence may carry an optional `camera`, one `{ "s", "tx", "ty", "inliers" }` per frame: the picture's scale and translation against frame 0's, so a point p₀ of frame 0's picture appears at `s · p₀ + (tx, ty)` on that frame. Its joints are then already normalised by it, `p′ = (p − t) / s`, and `inliers` is how many background features the fit kept. `s` must be > 0, `tx` and `ty` finite, `inliers` an integer ≥ 0, and there is one entry per frame; anything else is refused by name (`POSE_CAMERA`). The retarget does not apply it again: it prints a `CAMERA` line with the range of `s` and the three frames where it changes fastest. With `--plant-feet` and no `camera`, the `CAMERA` line says the floor may step with the picture, since a zoom or a pan in the video moves the floor with it. An optional `cameraSource` string says where the camera came from: `"tracked"
|
|
284
|
+
**The camera** ([#63](https://github.com/rig-c/pose/issues/63)). A sequence may carry an optional `camera`, one `{ "s", "tx", "ty", "inliers" }` per frame: the picture's scale and translation against frame 0's, so a point p₀ of frame 0's picture appears at `s · p₀ + (tx, ty)` on that frame. Its joints are then already normalised by it, `p′ = (p − t) / s`, and `inliers` is how many background features the fit kept. `s` must be > 0, `tx` and `ty` finite, `inliers` an integer ≥ 0, and there is one entry per frame; anything else is refused by name (`POSE_CAMERA`). The retarget does not apply it again: it prints a `CAMERA` line with the range of `s` and the three frames where it changes fastest. With `--plant-feet` and no `camera`, the `CAMERA` line says the floor may step with the picture, since a zoom or a pan in the video moves the floor with it. An optional `cameraSource` string says where the camera came from: `"tracked"`, `"hand-labelled, N keys"` or `"hand windows, floor-snapped: …"`. It is refused without a `camera`, or when it is not a non-empty string (`POSE_CAMERA_SOURCE`), and the `CAMERA` line starts with it (`CAMERA tracked: …`; a sequence with a `camera` and no `cameraSource` prints `CAMERA (source not stated): …`). `tools/scan.py` (not shipped) writes the normalised sequence. It reads the sequence before `clean` does (scan → clean → retarget): a sequence that already carries a `cleaned` record is refused by name (`SCAN_AFTER_CLEAN`), since its cleaning was done with the camera's steps still in it. The camera can come three ways, exactly one per run:
|
|
285
|
+
|
|
286
|
+
- **Tracked** (`--video`), where the background has texture to follow. The camera is read off the video's background, and the sequence is written with `"cameraSource": "tracked"`. A frame whose fit keeps too few background features is refused by name, and nothing is written.
|
|
287
|
+
- **A hand file** (`--camera-file`), where the background cannot be tracked and the camera's values are known or judged by hand. The file is `rig-pose-camera/1`: `{ "spec": "rig-pose-camera/1", "keys": [ { "frame", "s", "tx", "ty" } ], "note"? }`. Its frames are integers of the pose and strictly increase, `s` is > 0, and `tx` and `ty` are finite. Values are linear between keys and held before the first key and after the last. `inliers` is 0 on every frame, since no feature was fitted, and anything malformed is refused by name (`CAMERA_FILE`). The source is `"hand-labelled, N keys"`.
|
|
288
|
+
- **Hand windows, snapped on the floor** (`--camera-windows a-b,c-d,…`, [#82](https://github.com/rig-c/pose/issues/82)), where the background cannot be tracked and the camera zooms in steps with a full-body figure on the floor. The windows are the frames of each zoom, by eye. Each step is measured on the floor, the one background feature every full-body clip has. An ankle is planted on a frame when it is still both ways, moving less than the retarget's stillness threshold (0.01 leg lengths a frame, in one picture leg: the clip median of hip → ankle) from the previous frame and to the next (through `bun tools/supports.ts`, beside the retarget's own jumps from `supportsOf`). Jump frames are not excluded: the detector reads them on the uncorrected picture, so they carry the very camera steps the windows remove, and an airborne ankle cannot hold still over three frames. A frame read inside a detector jump is named in the source (`r 187 inside detector jump 187-193`), not refused. For each window and each ankle, y before and y after are the ankle's median picture y on the 3 planted frames nearest the window on each side, searched within 15 frames and never past a neighbouring window, and its ratio about the picture centre c is `(y_after − c_y) / (y_before − c_y)`. Where both ankles read, the step is the mean of the two, and their disagreement is always written. Where one reads, the window says which ankle alone. A window no ankle reads is refused by name (`CAMERA_WINDOWS`), and so are windows that are not `a ≤ b` inside the pose's frames, that overlap, or that leave no frame between them; nothing is written. s is 1 before the first window, multiplies by each step, is linear across a window and is held between windows, and `t = c (1 − s)`, so no pan is read. The slow drift between windows (a push-in) is held, not fitted: that is open. The source is `"hand windows, floor-snapped: a-b (r+l, l/r x.x %; r 83,84,85|97,100,104; l …), c-d (r alone; r …)"` (`no window` for none): each window names the frames every median stood on, before and after the bar, and the `CAMERA` line prints it. The step moves with those frames: a 3-frame median moved ±2 % with the frames picked on a reference clip, which over three windows decided whether 37 or 107 of its 265 support frames left the floor band ([#82](https://github.com/rig-c/pose/issues/82)). `--plot` draws both ankles' y with the windows shaded and the frames each window was read on marked, where a wrong window shows.
|
|
289
|
+
|
|
290
|
+
`tools/scan_selftest.py` is the synthetic check of all three.
|
|
239
291
|
|
|
240
292
|
**The older name.** `rig-c-pose-frames/0`, written by the extraction jobs this package's demos were made from, is the same file under another spec string. It has `space.units` "painting-px" and an `fps` key; each frame's `t` is the time read. It is read as it is.
|
|
241
293
|
## The map: `rig-pose-map/1`
|
|
@@ -294,7 +346,8 @@ Bone rotation cannot carry every pose: an arm behind the head, a forearm toward
|
|
|
294
346
|
- `chains`: the map's chains whose pose the set depicts; it is selected by them. `pose`: the key skeleton the art was painted from, body-18 (or `mid_hip`/`mid_shoulder`) in picture px, y down, any scale and place — only its directions are read; every joint the listed chains use must be in it.
|
|
295
347
|
- `drawn` (optional): each bone's world angle (Spine degrees) as painted. It changes no key: while a set shows, a bone is keyed to the pose as always, and the art turns with it. What it gives is a figure: the art turn, how far each bone is from the angle its art was painted at (`artTurn`, and `ART-RANGE` past the bone's range).
|
|
296
348
|
- `offsets` (optional): a translate per bone, in its parent's axes, held while the set shows and 0 elsewhere (stepped keys), so the joints as painted are the pivots. A bone `translate` already keys (the hip) cannot take one.
|
|
297
|
-
-
|
|
349
|
+
- `place` (optional): `"by-hip"` places a hand that meets the body by its offset from the hip ([below](#alternate-drawings-alternates)).
|
|
350
|
+
- Each name resolves against the built rig and the map, and a miss is refused by name, listing what exists: `MAP_ALT_SLOT`, `MAP_ALT_ATTACHMENT`, `MAP_ALT_HIDES`, `MAP_ALT_CHAIN`, `MAP_ALT_JOINT`, `MAP_ALT_POSE`, `MAP_ALT_DRAWN`, `MAP_ALT_OFFSET` (a bone that is not a bone of the set's chains) and `MAP_ALT_PLACE`.
|
|
298
351
|
|
|
299
352
|
**When one shows.** Per frame and per set, the distance is the largest difference, in degrees, between a segment of its chains as the retarget asked for it (after holds, the short hold, the flip guard and the hinge check; before any range clamp) and the same segment in its key skeleton. On each frame the nearest set within `--switch-tolerance` (default 25°) shows, ties going to the map's order; a run of one set shorter than `--switch-min` (default 0.25 s) is dropped and the base art shows there. Both figures were fixed before a run ([#6](https://github.com/rig-c/pose/issues/6)). Sets compete only with those they share a slot (shown or hidden) or an offset bone with, so a drawing of each arm can show at once; two that compete never overlap.
|
|
300
353
|
|
|
@@ -322,6 +375,16 @@ Either way the `SWITCH` line ends with `moved on …, off …`: each boundary's
|
|
|
322
375
|
- **The solve.** Two bones on the rig's own lengths put the wrist on that point, the elbow bending to the side the pose's does. The set's `turn` is part of the solve. When it holds the upper arm, the forearm is re-aimed from the held elbow at the placed wrist rather than held on its own. `ART-RANGE` lists where the re-aimed forearm still cannot reach within `turn`, in two cases. One is a forearm past its own `turn`, held there. The other is a held upper arm whose re-aimed forearm leaves the wrist more than 0.01 eye distances short of its placed point; 0.01 is the float and rounding scale. That case is listed on the upper arm, with the shortfall in eye distances. The solved angles become the targets, which the keys and the landing check follow.
|
|
323
376
|
- Frames outside those spans, and sets that draw no arm raised, are keyed as without the flag, byte for byte. A raised chain must have two bones, each aimed `"x"` or at one point, and the eye points must not turn with it (`RAISED_CHAIN`).
|
|
324
377
|
|
|
378
|
+
**A hand that meets the body: `"place": "by-hip"`.** The same mismatch, pointed at the hip. On a clasped-hands set the pose's angles aim the forearms the right way, and the rig's arm lengths put the clasp lower or higher on the body than the video has it ([#93](https://github.com/rig-c/pose/issues/93)). A set may ask for its hands to be placed against the hip instead, `"place": "by-hip"` (off by default; no flag). It is the solve above, with the head's measures swapped for the hip's:
|
|
379
|
+
|
|
380
|
+
- **The key skeleton carries both hips.** A set with `"by-hip"` must have `r_hip` and `l_hip` in its `pose`: the map's author supplies them, where the hips were when the drawing was painted. A set without them is refused by name (`MAP_ALT_PLACE`, naming the missing hip); nothing is guessed from the chains' joints.
|
|
381
|
+
- **Which chains.** A chain of the set is placed when it ends at a wrist (`r_wrist`, `l_wrist`) that the set's `pose` puts within one hip width of the mid-hip: |wrist − (r_hip + l_hip) / 2| ≤ |r_hip − l_hip|, read on the key skeleton. A set asking for `"by-hip"` with no such chain is refused, naming each wrist's distance in hip widths, and so is a `place` other than `"by-hip"`, a `pose` whose hips meet, and a `pose` without a chain's wrist (`MAP_ALT_PLACE`; the missing wrist is also `MAP_ALT_JOINT`, as for any set).
|
|
382
|
+
- **The unit is the hip width**: on each side, its median over the span. The reference's is |r_hip − l_hip|. The rig's is the distance between its two hip points, posed from the targets of the bones above as the eyes are: the two points a chain carrying the hip line (`r_hip` → `l_hip`, either way round) names with an `"a>b"` aim, a pelvis; else the origins of the first bones of the two chains starting at `r_hip` and at `l_hip`, the legs. A map with neither is refused (`PLACE_HIP`), and so is a span over which either median is 0 (`PLACE_HIPS`).
|
|
383
|
+
- The target is the rig's mid-hip + (reference wrist − reference mid-hip) × (rig hip width ÷ reference hip width), the picture's y turned up, per frame. The order of solving, the reach, the two-bone solve inside the set's `turn` and `ART-RANGE` are those of `--raised-by-head`, with every eye distance a hip width (a held arm's shortfall too, its `artRange` entry marked `anchor: "hip"`), and the mid-hip where the head centre is.
|
|
384
|
+
- **Out of reach below the shoulder.** The reach limit is taken on the ray from the mid-hip through the target. A hand at the hips sits on the far side of the mid-hip from the shoulder on most rigs, so that ray usually runs away from the arm and never enters its reach. The wrist then goes to the reach's point nearest the target, on the line from the shoulder (`missed` in `REACH`).
|
|
385
|
+
- A chain both `--raised-by-head` and `"by-hip"` would place is refused (`PLACE_BOTH`). A placed chain must have two bones, each aimed `"x"` or at one point, and the hip points must not turn with it (`PLACE_CHAIN`).
|
|
386
|
+
- Frames outside the set's spans, the chains it does not place, and every map without `"place"` are keyed as before, byte for byte. The report's `byHip` carries each span.
|
|
387
|
+
|
|
325
388
|
## Compare: the rig's render against the video
|
|
326
389
|
|
|
327
390
|
```sh
|
package/cli.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
10
10
|
import pkg from './package.json' with { type: 'json' };
|
|
11
|
-
import { clean, cleanLine, untestedText, LEGS, OCCLUSION_SCORE, OCCLUSION_WINDOW, SPIKE_TRUNKS, SPIKE_WINDOW, windowProblem } from './src/clean.ts';
|
|
11
|
+
import { clean, cleanLine, holdRegions, unheldText, untestedText, HOLD_BLEND, HOLD_MIN_SECONDS, HOLD_REACH, HOLD_SPEED, HOLD_SPEED_WINDOW, LEGS, OCCLUSION_SCORE, OCCLUSION_WINDOW, SPIKE_TRUNKS, SPIKE_WINDOW, windowProblem } from './src/clean.ts';
|
|
12
12
|
import { convertCoco17, readPoseSequence, writePoseSequence } from './src/pose.ts';
|
|
13
13
|
import { parseWindows } from './src/compare.ts';
|
|
14
14
|
import { lineOf, Refusal } from './src/problems.ts';
|
|
@@ -18,7 +18,7 @@ import { runRetarget, type RetargetArgs } from './src/run.ts';
|
|
|
18
18
|
const HELP = `rig-pose ${pkg.version} — motion from a pose sequence onto a rig-c rig
|
|
19
19
|
|
|
20
20
|
Usage:
|
|
21
|
-
rig-pose clean --pose <pose.json> --out <pose.clean.json> [--loop] [--legs 5] [--rest 7] [--coco] [--person <id>]
|
|
21
|
+
rig-pose clean --pose <pose.json> --out <pose.clean.json> [--loop] [--legs 5] [--rest 7] [--hold off] [--coco] [--person <id>]
|
|
22
22
|
rig-pose retarget --rig <rig> --map <map.json> --pose <pose.json> --out <motion.json> [--name dance] [flags]
|
|
23
23
|
rig-pose convert --coco <coco17.json> --out <pose.json>
|
|
24
24
|
rig-pose compare --reference <pose.json> --render <pose.json> --map <map.json> [flags]
|
|
@@ -30,7 +30,8 @@ clean (required before retarget; rig-c/pose#67)
|
|
|
30
30
|
--coco read --pose as coco17-sequence/1 and convert it first (neck = the shoulders' midpoint)
|
|
31
31
|
--person <id> the person to clean when the sequence holds more than one; only that person is written
|
|
32
32
|
--loop the sequence is one cycle (a gait's strike to strike): every window wraps, last frame
|
|
33
|
-
to first, and the floor is re-pinned
|
|
33
|
+
to first, and the floor is re-pinned; the sequence is written with "travel": "in-place"
|
|
34
|
+
(rig-c/pose#92)
|
|
34
35
|
--legs <n> Savitzky–Golay window over the legs — both hips, knees and ankles (default: 5)
|
|
35
36
|
--rest <n> Savitzky–Golay window over every other joint (default: 7)
|
|
36
37
|
n is 1 (none), or odd and ≥ 5: a quadratic through 3 points passes through all three
|
|
@@ -38,6 +39,9 @@ clean (required before retarget; rig-c/pose#67)
|
|
|
38
39
|
position the detector supplied but did not see — on every frame where they have one, and
|
|
39
40
|
the record says so (hipsInferred: { by: "declared" }). Positions are unchanged, so retarget's
|
|
40
41
|
keys are too; its POSTURE line does not read the hip tilt ("hip tilt not read: hips inferred")
|
|
42
|
+
--hold off turn the stillness hold off (rig-c/pose#91); recorded as hold: "off"
|
|
43
|
+
--hold-speed <n> the hold's speed limit, trunk lengths per frame (default: 0.015)
|
|
44
|
+
--hold-reach <n> how far a held joint may lie from its span median, trunk lengths (default: 0.03)
|
|
41
45
|
|
|
42
46
|
In order, each step printed with its figures: (1) spikes — a joint more than 0.2 trunk lengths
|
|
43
47
|
(neck → mid_hip, the median over the clip) from its 5-frame median takes the median, each listed by
|
|
@@ -48,6 +52,12 @@ clean (required before retarget; rig-c/pose#67)
|
|
|
48
52
|
A median is per coordinate over the window's frames where the joint has a position. A joint with no
|
|
49
53
|
position on a frame is left without one (retarget holds it). States and scores are written as read.
|
|
50
54
|
Jitter: the mean |second difference| of y over every joint, px/f², before and after.
|
|
55
|
+
(5) the stillness hold (rig-c/pose#91), per joint, on the cleaned positions: a span of ≥ 0.5 s where the
|
|
56
|
+
joint's 5-frame median speed (its movement from the frame before, in trunk lengths) is under --hold-speed and
|
|
57
|
+
it stays within --hold-reach of its own span median is written as that median, blended in linearly over the
|
|
58
|
+
6 frames before and out over the 6 after (two holds of a joint back to back, or under 6 frames apart, cross-fade
|
|
59
|
+
over the 6 frames plus the gap, centred on it, SEAM); each hold is printed (HOLD) and recorded with its jitter before and
|
|
60
|
+
after, and the joints not held where others are are named with the test each fails (UNHELD).
|
|
51
61
|
|
|
52
62
|
retarget
|
|
53
63
|
--rig <path> the rig spec rigc builds from: a rig.json, or a directory holding one
|
|
@@ -91,13 +101,22 @@ retarget
|
|
|
91
101
|
rolling floor — the 95th-percentile y over ±1 s — for ≥ 2 frames) follows the pose's
|
|
92
102
|
travel and re-plants on landing; a supporting ankle moving > 0.03 leg lengths a frame
|
|
93
103
|
releases its plant to the other foot, or to the pose's travel, until it is still
|
|
94
|
-
(< 0.01 for 2 frames) (FEET lines)
|
|
104
|
+
(< 0.01 for 2 frames) (FEET lines). Every support span is planted on one floor: its
|
|
105
|
+
supporting ankle moved in y onto the median of the spans' planted heights (world y on
|
|
106
|
+
the rig, posed by rig-c), the hip and everything above with it; FEET lists each span's
|
|
107
|
+
shift. On the 3 blend frames the supporting leg's scalex is stretched (k within
|
|
108
|
+
[0.92, 1.08], past it listed) so its ankle stays on the floor (rig-c/pose#85).
|
|
109
|
+
On a sequence with "travel": "in-place" (rig-c/pose#92) each supporting foot follows its
|
|
110
|
+
own ankle's picture x, scaled, instead of being held, no step releases it, and the hip's x
|
|
111
|
+
drift from the first frame to the last is spread back over the frames, closing the loop
|
|
112
|
+
--floor <y> with --plant-feet: the floor's world y (rig units, y up) instead of the median
|
|
95
113
|
--stance <leg lengths> with --plant-feet: on a frame outside the jumps, a free ankle within this many
|
|
96
|
-
leg lengths (FEET's) of the supporting one in the picture
|
|
97
|
-
scalex keys stretched by k = (root y − floor y) / (root y − ankle y) until
|
|
98
|
-
reaches the floor, raised or lowered, k within [0.92,
|
|
99
|
-
|
|
100
|
-
the
|
|
114
|
+
leg lengths (FEET's) of the supporting one in the picture, above or below, is planted
|
|
115
|
+
too — its leg's scalex keys stretched by k = (root y − floor y) / (root y − ankle y) until
|
|
116
|
+
the foot reaches the floor, raised or lowered, k within [min(0.92, the leg's own fold on
|
|
117
|
+
the frame), 1.08] (#95; past it, reported, not forced); above the tolerance the foot is
|
|
118
|
+
lifted and keeps the pose's height; below it, it is reported (past the tolerance below,
|
|
119
|
+
#114) and not planted (STANCE lines; default: off; 0.07 is the card's, rig-c/pose#60)
|
|
101
120
|
--raised-by-head while a set whose arm is drawn raised shows (its "drawn" upper arm within 30° of straight
|
|
102
121
|
up), that arm's wrist goes where the reference's is against the head, in eye distances:
|
|
103
122
|
rig head centre + (reference wrist − reference head centre) × rig eye distance ÷ the
|
|
@@ -127,7 +146,10 @@ retarget
|
|
|
127
146
|
each bone against its parent's reduced error, so errors do not pile up down a chain.
|
|
128
147
|
Kept regardless: the first and last frame, the frames either side of a switch boundary
|
|
129
148
|
on the chains it changes, and the edges of every FLIP spread, SHORT span and RANGE run
|
|
130
|
-
(REDUCE lines; default: off).
|
|
149
|
+
(REDUCE lines; default: off). It runs last, on the final keys: with --leg-scale,
|
|
150
|
+
--plant-feet and --stance, a scaled bone's scalex is thinned within 5e-5 of its setup
|
|
151
|
+
length, a bone under one is re-solved through its parent as reduced, and each ankle
|
|
152
|
+
is held to what the reduced bones above it may move it by (rig-c/pose#94)
|
|
131
153
|
--reduce-hip <units> with --reduce, thin the hip's translate keys too, its world origin within units
|
|
132
154
|
of the dense keys (default: the hip stays dense)
|
|
133
155
|
--switch-tolerance <d> a set of alternate drawings (the map's "alternates") may show on a frame where
|
|
@@ -141,7 +163,7 @@ retarget
|
|
|
141
163
|
--build <dir> keep the gated build (skeleton.json, .atlas, .model.json) here
|
|
142
164
|
--render <dir> keep rigc's render of the animation (frames, contact.png, folds.json) here
|
|
143
165
|
--report <file> write the run's measurements (holds, short, endOn, flips, bends, landings, folds,
|
|
144
|
-
switches, uncovered, turns, range, artRange, raised,
|
|
166
|
+
switches, uncovered, turns, range, artRange, raised, byHip,
|
|
145
167
|
idleDropped, idleKeptOut, merged, reduce) as JSON
|
|
146
168
|
|
|
147
169
|
It writes nothing until rigc's gate is green with the animation in, every mapped bone lands on
|
|
@@ -240,7 +262,7 @@ function legScaleOf(f: Map<string, string>): [number, number] | 'off' {
|
|
|
240
262
|
}
|
|
241
263
|
|
|
242
264
|
function retargetArgs(argv: string[]): RetargetArgs {
|
|
243
|
-
const f = parseFlags(argv, ['rig', 'map', 'pose', 'out', 'name', 'person', 'base-motion', 'images', 'min-score', 'smooth', 'flip', 'short', 'bends', 'bend-tolerance', 'switch-tolerance', 'switch-min', 'switch-at', 'profile', 'build', 'render', 'report', 'leg-scale', 'idle', 'merge', 'reduce', 'reduce-hip', 'stance'], ['coco', 'plant-feet', 'carry-idle', 'raised-by-head']);
|
|
265
|
+
const f = parseFlags(argv, ['rig', 'map', 'pose', 'out', 'name', 'person', 'base-motion', 'images', 'min-score', 'smooth', 'flip', 'short', 'bends', 'bend-tolerance', 'switch-tolerance', 'switch-min', 'switch-at', 'profile', 'build', 'render', 'report', 'leg-scale', 'idle', 'merge', 'reduce', 'reduce-hip', 'stance', 'floor'], ['coco', 'plant-feet', 'carry-idle', 'raised-by-head']);
|
|
244
266
|
const bends = f.get('bends') ?? 'refuse';
|
|
245
267
|
if (bends !== 'refuse' && bends !== 'clamp') throw new Usage(`--bends is "${bends}"; it must be refuse or clamp`);
|
|
246
268
|
const switchAt = f.get('switch-at') ?? 'first';
|
|
@@ -266,6 +288,7 @@ function retargetArgs(argv: string[]): RetargetArgs {
|
|
|
266
288
|
legScale: legScaleOf(f),
|
|
267
289
|
plantFeet: f.has('plant-feet'),
|
|
268
290
|
stance: stanceOf(f),
|
|
291
|
+
...floorOf(f),
|
|
269
292
|
raisedByHead: f.has('raised-by-head'),
|
|
270
293
|
bends,
|
|
271
294
|
bendTolerance: num(f, 'bend-tolerance', 0, (n) => n >= 0 && n < 180, 'degrees in [0, 180)'),
|
|
@@ -291,6 +314,14 @@ function stanceOf(f: Map<string, string>): number | 'off' {
|
|
|
291
314
|
return v;
|
|
292
315
|
}
|
|
293
316
|
|
|
317
|
+
/** --floor (rig-c/pose#85): the floor's world y, only with --plant-feet; absent, the median of the spans' planted heights. */
|
|
318
|
+
function floorOf(f: Map<string, string>): { floor?: number } {
|
|
319
|
+
if (!f.has('floor')) return {};
|
|
320
|
+
const v = num(f, 'floor', 0, () => true, 'a world y in rig units (a finite number)');
|
|
321
|
+
if (!f.has('plant-feet')) throw new Usage(`--floor is "${f.get('floor')}" without --plant-feet; it is the floor --plant-feet plants every support span on`);
|
|
322
|
+
return { floor: v };
|
|
323
|
+
}
|
|
324
|
+
|
|
294
325
|
/** --reduce and --reduce-hip (rig-c/pose#32): off unless given; the hip only with the bones. */
|
|
295
326
|
function reduceOf(f: Map<string, string>): { reduce?: number; reduceHip?: number } {
|
|
296
327
|
if (!f.has('reduce')) {
|
|
@@ -298,9 +329,6 @@ function reduceOf(f: Map<string, string>): { reduce?: number; reduceHip?: number
|
|
|
298
329
|
return {};
|
|
299
330
|
}
|
|
300
331
|
const reduce = num(f, 'reduce', 0, (n) => n > 0 && n < 180, 'degrees in (0, 180)');
|
|
301
|
-
for (const other of ['leg-scale', 'plant-feet'] as const) {
|
|
302
|
-
if (f.has(other) && f.get(other) !== 'off') throw new Usage(`--reduce is given with --${other}; their keys land a bone through a scaled parent or an ankle's lever, which the reduction's tolerance does not bound (rig-c/pose#32 round 1)`);
|
|
303
|
-
}
|
|
304
332
|
return f.has('reduce-hip') ? { reduce, reduceHip: num(f, 'reduce-hip', 0, (n) => n > 0, 'rig units > 0') } : { reduce };
|
|
305
333
|
}
|
|
306
334
|
|
|
@@ -334,6 +362,21 @@ function compareArgs(argv: string[]): CompareArgs {
|
|
|
334
362
|
};
|
|
335
363
|
}
|
|
336
364
|
|
|
365
|
+
/** The stillness hold's flags (#91): `--hold off`, or the thresholds (defaults 0.015 and 0.03). */
|
|
366
|
+
function holdOf(f: Map<string, string>): { speed: number; reach: number } | 'off' {
|
|
367
|
+
const v = f.get('hold');
|
|
368
|
+
if (v !== undefined && v !== 'off') throw new Usage(`--hold is "${v}"; the hold runs by default, and the only value is "off"`);
|
|
369
|
+
if (v === 'off') {
|
|
370
|
+
const given = ['hold-speed', 'hold-reach'].filter((k) => f.has(k));
|
|
371
|
+
if (given.length > 0) throw new Usage(`${given.map((k) => `--${k}`).join(' and ')} with --hold off: the hold does not run, so ${given.length === 1 ? 'it changes' : 'they change'} nothing — drop ${given.length === 1 ? 'it' : 'them'} or the --hold off`);
|
|
372
|
+
return 'off';
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
speed: num(f, 'hold-speed', HOLD_SPEED, (n) => n > 0, 'a number > 0 (trunk lengths per frame)'),
|
|
376
|
+
reach: num(f, 'hold-reach', HOLD_REACH, (n) => n > 0, 'a number > 0 (trunk lengths)'),
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
337
380
|
/** A window flag of clean: 1, or odd and ≥ 5 (`windowProblem`). */
|
|
338
381
|
function windowOf(f: Map<string, string>, name: string, dflt: number): number {
|
|
339
382
|
const v = f.get(name);
|
|
@@ -363,10 +406,10 @@ function runsOf(frames: number[]): string {
|
|
|
363
406
|
|
|
364
407
|
/** `rig-pose clean` (#67): read, clean, print each step's figures, write. */
|
|
365
408
|
function runClean(argv: string[], say: (l: string) => void): void {
|
|
366
|
-
const f = parseFlags(argv, ['pose', 'out', 'legs', 'rest', 'person'], ['loop', 'coco', 'hips-inferred']);
|
|
409
|
+
const f = parseFlags(argv, ['pose', 'out', 'legs', 'rest', 'person', 'hold', 'hold-speed', 'hold-reach'], ['loop', 'coco', 'hips-inferred']);
|
|
367
410
|
const input = need(f, 'pose');
|
|
368
411
|
const out = need(f, 'out');
|
|
369
|
-
const params = { loop: f.has('loop'), legs: windowOf(f, 'legs', 5), rest: windowOf(f, 'rest', 7), hipsInferred: f.has('hips-inferred') };
|
|
412
|
+
const params = { loop: f.has('loop'), legs: windowOf(f, 'legs', 5), rest: windowOf(f, 'rest', 7), hipsInferred: f.has('hips-inferred'), hold: holdOf(f) };
|
|
370
413
|
const text = readFileSync(input, 'utf8');
|
|
371
414
|
const seq = f.has('coco') ? convertCoco17(text, input) : readPoseSequence(text, input);
|
|
372
415
|
const c = clean(seq, params, f.get('person'), input);
|
|
@@ -386,9 +429,22 @@ function runClean(argv: string[], say: (l: string) => void): void {
|
|
|
386
429
|
if (params.loop) {
|
|
387
430
|
if (c.floor === null) say(' FLOOR no ankle has a position on any frame; not re-pinned');
|
|
388
431
|
else say(` FLOOR the lowest ankle over the cycle: y ${fmt(c.floor.before)} before smoothing, ${fmt(c.floor.after)} after; every joint moved ${c.floor.shift >= 0 ? '+' : ''}${fmt(c.floor.shift, 3)} px in y`);
|
|
432
|
+
say(' TRAVEL "in-place" written (rig-c/pose#92): a loop is one cycle repeated, so the figure does not travel; retarget --plant-feet holds the hip\'s x over the loop and lets the supporting foot follow its own track');
|
|
389
433
|
}
|
|
390
434
|
const jit = (v: number | null) => (v === null ? 'not measured' : `${fmt(v, 3)}`);
|
|
391
435
|
say(` JITTER mean |second difference| of y over ${c.triples} joint-frame triple(s): ${jit(c.record.jitter.before)} → ${jit(c.record.jitter.after)} px/f²${c.record.jitter.before !== null && c.record.jitter.after !== null && c.record.jitter.before > 0 ? ` (${fmt(100 * (1 - c.record.jitter.after / c.record.jitter.before), 1)}% lower)` : ''}`);
|
|
436
|
+
if (params.hold === 'off') say(' HOLD off (--hold off): no stillness hold');
|
|
437
|
+
else {
|
|
438
|
+
const h = params.hold;
|
|
439
|
+
const span = (r: [number, number] | null, what: string) => (r === null ? `nothing ${what}` : `${what} ${r[0] === r[1] ? `frame ${r[0]}` : `frames ${r[0]}–${r[1]}`}`);
|
|
440
|
+
for (const x of c.holds) say(` HOLD joint "${x.joint}" frames ${x.frames[0]}–${x.frames[1]} (${tOf(x.frames[0])}–${tOf(x.frames[1])}, ${fmt(x.seconds, 3)} s): ${HOLD_SPEED_WINDOW}-frame median speed under ${h.speed} trunk/frame (largest ${fmt(x.speed, 4)}), within ${h.reach} trunk of its span median (largest ${fmt(x.reach, 4)}); written as that median, blended in over ${span(x.blendIn, 'before').replace('nothing before', 'nothing before it')}, out over ${span(x.blendOut, 'after').replace('nothing after', 'nothing after it')}; jitter inside ${jit(x.jitter.before)} → ${jit(x.jitter.after)} px/f²${x.jitter.after !== null && x.jitter.after > 0 ? ' (ramp)' : ''}`);
|
|
441
|
+
for (const x of c.seams) say(` SEAM joint "${x.joint}" frame ${x.frame} (${tOf(x.frame)}): two holds ${x.gap === 0 ? 'back to back' : `${x.gap} frame(s) apart`}, their medians ${fmt(x.step, 4)} trunk (${fmt(x.step * c.trunk.length)} px) apart; cross-faded over frames ${x.frame - x.gap - HOLD_BLEND / 2}–${x.frame + HOLD_BLEND / 2 - 1}, no frame moving more than 1/${HOLD_BLEND + x.gap} of it`);
|
|
442
|
+
for (const [a, b] of holdRegions(c.holds)) {
|
|
443
|
+
const not = c.unheld.filter((u) => u.frames[0] >= a && u.frames[1] <= b);
|
|
444
|
+
if (not.length > 0) say(` UNHELD frames ${a}–${b}, where other joints are held: ${not.map(unheldText({ ...h, minSeconds: HOLD_MIN_SECONDS })).join(', ')}`);
|
|
445
|
+
}
|
|
446
|
+
say(` HOLDS ${c.holds.length} found over ${new Set(c.holds.map((x) => x.joint)).size} joint(s) (per joint: a span ≥ ${HOLD_MIN_SECONDS} s still by speed < ${h.speed} trunk/frame and reach ≤ ${h.reach} trunk; ${HOLD_BLEND}-frame blend in and out)`);
|
|
447
|
+
}
|
|
392
448
|
if (c.inferred !== null) say(` INFERRED r_hip on ${c.inferred.r_hip} frame(s), l_hip on ${c.inferred.l_hip} frame(s) of ${n} marked "inferred" (every frame where it has a position): declared at clean (--hips-inferred); positions and scores unchanged`);
|
|
393
449
|
writeFileSync(out, writePoseSequence(c.seq));
|
|
394
450
|
say(` CLEAN ${cleanLine(c.record)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/pose",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Puts motion from a body-18 pose sequence onto a rig built with rig-c: bone keys in rig-c's motion format, checked through rig-c's gate before anything is written. A CLI for agents that cannot see the rig.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|