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
truefrom BarcodeDetectorFrameHandler.ResultHandler.handle
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBarcodeDetectorFrameHandler.ResultHandlerContinuously notified about barcode/QR code detection results.
public abstract classBarcodeDetectorFrameHandler.BarcodeDetectorResultHandlerSuccessor-class needed for cross-platform implementation.
-
Constructor Summary
Constructors Constructor Description BarcodeDetectorFrameHandler(ScanbotBarcodeDetector barcodeDetector)
-
Method Summary
Modifier and Type Method Description BooleanisEnabled()UnitsetEnabled(Boolean isEnabled)BooleanhandleFrame(FrameHandler.Frame previewFrame)Invoked for every new camera preview frame. final UnitaddResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)Registers result handler which will be notified about barcode/QR code detection results. final UnitremoveResultHandler(BarcodeDetectorFrameHandler.ResultHandler handler)Unregisters handler. final UnitsetDetectionInterval(Long detectionIntervalInMs)Set barcode detection interval in milliseconds final UnitsetBarcodeFilter(IBarcodeFilter filter)Set implementation of IBarcodeFilter, that will be applied to every frame after detection and filter frames with undesired data. final static BarcodeDetectorFrameHandlerattach(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-trueto 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
-
-
-
-