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

Video hard coded set to 20px height? #53

Open mariovde opened 3 years ago

mariovde commented 3 years ago

Hi, in the source: https://github.com/victordibia/handtrack.js/blob/master/src/index.js you put this on line 84: video.style.height = "20px";

Why is that? This makes using the webcam impossible, no?

could you explain why this is there, please?

thanks!

Regards

Mario

victordibia commented 3 years ago

That is a placeholder value that is preset before we attempt to start stream (IIRC).

On line 98, you can see that video.style.height is properly comptered based on other values ... and aims to maintain aspect ration of the webcam.

video.style.height =parseInt(video.style.width) *  (video.videoHeight / video.videoWidth).toFixed(2) +            "px";

Ensure you have set your video height and video width.