示例#1
0
        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);
        }
示例#2
0
        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;
        }
示例#3
0
        public void EmptyBitmapGivesEmptyResult()
        {
            var sut = GetSut();
            var numericStringFilter = new NumericStringFilter {
                MinLength = 6, MaxLength = 6
            };
            var bmp            = GetEmptyBitmap();
            var recognizedPage = sut.Recognize(bmp, RecognitionConfiguration.FromSingleImage(bmp, numericStringFilter, Symbology.Barcode));

            var recognitionResult = recognizedPage.RecognizedZones.First().RecognitionResult;

            Assert.Null(recognitionResult.Text);
        }
        public void MemoryTest()
        {
            var sut                 = GetSut();
            var bitmapSource        = LoadImage($"Images\\Barcodes\\Numeric\\802492.jpg");
            var numericStringFilter = new NumericStringFilter {
                MinLength = 6, MaxLength = 6
            };
            var recognizedPage = sut.Recognize(
                bitmapSource,
                RecognitionConfiguration.FromSingleImage(bitmapSource, numericStringFilter, Symbology.Text));


            dotMemory.Check(
                memory =>
            {
                Assert.Equal(0, memory.GetObjects(where => where.Type.Is <OcrPage>()).ObjectsCount);
                Assert.Equal(0, memory.GetObjects(where => where.Type.Is <RasterImage>()).ObjectsCount);
            });
        }