protected override void OnCreate(Bundle bundle)
        {
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            base.OnCreate(bundle);

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            SetContentView(Resource.Layout.OCRActivity);

            _scanView = FindViewById <AnylineOcrScanView>(Resource.Id.ocr_scan_view);

            //set up the voucher code result view
            InitVoucherCodeResultView();

            _scanView.SetConfigFromAsset("VoucherCodeConfig.json");

            _scanView.CopyTrainedData("tessdata/anyline_capitals.traineddata", "cee65c74833eb85e3c31e213b25e72a2");

            SetOcrConfig(_scanView);

            // set the focus config
            FocusConfig focusConfig = new FocusConfig.Builder()
                                      .SetDefaultMode(Camera.Parameters.FocusModeContinuousVideo)
                                      .SetEnableFocusOnTouch(true) // enable focus on touch functionality
                                      .Build();

            _scanView.SetFocusConfig(focusConfig);

            _scanView.InitAnyline(MainActivity.LicenseKey, this);

            _scanView.CameraOpened += (s, e) => { Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height); };
            _scanView.CameraError  += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); };
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            SetTitle(Resource.String.scan_iban);

            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            SetContentView(Resource.Layout.OCRActivity);

            _scanView = FindViewById <AnylineOcrScanView>(Resource.Id.ocr_scan_view);

            //set up the iban result view
            InitIbanResultView();

            _scanView.SetConfigFromAsset("IbanConfig.json");

            // as of 3.20, use AnylineOcrConfig.SetLanguages(...) instead of CopyTraineddata and SetTesseractLanguages
            //_scanView.CopyTrainedData("tessdata/eng_no_dict.traineddata", "d142032d86da1be4dbe22dce2eec18d7");
            //_scanView.CopyTrainedData("tessdata/deu.traineddata", "2d5190b9b62e28fa6d17b728ca195776");

            SetOcrConfig(_scanView);

            // set an individual focus configuration for this example
            FocusConfig focusConfig = new FocusConfig.Builder()
                                      .SetDefaultMode(Camera.Parameters.FocusModeAuto) // set default focus mode to be auto focus
                                      .SetAutoFocusInterval(8000)                      // set an interval of 8 seconds for auto focus
                                      .SetEnableFocusOnTouch(true)                     // enable focus on touch functionality
                                      .SetEnablePhaseAutoFocus(true)                   // enable phase focus for faster focusing on new devices
                                      .SetEnableFocusAreas(true)                       // enable focus areas to coincide with the cutout
                                      .Build();

            _scanView.SetFocusConfig(focusConfig);

            _scanView.SetUseMaxFpsRange(true);

            // set sports scene mode to try and bump up the fps count even more
            _scanView.SetSceneMode(Camera.Parameters.SceneModeSports);

            _scanView.InitAnyline(MainActivity.LicenseKey, this);

            _scanView.CameraOpened += (s, e) => { Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height); };
            _scanView.CameraError  += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); };
        }
Exemple #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            SetTitle(Resource.String.scan_bottlecaps);

            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            SetContentView(Resource.Layout.OCRActivity);

            InitBottlecapResultView();

            _scanView = FindViewById <AnylineOcrScanView>(Resource.Id.ocr_scan_view);

            _scanView.SetConfigFromAsset("BottlecapViewConfig.json");

            _scanView.CopyTrainedData("tessdata/bottlecap.traineddata", "a8224bfaf4d2085f5b0de7018dee29eb");

            SetOcrConfig(_scanView);

            // set an individual focus configuration for this example
            FocusConfig focusConfig = new FocusConfig.Builder()
                                      .SetDefaultMode(Camera.Parameters.FocusModeAuto) // set default focus mode to be auto focus
                                      .SetAutoFocusInterval(8000)                      // set an interval of 8 seconds for auto focus
                                      .SetEnableFocusOnTouch(true)                     // enable focus on touch functionality
                                      .SetEnablePhaseAutoFocus(true)                   // enable phase focus for faster focusing on new devices
                                      .SetEnableFocusAreas(true)                       // enable focus areas to coincide with the cutout
                                      .Build();

            _scanView.SetFocusConfig(focusConfig);

            _scanView.SetUseMaxFpsRange(true);

            // set sports scene mode to try and bump up the fps count even more
            _scanView.SetSceneMode(Camera.Parameters.SceneModeSports);

            _scanView.InitAnyline(MainActivity.LicenseKey, this);

            _scanView.CameraOpened += (s, e) => { Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height); };
            _scanView.CameraError  += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); };
        }