【问题标题】:How to pass media stream from angular code to Facemesh.js如何将媒体流从角度代码传递到 Facemesh.js
【发布时间】:2022-12-14 13:28:49
【问题描述】:

我如何替换此相机功能并从另一个角度模块传递我自己的媒体流? 来源:https://google.github.io/mediapipe/solutions/face_mesh

const camera = new Camera(videoElement, {
  onFrame: async () => {
    await faceMesh.send({image: videoElement});
  },
  width: 1280,
  height: 720
});
camera.start();

如果我尝试删除相机功能,我将无法将媒体流传递给 faceMesh.send()。

【问题讨论】:

  • 替换相机功能并将您自己的 MediaStream 传递给 faceMesh.send()
  • 如果我尝试在 facemesh.send() 中传递我自己的媒体流而不是我得到的错误

标签: javascript angularjs tensorflow.js mediapipe


【解决方案1】:

MediaPipe FaceMesh可以阅读HTMLVideoElement(在幕后它只是一个复制帧到画布然后从画布到张量获取像素),所以你不必处理它。

但是你的媒体流不会有每帧事件(JS 规范中没有这样的东西)——这就是 Camera wrapper 增值。

不会为您编写代码,但您需要的工作流程是:

  1. faceMesh.send
  2. 听取结果
  3. 一旦你有结果做下一步faceMesh.send

【讨论】:

    【解决方案2】:

    @Vladimir曼迪奇

    使用这种方法时出现以下错误。 我删除了相机功能,只使用 await facemesh.send(image:videoElement); 错误:- 节点“facelandmarkfrontgpu__facedetectionshortrangepu__ImageToTensorCalculator”的“Process()”失败:RET_CHECK 失败(third_party/mediapipe/calculators/tensor/image_to_tensor_utils.cc:54)roi->width > 0 && roi->height > 0 ROI 宽度和高度必须 > 0。 “

    【讨论】:

      猜你喜欢
      • 2015-10-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-04-18
      相关资源
      最近更新 更多