public class PayFormScannerFrameHandler extends java.lang.Object implements PreviewBuffer.FrameHandler
PayFormScannerFrameHandler.ResultHandler
(addResultHandler(ResultHandler)).
Preview frame considered intercepted if at least one
PayFormScannerFrameHandler.ResultHandler returns true from
PayFormScannerFrameHandler.ResultHandler.handleResult(DetectionResult)
PreviewBuffer| Modifier and Type | Class and Description |
|---|---|
static interface |
PayFormScannerFrameHandler.ResultHandler
Continuously notified about pay form detection results.
|
| Constructor and Description |
|---|
PayFormScannerFrameHandler(android.content.Context context,
PayFormScanner payFormScanner) |
| Modifier and Type | Method and Description |
|---|---|
void |
addResultHandler(PayFormScannerFrameHandler.ResultHandler handler)
Registers result handler which will be notified about pay form detection results.
|
static PayFormScannerFrameHandler |
attach(ScanbotCameraView cameraView,
PayFormScanner payFormScanner)
Convenience method for creating new
PayFormScannerFrameHandler and adding it
as PreviewBuffer.FrameHandler to given camera view. |
boolean |
handleFrame(byte[] frame,
int width,
int height,
int frameOrientation)
Invoked for every new camera preview frame
|
boolean |
isEnabled() |
void |
removeResultHandler(PayFormScannerFrameHandler.ResultHandler handler)
Unregisters handler.
|
void |
setEnabled(boolean enabled) |
public PayFormScannerFrameHandler(android.content.Context context,
PayFormScanner payFormScanner)
public static PayFormScannerFrameHandler attach(ScanbotCameraView cameraView, PayFormScanner payFormScanner)
PayFormScannerFrameHandler and adding it
as PreviewBuffer.FrameHandler to given camera view.cameraView - camera view to which new pay form detector will be attachedPayFormScannerFrameHandlerpublic boolean handleFrame(byte[] frame,
int width,
int height,
int frameOrientation)
PreviewBuffer.FrameHandlerhandleFrame in interface PreviewBuffer.FrameHandlerframe - image in NV21 formatwidth - width of the imageheight - height of the imageframeOrientation - orientation of the image (in degrees)true 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(PayFormScannerFrameHandler.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(PayFormScannerFrameHandler.ResultHandler handler)
handler - handler to unregister. If it was not registered before, nothing happens.public boolean isEnabled()
true if pay form detection is enabled. false if pay form detection
is disabled, i.e. incoming frames are skipped.public void setEnabled(boolean enabled)
enabled - true to enable pay form detection. false to disable
pay form detection.