breaking changes to results.hand output properties

pull/134/head
Vladimir Mandic 2021-06-01 07:01:59 -04:00
parent fdc0c8d496
commit 92926aa134
12 changed files with 62 additions and 62 deletions

View File

@ -8132,11 +8132,11 @@ async function predict5(input, config3) {
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -8163,7 +8163,7 @@ async function predict5(input, config3) {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -10146,8 +10146,8 @@ async function hand2(inCanvas2, result, drawOptions) {
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -10357,13 +10357,13 @@ function calc(newResult) {
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

File diff suppressed because one or more lines are too long

16
dist/human.esm.js vendored
View File

@ -66068,11 +66068,11 @@ async function predict5(input2, config3) {
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -66099,7 +66099,7 @@ async function predict5(input2, config3) {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input2.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -68082,8 +68082,8 @@ async function hand2(inCanvas2, result, drawOptions) {
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -68293,13 +68293,13 @@ function calc(newResult) {
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

File diff suppressed because one or more lines are too long

16
dist/human.js vendored
View File

@ -66076,11 +66076,11 @@ return a / b;`;
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -66107,7 +66107,7 @@ return a / b;`;
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input2.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -68090,8 +68090,8 @@ return a / b;`;
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -68301,13 +68301,13 @@ return a / b;`;
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

View File

@ -8159,11 +8159,11 @@ async function predict5(input, config3) {
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -8190,7 +8190,7 @@ async function predict5(input, config3) {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -10181,8 +10181,8 @@ async function hand2(inCanvas2, result, drawOptions) {
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -10392,13 +10392,13 @@ function calc(newResult) {
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

View File

@ -8160,11 +8160,11 @@ async function predict5(input, config3) {
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -8191,7 +8191,7 @@ async function predict5(input, config3) {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -10182,8 +10182,8 @@ async function hand2(inCanvas2, result, drawOptions) {
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -10393,13 +10393,13 @@ function calc(newResult) {
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

16
dist/human.node.js vendored
View File

@ -8159,11 +8159,11 @@ async function predict5(input, config3) {
annotations3[key] = meshAnnotations[key].map((index) => predictions[i].landmarks[index]);
}
}
const landmarks = predictions[i].landmarks;
const keypoints3 = predictions[i].landmarks;
let box6 = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0];
let boxRaw3 = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) {
for (const pt of landmarks) {
if (keypoints3 && keypoints3.length > 0) {
for (const pt of keypoints3) {
if (pt[0] < box6[0])
box6[0] = pt[0];
if (pt[1] < box6[1])
@ -8190,7 +8190,7 @@ async function predict5(input, config3) {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1]
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 });
}
return hands;
}
@ -10181,8 +10181,8 @@ async function hand2(inCanvas2, result, drawOptions) {
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + 2 * pt[2]}, ${127.5 - 2 * pt[2]}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}
@ -10392,13 +10392,13 @@ function calc(newResult) {
for (let i = 0; i < newResult.hand.length; i++) {
const box6 = newResult.hand[i].box.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor);
const boxRaw3 = newResult.hand[i].boxRaw.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor);
const landmarks = newResult.hand[i].landmarks.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor));
const keypoints3 = newResult.hand[i].keypoints.map((landmark, j) => landmark.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor));
const keys = Object.keys(newResult.hand[i].annotations);
const annotations3 = {};
for (const key of keys) {
annotations3[key] = newResult.hand[i].annotations[key].map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, landmarks, annotations: annotations3 };
bufferedResult.hand[i] = { ...newResult.hand[i], box: box6, boxRaw: boxRaw3, keypoints: keypoints3, annotations: annotations3 };
}
}
if (!bufferedResult.face || newResult.face.length !== bufferedResult.face.length) {

View File

@ -404,8 +404,8 @@ export async function hand(inCanvas: HTMLCanvasElement, result: Array<Hand>, dra
ctx.stroke();
}
if (localOptions.drawPoints) {
if (h.landmarks && h.landmarks.length > 0) {
for (const pt of h.landmarks) {
if (h.keypoints && h.keypoints.length > 0) {
for (const pt of h.keypoints) {
ctx.fillStyle = localOptions.useDepth ? `rgba(${127.5 + (2 * pt[2])}, ${127.5 - (2 * pt[2])}, 255, 0.5)` : localOptions.color;
point(ctx, pt[0], pt[1], 0, localOptions);
}

View File

@ -35,12 +35,12 @@ export async function predict(input, config): Promise<Hand[]> {
}
}
const landmarks = predictions[i].landmarks as unknown as Array<[number, number, number]>;
const keypoints = predictions[i].landmarks as unknown as Array<[number, number, number]>;
let box: [number, number, number, number] = [Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER, 0, 0]; // maximums so conditionals work
let boxRaw: [number, number, number, number] = [0, 0, 0, 0];
if (landmarks && landmarks.length > 0) { // if we have landmarks, calculate box based on landmarks
for (const pt of landmarks) {
if (keypoints && keypoints.length > 0) { // if we have landmarks, calculate box based on landmarks
for (const pt of keypoints) {
if (pt[0] < box[0]) box[0] = pt[0];
if (pt[1] < box[1]) box[1] = pt[1];
if (pt[0] > box[2]) box[2] = pt[0];
@ -63,7 +63,7 @@ export async function predict(input, config): Promise<Hand[]> {
(predictions[i].box.bottomRight[1] - predictions[i].box.topLeft[1]) / input.shape[1],
];
}
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box, boxRaw, landmarks, annotations });
hands.push({ id: i, confidence: Math.round(100 * predictions[i].confidence) / 100, box, boxRaw, keypoints, annotations });
}
return hands;
}

View File

@ -48,16 +48,16 @@ export function calc(newResult: Result): Result {
.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];
const boxRaw = (newResult.hand[i].boxRaw // update boxRaw
.map((b, j) => ((bufferedFactor - 1) * bufferedResult.hand[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];
const landmarks = newResult.hand[i].landmarks // update landmarks
const keypoints = newResult.hand[i].keypoints // update landmarks
.map((landmark, j) => landmark
.map((coord, k) => (((bufferedFactor - 1) * bufferedResult.hand[i].landmarks[j][k] + coord) / bufferedFactor)) as [number, number, number]);
.map((coord, k) => (((bufferedFactor - 1) * bufferedResult.hand[i].keypoints[j][k] + coord) / bufferedFactor)) as [number, number, number]);
const keys = Object.keys(newResult.hand[i].annotations); // update annotations
const annotations = {};
for (const key of keys) {
annotations[key] = newResult.hand[i].annotations[key]
.map((val, j) => val.map((coord, k) => ((bufferedFactor - 1) * bufferedResult.hand[i].annotations[key][j][k] + coord) / bufferedFactor));
}
bufferedResult.hand[i] = { ...newResult.hand[i], box, boxRaw, landmarks, annotations }; // shallow clone plus updated values
bufferedResult.hand[i] = { ...newResult.hand[i], box, boxRaw, keypoints, annotations }; // shallow clone plus updated values
}
}

View File

@ -97,7 +97,7 @@ export interface Hand {
confidence: number,
box: [number, number, number, number],
boxRaw: [number, number, number, number],
landmarks: Array<[number, number, number]>,
keypoints: Array<[number, number, number]>,
annotations: Record<string, Array<[number, number, number]>>,
}