Skip to content

Commit

Permalink
up version to v3 to signal potential breaking change, getPupilFeature…
Browse files Browse the repository at this point in the history
…s can use internal var instead of needed it as a param, fix collision.html
  • Loading branch information
jeffhuang committed Mar 25, 2022
1 parent 6a43030 commit cd26c90
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgazer",
"version": "2.2.0",
"version": "3.0.0",
"repository": {
"type": "git",
"url": "https://github.com/brownhci/WebGazer.git"
Expand Down
1 change: 1 addition & 0 deletions src/facemesh.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TFFaceMesh.prototype.positionsArray = null;

/**
* Isolates the two patches that correspond to the user's eyes
* @param {Object} video - the video element itself
* @param {Canvas} imageCanvas - canvas corresponding to the webcam stream
* @param {Number} width - of imageCanvas
* @param {Number} height - of imageCanvas
Expand Down
7 changes: 3 additions & 4 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,16 @@ function drawCoordinates(colour,x,y){
/**
* Gets the pupil features by following the pipeline which threads an eyes object through each call:
* curTracker gets eye patches -> blink detector -> pupil detection
* @param {Object} video - the video element itself
* @param {Canvas} canvas - a canvas which will have the video drawn onto it
* @param {Number} width - the width of canvas
* @param {Number} height - the height of canvas
*/
function getPupilFeatures(video, canvas, width, height) {
function getPupilFeatures(canvas, width, height) {
if (!canvas) {
return;
}
try {
return curTracker.getEyePatches(video, canvas, width, height);
return curTracker.getEyePatches(videoElement, canvas, width, height);
} catch(err) {
console.log("can't get pupil features ", err);
return null;
Expand Down Expand Up @@ -235,7 +234,7 @@ function paintCurrentFrame(canvas, width, height) {
async function getPrediction(regModelIndex) {
var predictions = [];
// [20200617 xk] TODO: this call should be made async somehow. will take some work.
latestEyeFeatures = await getPupilFeatures(videoElement, videoElementCanvas, videoElementCanvas.width, videoElementCanvas.height);
latestEyeFeatures = await getPupilFeatures(videoElementCanvas, videoElementCanvas.width, videoElementCanvas.height);

if (regs.length === 0) {
console.log('regression not set, call setRegression()');
Expand Down
1 change: 0 additions & 1 deletion www/collision.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<body>
<script src="https://d3js.org/d3.v3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.8.1/localforage.js"></script>
<!-- <script src="./tensorflow.js"></script> -->
<script src="./webgazer.js"></script>
<script src="js/collision.js"></script>
</body>
1 change: 0 additions & 1 deletion www/js/collision.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
webgazerCanvas = webgazer.getVideoElementCanvas();
}

await webgazer.getTracker().getEyePatches(webgazerCanvas, webgazerCanvas.width, webgazerCanvas.height);
var fmPositions = await webgazer.getTracker().getPositions();

var whr = webgazer.getVideoPreviewToCameraResolutionRatio();
Expand Down
2 changes: 1 addition & 1 deletion www/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgazer-www",
"version": "2.2.0",
"version": "3.0.0",
"repository": {
"type": "git",
"url": "https://github.com/brownhci/WebGazer.git"
Expand Down
8 changes: 4 additions & 4 deletions www/webgazer.js
Original file line number Diff line number Diff line change
Expand Up @@ -146366,6 +146366,7 @@ TFFaceMesh.prototype.positionsArray = null;

/**
* Isolates the two patches that correspond to the user's eyes
* @param {Object} video - the video element itself
* @param {Canvas} imageCanvas - canvas corresponding to the webcam stream
* @param {Number} width - of imageCanvas
* @param {Number} height - of imageCanvas
Expand Down Expand Up @@ -148027,17 +148028,16 @@ function drawCoordinates(colour,x,y){
/**
* Gets the pupil features by following the pipeline which threads an eyes object through each call:
* curTracker gets eye patches -> blink detector -> pupil detection
* @param {Object} video - the video element itself
* @param {Canvas} canvas - a canvas which will have the video drawn onto it
* @param {Number} width - the width of canvas
* @param {Number} height - the height of canvas
*/
function getPupilFeatures(video, canvas, width, height) {
function getPupilFeatures(canvas, width, height) {
if (!canvas) {
return;
}
try {
return curTracker.getEyePatches(video, canvas, width, height);
return curTracker.getEyePatches(videoElement, canvas, width, height);
} catch(err) {
console.log("can't get pupil features ", err);
return null;
Expand Down Expand Up @@ -148070,7 +148070,7 @@ function paintCurrentFrame(canvas, width, height) {
async function getPrediction(regModelIndex) {
var predictions = [];
// [20200617 xk] TODO: this call should be made async somehow. will take some work.
latestEyeFeatures = await getPupilFeatures(videoElement, videoElementCanvas, videoElementCanvas.width, videoElementCanvas.height);
latestEyeFeatures = await getPupilFeatures(videoElementCanvas, videoElementCanvas.width, videoElementCanvas.height);

if (regs.length === 0) {
console.log('regression not set, call setRegression()');
Expand Down
2 changes: 1 addition & 1 deletion www/webgazer.js.map

Large diffs are not rendered by default.

0 comments on commit cd26c90

Please sign in to comment.