private string ExtractBestTextCandidate(BitmapSource bitmap, ITextualDataFilter filter, Symbology symbology) { var page = Engine.Recognize(bitmap, RecognitionConfiguration.FromSingleImage(bitmap, filter, symbology)); var zone = page.RecognizedZones.First(); return zone.RecognitionResult.Text; }
private string ExtractBestTextCandidate(IImage bitmap, ITextualDataFilter filter, Symbology symbology) { var page = Engine.Recognize(bitmap, RecognitionConfiguration.FromSingleImage(bitmap, filter, symbology)); var zone = page.RecognizedZones.First(); return(zone.RecognitionResult.Text); }
public string Extract(BitmapSource bitmap, ITextualDataFilter filter, Symbology symbology) { var sut = GetSut(); var recognizedPage = sut.Recognize(bitmap, RecognitionConfiguration.FromSingleImage(bitmap, filter, symbology)); var uniqueZone = recognizedPage.RecognizedZones.First(); return uniqueZone.RecognitionResult.Text; }
public string Extract(IImage bitmap, ITextualDataFilter filter, Symbology symbology) { var sut = GetSut(); var recognizedPage = sut.Recognize(bitmap, RecognitionConfiguration.FromSingleImage(bitmap, filter, symbology)); var uniqueZone = recognizedPage.RecognizedZones.First(); return uniqueZone.RecognitionResult.Text; }
public static ZoneConfiguration FromSingleImage(IImage bitmapSource, ITextualDataFilter dataFilter, Symbology symbology) { var bounds = new Rect(0, 0, bitmapSource.Width, bitmapSource.Height); return(new ZoneConfiguration() { Bounds = bounds, TextualDataFilter = dataFilter, Id = "", Symbology = symbology }); }
protected string ExtractBestTextCandidate(BitmapSource bitmap, ITextualDataFilter filter, Symbology symbology) { var bounds = new Rect(0, 0, bitmap.Width, bitmap.Height); var zoneConfiguration = new ZoneConfiguration {Bounds = bounds, TextualDataFilter = filter, Id = "", Symbology = symbology}; var recognitions = Engine.Recognize(bitmap, zoneConfiguration); var selector = OpticalResultSelector.ChooseBest(recognitions, zoneConfiguration); return selector?.Text; }
protected string ExtractBestTextCandidate(IImage bitmap, ITextualDataFilter filter, Symbology symbology) { var bounds = new Rect(0, 0, bitmap.Width, bitmap.Height); var zoneConfiguration = new ZoneConfiguration { Bounds = bounds, TextualDataFilter = filter, Id = "", Symbology = symbology }; var recognitions = Engine.Recognize(bitmap, zoneConfiguration); var selector = OpticalResultSelector.ChooseBest(recognitions, zoneConfiguration); return(selector?.Text); }
protected void AssertSuccessRate(IEnumerable<TestCase> testCases, ITextualDataFilter stringFilter, double minimum, Symbology symbology) { var cases = testCases as IList<TestCase> ?? testCases.ToList(); var testExecutions = (from c in cases let result = OutputResult(ExtractBestTextCandidate(c.Bitmap, stringFilter, symbology), c) select new {Result = result, Expected = c.Expected, Success = result == c.Expected}).ToList(); var success = testExecutions.Count(testCase => testCase.Expected == testCase.Result); var total = testExecutions.Count; var d = (double) success/total; output.WriteLine($"Success Ratio: {d}"); Assert.True(d >= minimum); }
protected void AssertSuccessRate(IEnumerable <TestCase> testCases, ITextualDataFilter stringFilter, double minimum, Symbology symbology) { var cases = testCases as IList <TestCase> ?? testCases.ToList(); var testExecutions = (from c in cases let result = OutputResult(ExtractBestTextCandidate(c.Bitmap, stringFilter, symbology), c) select new { Result = result, Expected = c.Expected, Success = result == c.Expected }).ToList(); var success = testExecutions.Count(testCase => testCase.Expected == testCase.Result); var total = testExecutions.Count; var d = (double)success / total; output.WriteLine($"Success Ratio: {d}. Expected: {minimum}"); Assert.True(d >= minimum); }
public static ZoneConfiguration FromSingleImage(BitmapSource bitmapSource, ITextualDataFilter dataFilter, Symbology symbology) { var bounds = new Rect(0, 0, bitmapSource.Width, bitmapSource.Height); return new ZoneConfiguration() { Bounds = bounds, TextualDataFilter = dataFilter, Id = "", Symbology = symbology }; }