From bdceeea1d8dac745f2f9553cd0ca64be06ab129a Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 23 May 2021 13:54:22 -0400 Subject: [PATCH] use green weighted for input diff calculation --- src/human.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/human.ts b/src/human.ts index 28731ed0..761f7740 100644 --- a/src/human.ts +++ b/src/human.ts @@ -365,9 +365,9 @@ export class Human { sumT.dispose(); */ // use js loop sum, faster than uploading tensor to gpu calculating and downloading back - const reducedData = reduced.dataSync(); + const reducedData = reduced.dataSync(); // raw image rgb array let sum = 0; - for (let i = 0; i < reducedData.length / 3; i++) sum += reducedData[3 * i + 2]; // look only at green value as each pixel is rgb number triplet + for (let i = 0; i < reducedData.length / 3; i++) sum += reducedData[3 * i + 2]; // look only at green value of each pixel reduced.dispose(); const diff = 100 * (Math.max(sum, this.#lastInputSum) / Math.min(sum, this.#lastInputSum) - 1);