Angular ml5问题。don';t以角度反射ml5 uNet

Angular ml5问题。don';t以角度反射ml5 uNet,angular,typescript,p5.js,ml5,Angular,Typescript,P5.js,Ml5,我试着在角度上应用uNet。 我已经准备好打开我的摄像机了 但不要使用uNet。。只需cam视图 所以我猜这个问题。result.backgroundMask=未定义 为什么result.backgroundMask未定义。我不知道 请回答 private createCanvas() { this.p5 = new p5(this.sketch.bind(this)); } private sketch(p: any) { p.setup = () => {

我试着在角度上应用uNet。 我已经准备好打开我的摄像机了

但不要使用uNet。。只需cam视图

所以我猜这个问题。result.backgroundMask=未定义

为什么result.backgroundMask未定义。我不知道

请回答

private createCanvas() {
    this.p5 = new p5(this.sketch.bind(this));
  }

  private sketch(p: any) {
    p.setup = () => {
      p.createCanvas(600, 600).parent('bodyPix-canvas');

      this.video = p.createCapture(p.VIDEO);
      this.video = this.video.position(0, 0);
      this.video.size(p.width, p.height);
      this.video.hide();
      this.segmentationImage = p.createImage(p.width, p.height);
      this.video.elt.onloadeddata = () => {
        this.uNet.segment(this.video, this.gotResult.bind(this));
      };
    };
  }

  gotResult(error, result) {
    // if there's an error return it
    if (error) {
      console.error(error);
      return;
    }
    // set the result to the global segmentation variable
    this.segmentationImage = result.image ? result.image : this.video;
    this.draw();
    // Continue asking for a segmentation image
    this.uNet.segment(this.video, this.gotResult.bind(this));
  }

  draw() {
    this.p5.background(0);
    this.p5.image(this.segmentationImage, 0, 0, this.p5.width, this.p5.height);
  }