Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

You might receive custom files of type .any and .ale from Anyline which are tailored to your specific requirements. Our custom format .ale and .any files are encrypted resource files containing the instructions for processing your custom use.

There are basically 2 ways to configure custom .any- and -ale-files. The first one is via code (using methods in an Android activity), the second one is declarative by extending the View Configuration.

This knowledge base article gives step-by-step instructions showing the configuration in an Android activity.

The example shown below describes an OCR configuration. Custom .any- and .ale files can be implemented for other use cases as well. In this case please use the corresponding Anyline Config classes.

  1. Copy the the .ale file to the folder app/src/main/assets of your app.

  2. Check if there is a folder app/src/main/trained_models. If it does not exist, create this folder.

  3. Copy the .any file to the newly created folder app/src/main/trained_models.

  4. Add the following statements to your Android activity:

    ...
    private ScanView scanView;
    private OcrScanViewPlugin scanViewPlugin;
    io.anyline.plugin.ocr.AnylineOcrConfig anylineOcrConfig;
    ...
    
    scanView = findViewById(R.id.scan_view);
    ...
    // this is one way to set the view configuration file:
    try {
        scanView.init("your_view_configuration_file.json");
    } catch (Exception e) {
        e.printStackTrace();
    }    
    ...
    anylineOcrConfig = new AnylineOcrConfig();
    ...
    anylineOcrConfig.setCustomCmdFile("your_custom_file.ale");
    anylineOcrConfig.setModel("your_custom_file.any");
    // add further config settings
    ...
    scanViewPlugin = new OcrScanViewPlugin(getApplicationContext(), 
            anylineOcrConfig, scanView.getScanViewPluginConfig(), "OCR");
    ...  
    scanView.setScanViewPlugin(scanViewPlugin);
      


  • No labels