How to get frame of detected Barcode using Google Vision api for Barcode detection
Asked Answered
B

1

6

The google Vision's Barcode detection API works fine and gets the result of the scanned barcode using Android. But I didn't find any way to get the frame from which the barcode is detected. Is there any way to get that exact frame?

Buttonball answered 12/2, 2017 at 7:57 Comment(1)
Did you come up with something? I was thinking about getting static frame, creating bitmap and analysing it later.Contumelious
L
0

You can use detect(Frame) instead of receiveFrame(Frame).

When using receiveFrame(), you can only receive the barcode results returned by a processor:

class BarcodeTrackerFactory implements MultiProcessor.Factory<Barcode> {
    private GraphicOverlay mGraphicOverlay;

    BarcodeTrackerFactory(GraphicOverlay graphicOverlay) {
        mGraphicOverlay = graphicOverlay;
    }

    @Override
    public Tracker<Barcode> create(Barcode barcode) {
        BarcodeGraphic graphic = new BarcodeGraphic(mGraphicOverlay);
        return new GraphicTracker<>(mGraphicOverlay, graphic);
    }
}

Whereas detect() is a synchronized method. So you can save the results with the exact frame.

Labrum answered 26/8, 2019 at 7:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.