使用XComponent组件显示相机的预览输出流时,如何获取相机的帧数据

努力写bug

沙发 发表于 2023-9-7 10:55:09
通过创建双路预览来实现。
1.Xcomponent来创建预览流。
  1. // 获取PreviewOutput(预览输出类)实例
  2. const surfaceId = globalThis.mxXComponentController.getXComponentSurfaceld();
  3. this.mPreviewOutput = await Camera.createPreviewOutput(surfaceld) ;
复制代码

2.使用imageReceiver来监听图像信息。
  1. // 添加双路预览
  2. const fullWidth = this.mFullScreenSize.width;
  3. const fullHeight = this.mFullScreenSize.height;
  4. const imageReceiver = await image.createImageReceiver(fullwidth, fullHeight,
  5.   formatImage, capacityImage) ;
  6. const photoSurfaceId = await imageReceiver.getReceivingSurfaceld();
  7. this.mPreviewOutputDouble = await Camera.createPreviewOutput ( photoSurfaceld)
复制代码

Copyright   ©2023  OpenHarmony开发者论坛  京ICP备2020036654号-3 |技术支持 Discuz!

返回顶部