繁体   English   中英

是否可以同时使用Firebase ML Kit文本识别和条形码扫描仪?

[英]Is it possible to use Firebase ML Kit Text Recognition and Barcode Scanner at the same time?

我已经分别为文本识别和条形码扫描仪制作了该应用程序。 但是如果我想在实时流中同时使用文本识别和条形码扫描仪,是否可以?

我看了这段代码后感到困惑

mCameraSource.setMachineLearningFrameProcessor(barcodeScanningProcessor);

这是否表明每一项机器学习仅一个摄像机资源?

是的,但是您正在使用的示例代码是针对一次使用一个帧处理器而量身定制的。

实现所需内容的一种方法是分别处理每个框架,这将使您可以将其传递给多个API。

CameraView是一种允许进行帧处理的软件包。 您可能想节流,每X帧只取一个,因为处理一帧需要大量计算。

cameraView.addFrameProcessor(new FrameProcessor() {
   @Override
   @WorkerThread
   public void process(Frame frame) {
       byte[] data = frame.getData();
       int rotation = frame.getRotation();
       long time = frame.getTime();
       Size size = frame.getSize();
       int format = frame.getFormat();

       // Process frame
       // This is where you'd pass the image to the Text recognition API
       // and then to the Barcode scanning API.

   }
}

您将按照文档中所述处理每个帧以进行文本识别 ,并类似地进行条形码扫描

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM