-2

I'm working with MediaPipe trying to figure out how to use Hands. But it's been really frustrating because I keep getting an error and it doesn't work. This is my current code.

const input = document.getElementById("input");

function onHandResults(results) {
    if (results.multiHandLandmarks) {
        for (const landmarks of results.multiHandLandmarks) {
            const wrist = landmarks[0];
            const thumbTip = landmarks[4];
            const indexFingerTip = landmarks[8];

            console.log(wrist)
        }
    }
}

const hands = new Hands({
    locateFile: (file) => {
        console.log(file)
        return `https://cdn.jsdelivr.net/npm/@mediapipe/hands/${file}`;
    }
});

hands.setOptions({
    maxNumHands: 1,
    minDetectionConfidence: 0.5,
    minTrackingConfidence: 0.3,
});

hands.onResults(onHandResults);

const camera = new Camera(input, {
    onFrame: async () => {
        await hands.send({image: input});
    },
    width: window.innerWidth,
    height: window.innerHeight,
});

camera.start();

But it keeps returning the following error

RuntimeError: Aborted(native code called abort())

I've gone through many solutions online, but none of them seemed to work.

YEET
  • 1

0 Answers0