You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 858B

12345678910111213141516171819202122232425262728
  1. // @flow
  2. import * as bodyPix from '@tensorflow-models/body-pix';
  3. import JitsiStreamBlurEffect from './JitsiStreamBlurEffect';
  4. /**
  5. * Creates a new instance of JitsiStreamBlurEffect. This loads the bodyPix model that is used to
  6. * extract person segmentation.
  7. *
  8. * @returns {Promise<JitsiStreamBlurEffect>}
  9. */
  10. export async function createBlurEffect() {
  11. if (!MediaStreamTrack.prototype.getSettings && !MediaStreamTrack.prototype.getConstraints) {
  12. throw new Error('JitsiStreamBlurEffect not supported!');
  13. }
  14. // An output stride of 16 and a multiplier of 0.5 are used for improved
  15. // performance on a larger range of CPUs.
  16. const bpModel = await bodyPix.load({
  17. architecture: 'MobileNetV1',
  18. outputStride: 16,
  19. multiplier: 0.50,
  20. quantBytes: 2
  21. });
  22. return new JitsiStreamBlurEffect(bpModel);
  23. }