How Anyline Works

This section describes the central integration-facing elements of the Anyline SDK and how the components work together to build scanning use-cases in your application.

Read through this section before jumping into the integration of Anyline to get a conceptual understanding of how everything works and what possibilities you have in your use-case.

Basic Information & Concept

The main purpose of the Anyline SDK is to perform OCR (optical character recognition) in order to capture data on-device from the camera in real-time. This data can be used for multiple purposes - such as user guidance & augmentation.

The following image is a depiction of what the user will see when integrating Anyline.

Anyline SDK Phone
  • (1) Cutout

    • A visualized region of interest for scanning

  • (2) Visual Feedback

    • The visual feedback augmented over the text of an object

  • (3) Flash Button

    • A button to adjust the torch, depending on configuration & device capability

There are many variables to consider when integrating Anyline. Some relate to the look & feel of the scanner while others relate to constructing and fine-tuning the scanner itself in order to optimize the quality of the data capture.

To meet these requirements, the SDK consists of multiple components, which can be easily configured.

Components

Here’s a high-level overview of the most important SDK components:

Anyline SDK Architecture
  • ScanView

    • The ScanView is the top UI element, which extends a Windows.UI.Xaml.Controls.Grid and thus can be directly placed in your Page. It is configured with a ScanViewConfig.

  • CutoutView

    • The CutoutView is responsible for rendering any scanning visualization, such as visual feedback and Cutouts. "Cutout" is what we call the region inside the area that shall be scanned. It is configured with a CutoutConfig.

    • This component is not directly accessible via code and only shown here for explanation purposes.

  • CameraView

    • The CameraView is responsible for accessing, starting and rendering the camera preview. It is configured with a CameraConfig.

    • Internally, the camera controls frame broadcasting to any plugin that is connected to the ScanView.

  • FlashView

    • The FlashView takes care of rendering the Flash button and is configured with a FlashConfig.

  • ViewPluginBase

    • The ViewPluginBase is the abstract base class of an element that connects scanning logic with the view logic, hence the name.

    • There are currently two types of view plugins - one for composite scanning and one for single scanning.

  • ScanViewPlugin

    • The ScanViewPlugin is the glue that connects an actual scanner with the view and is configured with a ScanViewPluginConfig.

    • A ScanViewPlugin contains a ScanPlugin and directs data from the view to the scanner and back.

      • The visible cutout gets translated into the ROI (region-of-interest) of the attached ScanPlugin.

      • Certain events from the ScanPlugin are being used to update the views, for example visual feedback and brightness information for the torch.

  • ScanPlugin

    • The ScanPlugin is the scanning element that processes image data and delivers information through events that can be further processed. It is configured with a ScanPluginConfig.

  • ViewPluginComposite

    • The ViewPluginComposite can be used to set up a scanning workflow that consists of multiple different scanners in a parallel or sequential manner.

    • This is useful for capturing different kinds of data at once or within a structured workflow.

Resources, Initialization & Destruction

Most elements are designed to be only constructed with a given configuration and cannot be changed once they are initialized. These elements also implement the IDisposable interface in order to clean up underlying native resources.

  • It is advised to call Dispose() to clean up after the ScanView is not used anymore.

  • It is important to know that once you initialized an element with a configuration, changes to the configuration will not have any effect on the element that you have configured it with! Instead, you have to create a new instance.

    • Since the ScanView needs to provide a default constructor in order to load it in the XAML designer, it is an exception to that case.

Configurations

This is a brief overview of how the configurations work together and what their purpose is:

Anyline SDK Config Hierarchy
  • ScanViewConfig

    • The ScanViewConfig contains the necessary configurations for the ScanView itself.

  • FlashConfig

    • The FlashConfig sets parameters like flash mode & alignment of the flash button.

  • CameraConfig

    • The CameraConfig sets parameters like the resolution and which camera to prefer when the device offers multiple cameras.

  • ScanViewPluginConfig

    • The ScanViewPluginConfig contains all necessary parameters and configurations to set up a ScanViewPlugin.

  • ScanFeedbackConfig

    • The ScanFeedbackConfig determines what kind of feedback to visualize amongst other parameters (like playing a beep-sound or blinking upon a successful scan).

  • CutoutConfig

    • The CutoutConfig lets you set up where to place the Cutout and adjust parameters like it’s size, ratio and color.

  • ScanPluginConfig

    • The ScanPluginConfig serves as a wrapper for the PluginConfig, highlights important parameters like the plugin ID and whether the plugin should stop scanning upon receiving a result.

  • PluginConfig

    • The PluginConfig contains the configurable parameters of all supported scanning capabilities and is used to set and fine-tune what you want to scan.

PluginConfig & PluginResult

The scanning capabilities are designed so that each type of PluginConfig corresponds to the type of PluginResult.

  • Example for scanning TIN numbers:

    • If you set up your scanner with a TinConfig, the scan results that are received contain a TinResult

You can only set up one type of scanner per PluginConfig - If you want to scan multiple different objects, please refer to using a ScanViewPluginComposite or create multiple ScanPlugin instances.