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); }
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); }
private static void SetOcrConfig(AnylineOcrScanView scanView) { //Configure the OCR for IBANs AnylineOcrConfig anylineOcrConfig = new AnylineOcrConfig(); anylineOcrConfig.SetScanMode(AnylineOcrConfig.ScanMode.Grid); // SetTesseractLanguages is obsolete as of 3.20. Use SetLanguages instead //anylineOcrConfig.SetTesseractLanguages("bottlecap"); anylineOcrConfig.SetLanguages("tessdata/bottlecap.traineddata"); 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); }