如何使用 A-Frame 添加摄像头模块流水线

问题描述

我是 8th wall 和前端开发的新手。我正在开发一个项目,其中包含在框架中开发的一系列图像目标体验。最重要的是,我需要扫描 AR 中的二维码。 从我在文档中看到的,我可以添加相机管道模块。但我的问题是我如何开始使用框架组件寄存器来实现它?启动代码在这里

AFRAME.registerComponent('qr-scan',{
  schema: {
  },init: function () {
    // Install a module which gets the camera Feed as a UInt8Array.
    XR8.addCameraPipelineModule(
    XR8.CameraPixelArray.pipelineModule({luminance: true,width: 240,height: 320}))
    // Install a module that draws the camera Feed to the canvas.
    XR8.addCameraPipelineModule(XR8.GlTextureRenderer.pipelineModule())
    // Create our custom application logic for scanning and displaying QR codes.
    XR8.addCameraPipelineModule({
      name : 'qrscan',onProcesscpu : ({onProcessGpuResult}) => {
        // CameraPixelArray.pipelineModule() returned these in onProcessGpu.
        const { pixels,rows,cols,rowBytes } = onProcesGpuResult.camerapixelarray
        const { wasFound,url,corners } = findQrCode(pixels,rowBytes)
        return { wasFound,corners }
      },onUpdate : ({onProcesscpuResult}) => {
        // These were returned by this module ('qrscan') in onProcesscpu
        const {wasFound,corners } = onProcesscpuResult.qrscan
        if (wasFound) {
          showUrlAndCorners(url,corners)
        }
      },})
  },})

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)