com.abbyy.mobile.rtr

## Interface IRecognitionService

- All Known Subinterfaces:
    IDataCaptureService, IImageCaptureService, ITextCaptureService

      public interface IRecognitionService

  A background recognition service interface.

  How to use:

  1. A single instance of `RecognitionService` should be created per application (on the UI thread).
  2. Change the recognition language(s) if required (English by default).
  3. Call `start` when the camera is configured and ready (preferred frame size is 720x1080).
  4. On each call to the `Callback.onRequestLatestFrame` method, provide a current video frame by calling `submitRequestedFrame`.
  5. The processing results will be returned through the `onFrameProcessed` method (called on the UI thread).
  6. Call `stop` when pausing application or when done.

- - ### Nested Class Summary

    Nested Classes
    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.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    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(byte[] buffer)` Submits a video frame
    `void` | `submitFrame(android.media.Image image)` Submits a video frame
    `void` | `submitRequestedFrame(byte[] buffer)` Submits the video frame requested through the `Callback.onRequestLatestFrame` method.

- - ### Method Detail

    - #### start

          void start(int width,
                     int height,
                     int orientation,
                     android.graphics.Rect areaOfInterest)

      Starts the processing.
      Parameters:
        `width` - the width of the video frame
        `height` - the height of the video frame
        `orientation` - 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)

    - #### submitRequestedFrame

          void submitRequestedFrame(byte[] buffer)

      Submits the video frame requested through the `Callback.onRequestLatestFrame` method.
      Parameters:
        `buffer` - the buffer filled with image data for the latest frame

    - #### submitFrame

          void submitFrame(byte[] buffer)

      Submits a video frame
      Parameters:
        `buffer` - the buffer filled with image data for the latest frame

    - #### submitFrame

          void submitFrame(android.media.Image image)

      Submits a video frame
      Parameters:
        `image` - the image object produced by ImageReader (only YUV420_888 is supported currently)

    - #### stop

          void stop()

      Stops processing and releases the resources used by the recognition service.

    - #### setAreaOfInterest

          void setAreaOfInterest(android.graphics.Rect areaOfInterest)

      Sets the area on the frame where the text is to be found.

      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.

      Parameters:
        `areaOfInterest` - the rectangle specifying the area of interest

    - #### setDebugLog

          void setDebugLog(IRecognitionService.DebugLog debugLog)

      Attaches a callback for collecting debug data.

      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.

      Parameters:
        `debugLog` - the object implementing the `IRecognitionService.DebugLog` interface

    - #### getExtendedSettings

          IRecognitionService.ExtendedSettings getExtendedSettings()

      Extended service configuration settings. Settings for advanced users. Not used in typical scenarios
      Returns:
        extended service configuration settings