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?
How to get frame of detected Barcode using Google Vision api for Barcode detection
Asked Answered
Did you come up with something? I was thinking about getting static frame, creating bitmap and analysing it later. –
Contumelious
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.
© 2022 - 2024 — McMap. All rights reserved.