Draw Object Trails in UI

plugin-touch-ups
Moe 2024-07-18 10:57:45 -07:00
parent 777a2bf78e
commit 3a80d4dcdd
2 changed files with 12 additions and 3 deletions

View File

@ -1327,7 +1327,7 @@ $(document).ready(function(e){
theContainer: liveGridElement.eventObjects,
height: liveGridElement.height,
width: liveGridElement.width,
})
}, null, true)
}
if(d.details.confidence){
var eventConfidence = d.details.confidence

View File

@ -702,7 +702,7 @@ function buildPosePoints(bodyParts, x, y){
}
return theArray;
}
function drawMatrices(event, options, autoRemoveTimeout){
function drawMatrices(event, options, autoRemoveTimeout, drawTrails){
var theContainer = options.theContainer
var height = options.height
var width = options.width
@ -714,7 +714,10 @@ function drawMatrices(event, options, autoRemoveTimeout){
let moreMatrices = []
var monitorId = event.id;
function processMatrix(n,matrix){
html += `<div class="stream-detected-object fresh-detected-object" name="${objectTagGroup}" style="height:${heightRatio * matrix.height}px;width:${widthRatio * matrix.width}px;top:${heightRatio * matrix.y}px;left:${widthRatio * matrix.x}px;border-color: ${matrix.color};">`
const newWidth = widthRatio * matrix.width;
const newHeight = heightRatio * matrix.height;
if(drawTrails)html += `<div class="stream-detected-object fresh-detected-trail" style="height:2px;width:2px;top:${heightRatio * matrix.y + (newHeight / 2)}px;left:${widthRatio * matrix.x + (newWidth / 2)}px;border-color: green;"></div>`
html += `<div class="stream-detected-object fresh-detected-object" name="${objectTagGroup}" style="height:${newHeight}px;width:${newWidth}px;top:${heightRatio * matrix.y}px;left:${widthRatio * matrix.x}px;border-color: ${matrix.color};">`
if(matrix.tag)html += `<span class="tag">${matrix.tag}${!isNaN(matrix.id) ? ` <small class="label label-default">${matrix.id}</small>`: ''} (${matrix.confidence.toFixed(2) || 0})</span>`
if(matrix.notice)html += `<div class="matrix-info" style="color:yellow">${matrix.notice}</div>`;
if(matrix.missingNear && matrix.missingNear.length > 0){
@ -766,6 +769,12 @@ function drawMatrices(event, options, autoRemoveTimeout){
addedEls.remove()
}, autoRemoveTimeout);
}
if(drawTrails){
var addedTrails = theContainer.find('.fresh-detected-trail').removeClass('fresh-detected-trail')
setTimeout(function(){
addedTrails.remove()
}, 5000);
}
}
function setMonitorCountOnUI(){
$('.cameraCount').text(Object.keys(loadedMonitors).length)