public interface IRecognitionService
How to use:
RecognitionService
should be created per application (on the UI thread).start
when the camera is configured and ready (preferred frame size is 720x1080).Callback.onRequestLatestFrame
method, provide a current video frame by calling submitRequestedFrame
.onFrameProcessed
method (called on the UI thread).stop
when pausing application or when done.Modifier and Type | Interface and Description |
---|---|
static interface |
IRecognitionService.Callback
A callback interface to interact with the recognition service: input the data and obtain the results.
|
static interface |
IRecognitionService.DebugLog
A callback interface for collecting debug data.
|
static interface |
IRecognitionService.ExtendedSettings
Extended service configuration settings.
|
static class |
IRecognitionService.ResultStabilityStatus
Stability of the result.
|
static class |
IRecognitionService.Warning
A warning that occurred during processing.
|
Modifier and Type | Method and Description |
---|---|
IRecognitionService.ExtendedSettings |
getExtendedSettings()
Extended service configuration settings.
|
void |
setAreaOfInterest(android.graphics.Rect areaOfInterest)
Sets the area on the frame where the text is to be found.
|
void |
setDebugLog(IRecognitionService.DebugLog debugLog)
Attaches a callback for collecting debug data.
|
void |
start(int width,
int height,
int orientation,
android.graphics.Rect areaOfInterest)
Starts the processing.
|
void |
stop()
Stops processing and releases the resources used by the recognition service.
|
void |
submitFrame(android.media.Image image)
Submits a video frame
|
void |
submitRequestedFrame(byte[] buffer)
Submits the video frame requested through
the
Callback.onRequestLatestFrame method. |
void start(int width, int height, int orientation, android.graphics.Rect areaOfInterest)
width
- the width of the video frameheight
- the height of the video frameorientation
- the orientation of the frame in degrees. Should be a multiple of 90.areaOfInterest
- the area of interest on the frame (for example, it may be selected by the user or highlighted in
your application interface)void submitRequestedFrame(byte[] buffer)
Callback.onRequestLatestFrame
method.buffer
- the buffer filled with image data for the latest framevoid submitFrame(android.media.Image image)
image
- the image object produced by ImageReader (only YUV420_888 is supported currently)void stop()
void setAreaOfInterest(android.graphics.Rect areaOfInterest)
By default, no area of interest is selected. The size of the area of interest affects performance and the speed of convergence of the result. The best result is achieved when the area of interest does not touch the boundaries of the frame but has a margin of at least half the size of a typical printed character.
areaOfInterest
- the rectangle specifying the area of interestvoid setDebugLog(IRecognitionService.DebugLog debugLog)
Used for collecting image data for debugging and tuning the Real-Time Recognition SDK library. The actual collecting and storing is implemented outside the library.
debugLog
- the object implementing the IRecognitionService.DebugLog
interfaceIRecognitionService.ExtendedSettings getExtendedSettings()