eduardolundgren / eduardolundgren/tracking.js

Tracking whit responsive video

Open
#339 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

im trying to use track.js whit a responsive embed webcam

```

canvas {
position: absolute;
z-index:9999;
}
video {
width: 100%;
height: auto;
}








window.onload = function() {

var video = document.getElementById('video');
var canvas = document.getElementById('canvas');

$("#canvas").width($("#video").width());
$("#canvas").height($("#video").height());
var context = canvas.getContext('2d');
var tracker = new tracking.ObjectTracker('face');
tracker.setInitialScale(4);
tracker.setStepSize(2);
tracker.setEdgesDensity(0.1);
tracking.track('#video', tracker, { camera: true });
tracker.on('track', function(event) {
context.clearRect(0, 0, canvas.width, canvas.height);
event.data.forEach(function(rect) {
context.strokeStyle = '#a64ceb';
context.strokeRect(rect.x, rect.y, rect.width, rect.height);
context.font = '11px Helvetica';
context.fillStyle = "#fff";
context.fillText('x: ' + rect.x + 'px', rect.x + rect.width + 5, rect.y + 11);
context.fillText('y: ' + rect.y + 'px', rect.x + rect.width + 5, rect.y + 22);
});
});

};



```

bit it isnt working , the tracker square as broken.

Contributor guide

No contributing guide indexed for this repository

Research direction

Use the supplied HTML, CSS, and JavaScript example as the reproduction case with a responsive webcam video. Investigate why the tracking overlay breaks when the video resizes, then verify that the tracker square remains aligned at responsive dimensions; the report names no source file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-vision, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.