protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); SetContentView(Resource.Layout.OCRActivity); InitLicensePlateResultView(); scanView = FindViewById <AnylineOcrScanView>(Resource.Id.ocr_scan_view); scanView.SetConfigFromAsset("LicensePlateConfig.json"); /*scanView.CopyTrainedData("tessdata/GL-Nummernschild-Mtl7_uml.traineddata", "8ea050e8f22ba7471df7e18c310430d8"); * scanView.CopyTrainedData("tessdata/Arial.traineddata", "9a5555eb6ac51c83cbb76d238028c485"); * scanView.CopyTrainedData("tessdata/Alte.traineddata", "f52e3822cdd5423758ba19ed75b0cc32");*/ scanView.CopyTrainedData("tessdata/GL-Nummernschild-Mtl7_uml.traineddata", "8ea050e8f22ba7471df7e18c310430d8"); scanView.CopyTrainedData("tessdata/Arial.traineddata", "9a5555eb6ac51c83cbb76d238028c485"); scanView.CopyTrainedData("tessdata/Alte.traineddata", "f52e3822cdd5423758ba19ed75b0cc32"); scanView.CopyTrainedData("tessdata/deu.traineddata", "2d5190b9b62e28fa6d17b728ca195776"); SetOcrConfig(scanView); 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) { Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); base.OnCreate(bundle); 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 _scanView.FocusConfig = new FocusConfig.Builder() .SetDefaultMode(Camera.Parameters.FocusModeContinuousVideo) .SetEnableFocusOnTouch(true) // enable focus on touch functionality .Build(); _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); }; }
private static void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for License Plates AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); anylineOcrConfig.CustomCmdFile = "license_plates.ale"; scanView.SetAnylineOcrConfig(anylineOcrConfig); }
private static void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for Driver Licenses AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); anylineOcrConfig.CustomCmdFile = "anyline_austrian_driver_license.ale"; anylineOcrConfig.SetLanguages("tessdata/eng_no_dict.traineddata", "tessdata/deu.traineddata"); scanView.SetAnylineOcrConfig(anylineOcrConfig); }
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); }; }
private void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for IBANs AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); // use the line mode (line length and font may vary) anylineOcrConfig.SetScanMode(AnylineOcrConfig.ScanMode.Auto); // SetTesseractLanguages is obsolete as of 3.20. Use SetLanguages instead //anylineOcrConfig.SetTesseractLanguages("anyline_capitals"); anylineOcrConfig.SetLanguages("tessdata/anyline_capitals.traineddata"); // allow only capital letters and numbers anylineOcrConfig.CharWhitelist = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; // a simple regex for a basic validation of the IBAN, results that don't match this, will not be returned // (full validation is more complex, as different countries have different formats) anylineOcrConfig.ValidationRegex = "[A-Z0-9]{8}$"; /* * * // since we use the new OCR auto mode, we don't need to set these parameters anymore! * * // set the height range the text can have * anylineOcrConfig.MinCharHeight = 45; * anylineOcrConfig.MaxCharHeight = 85; * * // The minimum confidence required to return a result, a value between 0 and 100. * // (higher confidence means less likely to get a wrong result, but may be slower to get a result) * anylineOcrConfig.MinConfidence = 85; * * // removes small contours (helpful in this case as no letters with small artifacts are allowed, like iצה�) * anylineOcrConfig.RemoveSmallContours = true; * * // Experimental parameter to set the minimum sharpness (value between 0-100; 0 to turn sharpness detection off) * // The goal of the minimum sharpness is to avoid a time consuming ocr step, * // if the image is blurry and good results are therefore not likely. * anylineOcrConfig.MinSharpness = 60; * * // scan white text on black backgroundd * anylineOcrConfig.IsBrightTextOnDark = true; */ // set the ocr config scanView.SetAnylineOcrConfig(anylineOcrConfig); }
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); }; }
private void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for IBANs AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); // use the auto mode anylineOcrConfig.SetScanMode(AnylineOcrConfig.ScanMode.Auto); // set the languages used for OCR anylineOcrConfig.SetTesseractLanguages("eng_no_dict", "deu"); // allow only capital letters and numbers anylineOcrConfig.CharWhitelist = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; // a simple regex for a basic validation of the IBAN, results that don't match this, will not be returned // (full validation is more complex, as different countries have different formats) anylineOcrConfig.ValidationRegex = "^[A-Z]{2}([0-9A-Z]\\s*){13,32}$"; /* * * // since we use the new OCR auto mode, we don't need to set these parameters anymore! * * // set the height range the text can have * anylineOcrConfig.MinCharHeight = 20; //note: if you set this too low, it tries to find all the small letters too * anylineOcrConfig.MaxCharHeight = 60; * * // The minimum confidence required to return a result, a value between 0 and 100. * // (higher confidence means less likely to get a wrong result, but may be slower to get a result) * anylineOcrConfig.MinConfidence = 65; * * // removes small contours (helpful in this case as no letters with small artifacts are allowed, like iצה�) * anylineOcrConfig.RemoveSmallContours = true; * * // Experimental parameter to set the minimum sharpness (value between 0-100; 0 to turn sharpness detection off) * // The goal of the minimum sharpness is to avoid a time consuming ocr step, * // if the image is blurry and good results are therefore not likely. * anylineOcrConfig.MinSharpness = 66; */ // set the ocr config scanView.SetAnylineOcrConfig(anylineOcrConfig); }
private static void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for IBANs AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); anylineOcrConfig.SetScanMode(AnylineOcrConfig.ScanMode.Grid); anylineOcrConfig.SetTesseractLanguages("bottlecap"); anylineOcrConfig.CharWhitelist = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; anylineOcrConfig.MinCharHeight = 14; anylineOcrConfig.MaxCharHeight = 65; anylineOcrConfig.MinConfidence = 75; anylineOcrConfig.ValidationRegex = "^[0-9A-Z]{3}\n[0-9A-Z]{3}\n[0-9A-Z]{3}"; anylineOcrConfig.CharCountX = 3; anylineOcrConfig.CharCountY = 3; anylineOcrConfig.CharPaddingXFactor = .3; anylineOcrConfig.CharPaddingYFactor = .5; anylineOcrConfig.IsBrightTextOnDark = true; scanView.SetAnylineOcrConfig(anylineOcrConfig); }