victordibia / handtrack.js

A library for prototyping realtime hand detection (bounding box), directly in the browser.
https://victordibia.com/handtrack.js/
MIT License
2.83k stars 250 forks source link

the predictions are an empty array even if my hand is visible in the camera #60

Open khldon123 opened 2 years ago

khldon123 commented 2 years ago

this is my code: ` Navigator.getUserMedia = Navigator.getUserMedia || Navigator.webkitUserMedia || Navigator.mozUserMedia || Navigator.msUserMedia; const modelParams = { flipHorizontal: true, // flip e.g for video imageScaleFactor: 0.7, // reduce input image size for gains in speed. maxNumBoxes: 20, // maximum number of boxes to detect iouThreshold: 0.5, // ioU threshold for non-max suppression scoreThreshold: 0.79, // confidence threshold for predictions. };

const video = document.querySelector("#video"); const audio = document.querySelector("#audio"); const canvas = document.querySelector("canvas"); const context = canvas.getContext("2d"); let model; handTrack.startVidseo(video) .then((status) => { if (status) { navigator.getUserMedia( { video: {} }, (stream) => { video.srcObject = stream; setInterval(doTheDetection, 1000); }, (err) => console.log(err) ); } }); function doTheDetection() {

model.detect(video)
.then(pred => {
    console.log(pred);
});

} handTrack.load(modelParams).then((lmodel) => { model = lmodel; `});````

this is the result:

handtrackbug