Example #1
0
 public BitmapSource Apply(BitmapSource image)
 {
     using (var r = image.ToRasterImage())
     {
         new DeskewCommand() { Flags = DeskewCommandFlags.RotateBicubic }.Run(r);
         return r.ToBitmapSource();
     }
 }
Example #2
0
        public BitmapSource Apply(BitmapSource image)
        {
            using (var r = image.ToRasterImage())
            {
                new AutoColorLevelCommand { Type = AutoColorLevelCommandType.Contrast }.Run(r);
                new AutoBinarizeCommand { Factor = 2 }.Run(r);
                new MedianCommand(2).Run(r);

                return r.ToBitmapSource();
            }
        }
        private IEnumerable<RecognitionResult> RecognizeCore(ZoneConfiguration config, BitmapSource bmp)
        {
            using (var page = OcrEngine.CreatePage(bmp.ToRasterImage(), OcrImageSharingMode.AutoDispose))
            {
                var ocrZone = CreateOcrZoneForField(bmp, config);
                page.Zones.Add(ocrZone);
                page.Recognize(null);
                var text = page.GetText(0);

                var confidence = GetConfidence(page);

                var filteredText = config.TextualDataFilter.GetBestMatchFromRaw(text);
                yield return new RecognitionResult(filteredText, confidence);
            }
        }
Example #4
0
 public BitmapSource Apply(BitmapSource image)
 {
     var raster = image.ToRasterImage();
     new AutoColorLevelCommand().Run(raster);
     return raster.ToBitmapSource();
 }
 public BitmapSource Apply(BitmapSource image)
 {
     var raster = image.ToRasterImage();
     new HistogramContrastCommand() { Contrast = 1000 }.Run(raster);
     return raster.ToBitmapSource();
 }