save code

This commit is contained in:
xsl
2025-08-17 23:35:31 +08:00
parent 88ea7bd6ba
commit e1a03d8e20
2 changed files with 82 additions and 17 deletions
+25 -4
View File
@@ -327,27 +327,48 @@ class RenderPeopleKpsMask:
"cloth_short": ("BOOLEAN", {
"default": True
}),
"width": ("INT", {
"default": 0
}),
"height": ("INT", {
"default": 0
}),
"left_right_line_width": ("FLOAT", {
"default": 0.4
}),
"human_head2_yao_times": ("FLOAT", {
"default": 2.5
}),
}
}
RETURN_TYPES = ("MASK","INT",)
RETURN_TYPES = ("MASK","INT","FLOAT","INT","INT", "INT","INT","INT","INT")
RETURN_NAMES = ("MASK","offset","Head2YaoTimes","Left","Right", "w", "h", "x", "y")
FUNCTION = "render"
CATEGORY = "ControlNet Preprocessors/Pose Keypoint Postprocess"
def render(self, kps, cloth_len, line_len, cloth_short) -> tuple[torch.Tensor]:
def render(self, kps, cloth_len, line_len, cloth_short, width, height, left_right_line_width, human_head2_yao_times) -> tuple[torch.Tensor]:
if isinstance(kps, list):
kps = kps[0]
poses, _, height, width = decode_json_as_poses(kps)
mask, neck_y = draw_poses_mask(
mask, neck_y, Head2YaoTimes, Left, Right, head_y, head2yao_base = draw_poses_mask(
poses,
height,
width,
cloth_len,
line_len,
cloth_short,
width,
height,
left_right_line_width
)
return (mask, int(neck_y), )
w = Right - Left
x = Left
h = head2yao_base * human_head2_yao_times
y = head_y
print(f"RenderPeopleKpsMask w:{w} h{h} x{x} y{y}")
return (mask, int(neck_y), float(Head2YaoTimes), int(Left), int(Right), int(w), int(h), int(x), int(y))
class RenderPeopleKps:
@classmethod