Skip to content

Commit

Permalink
fixed poseNet.ObjectPose.FindKeypoint() Python function
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Feb 14, 2022
1 parent 91f0a70 commit b1afeb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/posenet.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ for pose in poses:
# find the keypoint index from the list of detected keypoints
# you can find these keypoint names in the model's JSON file,
# or with net.GetKeypointName() / net.GetNumKeypoints()
left_wrist_idx = net.FindKeypoint('left_wrist')
left_shoulder_idx = net.FindKeypoint('left_shoulder')
left_wrist_idx = pose.FindKeypoint('left_wrist')
left_shoulder_idx = pose.FindKeypoint('left_shoulder')

# if the keypoint index is < 0, it means it wasn't found in the image
if left_wrist_idx < 0 or left_shoulder_idx < 0:
Expand Down
5 changes: 4 additions & 1 deletion python/bindings/PyPoseNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,14 @@ static PyObject* PyObjectPose_FindKeypoint( PyObjectPose_Object* self, PyObject
return NULL;
}

// parse arguments
// this function accepts either the keypoint ID (int) or the name (string)
// in the string case, it will just look up the keypoint ID for you
int id = 0;

if( !PyArg_ParseTuple(args, "i", &id) )
{
PyErr_Clear(); // PyArg_ParseTuple will throw an exception

if( self->net != NULL )
{
const char* name = NULL;
Expand Down

0 comments on commit b1afeb8

Please sign in to comment.