Add object detection, tracking, mobile notifications, and search to any security camera.
remove square flickering
roryclear1e1b47642653
diff --git a/clearcam/player.html b/clearcam/player.htmlindex 09eee2a..ef467a3 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -263,7 +263,7 @@}if(show_new == true){- clearBoundingBoxes();+ let n_boxes = document.querySelectorAll(".bounding-box").length;let aspect_ratio = frames[shape_idx].aspect_ratio;let res = frames[shape_idx].res;for(let i = 0; i < frames[shape_idx].squares.length; i++){@@ -273,6 +273,10 @@let height = ((frames[shape_idx].squares[i].bottomRightY - frames[shape_idx].squares[i].originY) / (res / aspect_ratio));drawBoundingBox(originX, originY, length, height,yolo_classes[frames[shape_idx].squares[i].classIndex][1],yolo_classes[frames[shape_idx].squares[i].classIndex][0]);}+ let boundingBoxes = document.querySelectorAll(".bounding-box");+ for (let i = 0; i < n_boxes; i++) {+ boundingBoxes[i].remove();+ }}progressBar.style.width = `${(currentTime - adjustedStartTimestamp) / totalDuration * 100}%`;@@ -490,7 +494,6 @@}function switchToNextSegment() {- hideBoundingBoxes();if (currentSegment + 1 < segments.length) {currentSegment++;is_prepared[video_index] = false;@@ -507,7 +510,6 @@isWaitingForNextSegment = true;}shape_idx = -1;- showBoundingBoxes();}function handleTimeUpdate() {@@ -597,13 +599,21 @@function drawBoundingBox(relativeX, relativeY, relativeWidth, relativeHeight, color, label) {const container = document.getElementById("videoContainer");const video = container.querySelector("video");++ if (video.videoWidth === 0) {+ alert(videoAspectRatio);+ alert(video.videoWidth);+ alert(video.videoHeight);+ alert("ZERO");+ }+const containerAspectRatio = container.clientWidth / container.clientHeight;const videoAspectRatio = video.videoWidth / video.videoHeight;let videoWidth, videoHeight, offsetX, offsetY;if (containerAspectRatio > videoAspectRatio) {- // Video is pillarboxed+ // Video is pillarboxedvideoHeight = container.clientHeight;videoWidth = videoHeight * videoAspectRatio;offsetX = (container.clientWidth - videoWidth) / 2;@@ -630,10 +640,6 @@box.style.boxSizing = "border-box";box.style.pointerEvents = "none";- if (box.style.height === "") {- return; //todo, move up- }-// Create the label (interactive)let labelDiv = document.createElement("span");labelDiv.textContent = label;@@ -647,6 +653,8 @@labelDiv.style.fontFamily = "Arial, sans-serif";labelDiv.style.whiteSpace = "nowrap";labelDiv.style.pointerEvents = "auto"; //Keeps label clickable if needed+ box.style.zIndex = "1000";+ labelDiv.style.zIndex = "1001";box.appendChild(labelDiv);boxWrapper.appendChild(box);