简体   繁体   English

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

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

I already make the app for Text Recognition and Barcode Scanner separately. 我已经分别为文本识别和条形码扫描仪制作了该应用程序。 But is it possible if i want to use Text Recognition and Barcode Scanner at the same time at Live Stream? 但是如果我想在实时流中同时使用文本识别和条形码扫描仪,是否可以?

I confused after i read this code 我看了这段代码后感到困惑

mCameraSource.setMachineLearningFrameProcessor(barcodeScanningProcessor);

Is that indicate that only one camerasource per one MachineLearning? 这是否表明每一项机器学习仅一个摄像机资源?

Yes it is, however the sample code you are using is tailored for using one frame processor at a time. 是的,但是您正在使用的示例代码是针对一次使用一个帧处理器而量身定制的。

One way to achieve what you are looking for is to process each frame individually, which would allow you to pass it to multiple APIs. 实现所需内容的一种方法是分别处理每个框架,这将使您可以将其传递给多个API。

CameraView is one package that allows frame processing. CameraView是一种允许进行帧处理的软件包。 You may want to throttle and only take one out of every X frames, since processing a frame is computationally intensive. 您可能想节流,每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.

   }
}

You'd process each frame as described in the documentation for text recognition , and similarly for barcode scanning . 您将按照文档中所述处理每个帧以进行文本识别 ,并类似地进行条形码扫描

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

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