Android FirebaseVisionBarcode列表在初始帧预览时为空

Android FirebaseVisionBarcode列表在初始帧预览时为空,android,firebase,android-camera2,firebase-mlkit,Android,Firebase,Android Camera2,Firebase Mlkit,我正在跟踪ML套件条形码扫描的回购协议。在我的实现中,我注意到在onSuccess中,当我第一次启动相机检测条形码时,会触发回调,这很好。然而,当我把相机举到有效的条形码时,条形码列表本身是空的。调用了onSuccess回调,但条形码列表为空 当我将应用程序设置为背景,然后将其设置为前景,然后开始填充条形码列表(barcodes.size()不再为零) 有人知道为什么会这样吗 final FirebaseVisionImage firebaseImage = FirebaseVisionIma

我正在跟踪ML套件条形码扫描的回购协议。在我的实现中,我注意到在
onSuccess
中,当我第一次启动相机检测条形码时,会触发回调,这很好。然而,当我把相机举到有效的条形码时,条形码列表本身是空的。调用了
onSuccess
回调,但条形码列表为空

当我将应用程序设置为背景,然后将其设置为前景,然后开始填充条形码列表(barcodes.size()不再为零)

有人知道为什么会这样吗

final FirebaseVisionImage firebaseImage = 
FirebaseVisionImage.fromMediaImage(image, rotation);

FirebaseVisionBarcodeDetectorOptions options = new 
FirebaseVisionBarcodeDetectorOptions.Builder().setBarcodeFormats(
        FirebaseVisionBarcode.FORMAT_ALL_FORMATS).build();

barcodeDetector = FirebaseVision.getInstance().getVisionBarcodeDetector(options)
barcodeDetector.detectInImage(firebaseImage).addOnSuccessListener((barcodes) -> 
{          
    // note that the success callback is called and I do get here
    // but barcode list is empty initially                    
    for (FirebaseVisionBarcode barcode : barcodes)
    {
        // we never get here since barcodes.size() is 0
        // until I background the app, then foreground it
        // after backgrounding, then foregrounding, we start
        // detecting barcodes
    }
    }).addOnFailureListener((exception) -> {
        //TODO: handle failure
    });