Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRFv4_JS_TK210219_v4.2.0_trial.js in a web Worker? #58

Open
luispuig opened this issue Apr 17, 2019 · 6 comments
Open

BRFv4_JS_TK210219_v4.2.0_trial.js in a web Worker? #58

luispuig opened this issue Apr 17, 2019 · 6 comments

Comments

@luispuig
Copy link

I am trying to use this trial in a web Worker, we need to improve the performance before moving to a commercial license.

Following a few issues (#12) (#45)

I added:

// BRF/brf_wasm/BRFv4_JS_TK210219_v4.2.0_trial.js
require('os') // added
require('https') // added
...
var ENVIRONMENT_IS_WORKER = true; //modified
...
module.exports = initializeBRF // added

But when I initializeBRF({...}) an error is thrown:

image

The same error whith JS and WASM versions.

@luispuig
Copy link
Author

@MarcelKlammer any idea? thanks.

@MarcelKlammer
Copy link
Member

MarcelKlammer commented Apr 25, 2019

I didn't look into that in much detail.

But a simple test.js that does roughly this:

var brfv4 = brfv4 || {

  ENVIRONMENT: "WORKER"
};

self.addEventListener('message', function(e) {

  console.log("w", e);
  //self.postMessage(e.data);

}, false);

importScripts("BRFv4_JS_TK190218_v4.0.5_trial.js");

initializeBRF(brfv4);

seem to produce no error while loading as a worker.

I don't know when I will have the time to look into it more deeply.

@MarcelKlammer
Copy link
Member

Just added minimalWebcamWorker.html + BRFv4_JS_TK210219_v4.2.0_trial.worker.js

Please take a look and let me know, if that works for you.

@luispuig
Copy link
Author

luispuig commented Apr 25, 2019

@MarcelKlammer thanks for the example.

It seems to load, but it fails when I try to config it:

  resolution = new brfv4.Rectangle(0, 0, 640, 480);
  BRFManager = new brfv4.BRFManager();
  BRFManager.init(resolution, resolution, 'com.tastenkunst.brfv4.js.examples.minimal.webcam');
  BRFManager.setMode(brfv4.BRFMode.FACE_TRACKING);
  BRFManager.setNumFacesToTrack(1);
  BRFManager.setFaceDetectionRoi(resolution);

  const size = Math.min(640, 480);
  BRFManager.setFaceDetectionParams(size * 0.3, size * 1.0, 12, 8);
  BRFManager.setFaceTrackingStartParams(size * 0.3, size * 1.0, 22, 26, 22);
  BRFManager.setFaceTrackingResetParams(size * 0.25, size * 1.0, 40, 55, 32);

image

I can try to isolate the example in a public repository if it makes easy for you to help us.

NOTE: Our version is newer: 4.2.0

Thanks!

@MarcelKlammer
Copy link
Member

Please see my other comment.

I added a working (pun!) worker example. Update the repo and see the files:

minimalWebcamWorker.html
BRFv4_JS_TK210219_v4.2.0_trial.worker.js

@luispuig
Copy link
Author

I didn't understand the comment, sorry :)

I see the example that seems very very interesting: https://github.com/Tastenkunst/brfv4_javascript_examples/blob/master/minimalWebcamWorker.html

I will look into it the first thing in the morning. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants