Skip to content

Commit

Permalink
fix scaling issue and allow webcam inference for all models
Browse files Browse the repository at this point in the history
  • Loading branch information
MadeWithStone committed Jul 26, 2024
1 parent dd1472e commit e0572ef
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions newhome.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,8 @@ function switchModel() {
}

// hide webcam button if model is not microsoft-coco
if (current_model_name != "microsoft-coco") {
document.getElementById("webcam-predict").style.display = "none";
} else {
document.getElementById("webcam-predict").style.display = "inline";
}

document.getElementById("webcam-predict").style.display = "inline";

// change video to use new one
// var video = document.getElementById("video_source");
Expand Down Expand Up @@ -484,13 +481,8 @@ function webcamInference() {
// on full load
video.onplay = function () {
const settings = stream.getVideoTracks()[0].getSettings();
console.log(settings);
height = video.videoHeight;
width = video.videoWidth;
console.log(
`stream width: ${width} canvas width: ${canvas.style.width}`
);

video.setAttribute("width", width);
video.setAttribute("height", height);
video.style.width = canvas.style.width + "px";
Expand Down

0 comments on commit e0572ef

Please sign in to comment.