...
Info |
---|
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. |
Copy the the .ale file to the folder app/src/main/assets of your app.
Check if there is a folder app/src/main/trained_models. If it does not exist, create this folder.
Copy the .any file to the newly created folder app/src/main/trained_models.
Add the following statements to your Android activity:
Code Block ... 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);