6 Commits
Author SHA1 Message Date
Craig Hughes d434cecedf Merge pull request #6 from andypotato/feat/min-confidence
Feature: Add minimum confidence for keypoints
2025-07-30 08:44:50 -07:00
Andreas Schallwig 370f4161e3 Feature: Add minimum confidence for keypoints 2025-07-19 10:16:59 +08:00
Craig Hughes 61ac9d9e6a Merge pull request #4 from ComfyNodePRs/update-publish-yaml
Update Github Action for Publishing to Comfy Registry
2025-04-08 11:48:00 -07:00
snomiao 5a24a1d01c chore(publish): update workflow for node publishing with permissions and version check 2025-01-20 22:59:05 +00:00
Craig Hughes 4cacb7a6c9 Merge pull request #3 from ComfyNodePRs/licence-update
Update PyProject Toml - License
2024-09-26 14:14:35 -07:00
snomiao ef1cf41135 chore(licence-update): Update PyProject Toml - License 2024-07-31 13:44:34 +00:00
3 changed files with 29 additions and 12 deletions
+5 -1
View File
@@ -8,15 +8,19 @@ on:
paths: paths:
- "pyproject.toml" - "pyproject.toml"
permissions:
issues: write
jobs: jobs:
publish-node: publish-node:
name: Publish Custom Node to registry name: Publish Custom Node to registry
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'hughescr' }}
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Publish Custom Node - name: Publish Custom Node
uses: Comfy-Org/publish-node-action@main uses: Comfy-Org/publish-node-action@v1
with: with:
## Add your own personal access token to your Github Repository secrets and reference it here. ## Add your own personal access token to your Github Repository secrets and reference it here.
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }} personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
+23 -10
View File
@@ -1,4 +1,3 @@
import json
from nodes import MAX_RESOLUTION from nodes import MAX_RESOLUTION
class OpenPoseKeyPointExtractor: class OpenPoseKeyPointExtractor:
@@ -10,6 +9,7 @@ class OpenPoseKeyPointExtractor:
"image_width": ("INT", { "min": 0, "max": MAX_RESOLUTION }), "image_width": ("INT", { "min": 0, "max": MAX_RESOLUTION }),
"image_height": ("INT", { "min": 0, "max": MAX_RESOLUTION }), "image_height": ("INT", { "min": 0, "max": MAX_RESOLUTION }),
"points_list": ("STRING", {"multiline": True, "default": ""}), "points_list": ("STRING", {"multiline": True, "default": ""}),
"min_confidence": ("FLOAT", {"default": 0.5, "min": 0.0, "max": 1.0, "step": 0.01}),
}, },
"optional": { "optional": {
"person_number": ("INT", { "default": 0 }), "person_number": ("INT", { "default": 0 }),
@@ -25,25 +25,38 @@ class OpenPoseKeyPointExtractor:
idx_x = item*3 idx_x = item*3
idx_y = idx_x + 1 idx_y = idx_x + 1
idx_conf = idx_y + 1 idx_conf = idx_y + 1
# prevent out of bounds errors
if idx_conf >= len(list):
return (0.0, 0.0, 0.0)
return (list[idx_x], list[idx_y], list[idx_conf]) return (list[idx_x], list[idx_y], list[idx_conf])
def box_keypoints(self, pose_keypoint, image_width, image_height, points_list, person_number=0): def box_keypoints(self, pose_keypoint, image_width, image_height, points_list,
person_number=0, min_confidence=0.5):
points_we_want = [int(element) for element in points_list.split(",")] points_we_want = [int(element) for element in points_list.split(",")]
min_x = MAX_RESOLUTION min_x = MAX_RESOLUTION
min_y = MAX_RESOLUTION min_y = MAX_RESOLUTION
max_x = 0 max_x = 0
max_y = 0 max_y = 0
for element in points_we_want: for element in points_we_want:
(x,y,z) = self.get_keypoint_from_list(pose_keypoint[0]["people"][person_number]["pose_keypoints_2d"], element) (x,y,z) = self.get_keypoint_from_list(pose_keypoint[0]["people"][person_number]["pose_keypoints_2d"], element)
if x < min_x:
min_x = x # only include points that meet the minimum confidence
if y < min_y: if z >= min_confidence:
min_y = y if x < min_x:
if x > max_x: min_x = x
max_x = x if y < min_y:
if y > max_y: min_y = y
max_y = y if x > max_x:
max_x = x
if y > max_y:
max_y = y
# in case no valid keypoints were found return the full image
if min_x == MAX_RESOLUTION:
return (0, 0, image_width, image_height)
return (int(min_x*image_width), int(min_y*image_height), int((max_x-min_x)*image_width), int((max_y-min_y)*image_height)) return (int(min_x*image_width), int(min_y*image_height), int((max_x-min_x)*image_width), int((max_y-min_y)*image_height))
NODE_CLASS_MAPPINGS = { NODE_CLASS_MAPPINGS = {
+1 -1
View File
@@ -2,7 +2,7 @@
name = "comfyui-openpose-keypoint-extractor" name = "comfyui-openpose-keypoint-extractor"
description = "This is a single node which can take the POSE_KEYPOINT output from the OpenPose extractor node, parse it, and return x,y,width,height bounding boxes around any elements of the OpenPose skeleton" description = "This is a single node which can take the POSE_KEYPOINT output from the OpenPose extractor node, parse it, and return x,y,width,height bounding boxes around any elements of the OpenPose skeleton"
version = "1.0.0" version = "1.0.0"
license = "LICENSE" license = { file = "LICENSE" }
[project.urls] [project.urls]
Repository = "https://github.com/hughescr/ComfyUI-OpenPose-Keypoint-Extractor" Repository = "https://github.com/hughescr/ComfyUI-OpenPose-Keypoint-Extractor"