liblaf.melon.io.wrap
¶
JSON sidecar helpers for Faceform Wrap projects.
Functions:
-
load_landmarks–Load Wrap landmark points from JSON.
-
load_polygons–Load selected polygon indices from JSON.
-
save_landmarks–Save landmark points in Wrap-compatible JSON format.
-
save_polygons–Save selected polygon indices for Wrap projects.
load_landmarks
¶
Load Wrap landmark points from JSON.
Non-JSON mesh paths are mapped to a sibling .landmarks.json file. Missing
files return an empty (0, 3) array so annotation workflows can start from
an unmarked mesh.
Parameters:
-
path(StrPath) –Landmark JSON file or mesh path whose landmark sidecar should be inferred.
Returns:
-
Float[ndarray, 'L 3']–Landmark coordinates in
x,y,zorder.
Source code in src/liblaf/melon/io/wrap/_landmarks.py
load_polygons
¶
Load selected polygon indices from JSON.
Parameters:
-
path(StrPath) –JSON file containing polygon indices.
Returns:
-
Integer[ndarray, ' N']–One-dimensional
int32array of selected polygon indices. Missing files -
Integer[ndarray, ' N']–return an empty array.
Source code in src/liblaf/melon/io/wrap/_polygons.py
save_landmarks
¶
Save landmark points in Wrap-compatible JSON format.
Parameters:
-
landmarks(Float[ArrayLike, 'L 3']) –Array-like landmark coordinates with shape
(n, 3). -
path(StrPath) –Landmark JSON file or mesh path whose landmark sidecar should be inferred.
Source code in src/liblaf/melon/io/wrap/_landmarks.py
save_polygons
¶
save_polygons(
polygons: Bool[ArrayLike, " full"]
| Integer[ArrayLike, " selection"],
path: StrPath,
) -> None
Save selected polygon indices for Wrap projects.
Boolean masks are converted to their selected indices before serialization.
Parameters:
-
polygons(Bool[ArrayLike, ' full'] | Integer[ArrayLike, ' selection']) –Boolean mask over all polygons or explicit polygon indices.
-
path(StrPath) –JSON file to write.