имеет блокировку отпечатка пальца, вызов: getImageData - PullRequest
0 голосов
/ 21 октября 2019

В настоящее время я использую face-api.js для обнаружения лиц и прогнозирования выражений лица. но вывод видео плавный, но ограничивающий прямоугольник и предсказания нарушаются, как будто кадр падает.

Исходный код

this.peerVideo.addEventListener('play', () => {
        if (this.canvas == null) {
          this.canvas = faceapi.createCanvasFromMedia(this.peerVideo);
          this.canvas.style.top = this.state.top;
          this.canvas.style.left = this.state.left;
          this.canvas.style.position = "absolute";
          this.ctx = this.canvas.getContext('2d');
          document.body.append(this.canvas);
        }
        faceapi.matchDimensions(this.canvas, displaySize);
        this.intervalId = setInterval(async() => {
          if (this._isMounted) {
            const detections = await faceapi.detectSingleFace(this.peerVideo, new faceapi.SsdMobilenetv1Options())
              .withFaceExpressions();
            if (detections) {
              const resizedDetections = faceapi.resizeResults(detections, displaySize);
              if (this.ctx) {
                this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
              }
              faceapi.draw.drawDetections(this.canvas, resizedDetections);
              faceapi.draw.drawFaceExpressions(this.canvas, resizedDetections);
            }
          }
        }, 1000 / 30);
      });

Код ошибки

имеет блокировку отпечатка пальца, вызов: getImageData

...