Class BarcodeDetectorFrameHandler
-
- All Implemented Interfaces:
public class BarcodeDetectorFrameHandler extends FrameHandler
Performs barcode/QR code detection on camera preview frames. Outputs results via BarcodeDetectorFrameHandler.ResultHandler (addResultHandler).
Preview frame considered intercepted if at least one BarcodeDetectorFrameHandler.ResultHandler returns
true
from BarcodeDetectorFrameHandler.ResultHandler.handle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
BarcodeDetectorFrameHandler.ResultHandler
Continuously notified about barcode/QR code detection results.
public abstract class
BarcodeDetectorFrameHandler.BarcodeDetectorResultHandler
Successor-class needed for cross-platform implementation.
-
Constructor Summary
Constructors Constructor Description BarcodeDetectorFrameHandler(ScanbotBarcodeDetector barcodeDetector)
-
Method Summary
Modifier and Type Method Description Boolean
isEnabled()
Unit
setEnabled(Boolean isEnabled)
Boolean
handleFrame(FrameHandler.Frame previewFrame)
Invoked for every new camera preview frame. final Unit
addResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)
Registers result handler which will be notified about barcode/QR code detection results. final Unit
removeResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)
Unregisters handler. final Unit
setDetectionInterval(Long detectionIntervalInMs)
Set barcode detection interval in milliseconds final Unit
setBarcodeFilter(IBarcodeFilter filter)
Set implementation of IBarcodeFilter, that will be applied to every frame after detection and filter frames with undesired data. final static BarcodeDetectorFrameHandler
attach(IScanbotCameraView cameraView, ScanbotBarcodeDetector barcodeDetector)
Convenience method for creating new BarcodeDetectorFrameHandler and adding it as FrameHandler to given camera view. -
-
Constructor Detail
-
BarcodeDetectorFrameHandler
BarcodeDetectorFrameHandler(ScanbotBarcodeDetector barcodeDetector)
-
-
Method Detail
-
setEnabled
Unit setEnabled(Boolean isEnabled)
- Parameters:
isEnabled
-true
to enable barcode/QR code detection.
-
handleFrame
@Synchronized() Boolean handleFrame(FrameHandler.Frame previewFrame)
Invoked for every new camera preview frame.
- Parameters:
previewFrame
- captured preview frame data
-
addResultHandler
final Unit addResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)
Registers result handler which will be notified about barcode/QR code detection results.
Results are coming on the worker thread. Don't forget to move execution to main thread before updating UI.
- Parameters:
handler
- handler to register.
-
removeResultHandler
final Unit removeResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)
Unregisters handler.
- Parameters:
handler
- handler to unregister.
-
setDetectionInterval
final Unit setDetectionInterval(Long detectionIntervalInMs)
Set barcode detection interval in milliseconds
-
setBarcodeFilter
final Unit setBarcodeFilter(IBarcodeFilter filter)
Set implementation of IBarcodeFilter, that will be applied to every frame after detection and filter frames with undesired data.
NOTE: here, for BarcodeScanner (as opposed to BatchBarcodeScanner) only IBarcodeFilter.acceptsBarcode filtering method will be used.
- Parameters:
filter
- IBarcodeFilter implementation.
-
attach
final static BarcodeDetectorFrameHandler attach(IScanbotCameraView cameraView, ScanbotBarcodeDetector barcodeDetector)
Convenience method for creating new BarcodeDetectorFrameHandler and adding it as FrameHandler to given camera view.
- Parameters:
cameraView
- camera view to which new barcode/QR code detector will be attachedbarcodeDetector
- ScanbotBarcodeDetector which performs barcode detection and recognition
-
-
-
-