From 15ff1efc4b2155284b236a198909d9503a231620 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Thu, 30 Dec 2021 12:14:09 -0500 Subject: [PATCH] update hand annotations --- src/hand/handpose.ts | 2 -- src/hand/handtrack.ts | 9 +++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hand/handpose.ts b/src/hand/handpose.ts index f280415e..6a6f94b0 100644 --- a/src/hand/handpose.ts +++ b/src/hand/handpose.ts @@ -38,9 +38,7 @@ export async function predict(input: Tensor, config: Config): Promise predictions[i].landmarks[index]); } } - const keypoints = predictions[i].landmarks as unknown as Array; - let box: Box = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0]; // maximums so conditionals work let boxRaw: Box = [0, 0, 0, 0]; if (keypoints && keypoints.length > 0) { // if we have landmarks, calculate box based on landmarks diff --git a/src/hand/handtrack.ts b/src/hand/handtrack.ts index 5cbf8872..d90f3b95 100644 --- a/src/hand/handtrack.ts +++ b/src/hand/handtrack.ts @@ -51,12 +51,21 @@ const cache: { }; const fingerMap = { + /* thumb: [0, 1, 2, 3, 4], index: [0, 5, 6, 7, 8], middle: [0, 9, 10, 11, 12], ring: [0, 13, 14, 15, 16], pinky: [0, 17, 18, 19, 20], palm: [0], + */ + thumb: [1, 2, 3, 4], + index: [5, 6, 7, 8], + middle: [9, 10, 11, 12], + ring: [13, 14, 15, 16], + pinky: [17, 18, 19, 20], + base: [0], + palm: [0, 17, 13, 9, 5, 1, 0], }; export async function loadDetect(config: Config): Promise {