public class DCScannerFrameHandler extends java.lang.Object implements PreviewBuffer.FrameHandler
DCScannerFrameHandler.ResultHandler
(addResultHandler(ResultHandler)).
Preview frame considered intercepted if at least one
DCScannerFrameHandler.ResultHandler returns true from
DCScannerFrameHandler.ResultHandler.handleResult(DisabilityCertificateRecognizerResultInfo)
PreviewBuffer| Modifier and Type | Class and Description |
|---|---|
static interface |
DCScannerFrameHandler.ResultHandler
Continuously notified about DC data detection results.
|
| Constructor and Description |
|---|
DCScannerFrameHandler(android.content.Context context,
DCScanner dcScanner) |
| Modifier and Type | Method and Description |
|---|---|
void |
addResultHandler(DCScannerFrameHandler.ResultHandler handler)
Registers result handler which will be notified about DC data detection results.
|
static DCScannerFrameHandler |
attach(ScanbotCameraView cameraView,
DCScanner dcScanner)
Convenience method for creating new
DCScannerFrameHandler and adding it
as PreviewBuffer.FrameHandler to given camera view. |
boolean |
handleFrame(byte[] frame,
int width,
int height,
int frameOrientation,
android.graphics.Rect finderRect)
Invoked for every new camera preview frame
|
boolean |
isEnabled() |
void |
removeResultHandler(DCScannerFrameHandler.ResultHandler handler)
Unregisters handler.
|
void |
setEnabled(boolean enabled) |
public DCScannerFrameHandler(android.content.Context context,
DCScanner dcScanner)
public static DCScannerFrameHandler attach(ScanbotCameraView cameraView, DCScanner dcScanner)
DCScannerFrameHandler and adding it
as PreviewBuffer.FrameHandler to given camera view.cameraView - camera view to which new DC data detector will be attachedDCScannerFrameHandlerpublic boolean handleFrame(byte[] frame,
int width,
int height,
int frameOrientation,
android.graphics.Rect finderRect)
PreviewBuffer.FrameHandlerhandleFrame in interface PreviewBuffer.FrameHandlerframe - image in NV21 formatwidth - width of the imageheight - height of the imageframeOrientation - orientation of the image (in degrees)finderRect - finder overlay areatrue if frame should be considered as "intercepted", i.e. no further
processing should be performed on it. false to allow other frame handlers to
process this frame.public void addResultHandler(DCScannerFrameHandler.ResultHandler handler)
Results are coming on the worker thread. Don't forget to move execution to main thread before updating UI.
handler - handler to register. Must not be null. If handler was already
registered, nothing happens.public void removeResultHandler(DCScannerFrameHandler.ResultHandler handler)
handler - handler to unregister. If it was not registered before, nothing happens.public boolean isEnabled()
true if DC data detection is enabled. false if DC data detection
is disabled, i.e. incoming frames are skipped.public void setEnabled(boolean enabled)
enabled - true to enable DC data detection. false to disable
DC data detection.