示例#1
0
 public ReceiptService()
 {
     _imageFormating = new ImageFormating();
     _ocr            = new EmguOcr();
     _dataConverter  = new DataConverter();
     _dataManager    = new ItemManager();
 }
示例#2
0
 public ReceiptService(IImageFormating imageFormating, IOcr ocr, IDataConverter dataConverter, IItemManager dataManager)
 {
     _imageFormating = imageFormating;
     _ocr            = ocr;
     _dataConverter  = dataConverter;
     _dataManager    = dataManager;
 }
        public DocumentLabBase()
        {
            this.windsorContainer = new WindsorContainer();
            this.windsorContainer.Install(FromAssembly.This());

            this.ocr                 = windsorContainer.Resolve <IOcr>();
            this.imageProcessor      = windsorContainer.Resolve <IImageProcessor>();
            this.pageAnalyzer        = windsorContainer.Resolve <IPageAnalyzer>();
            this.pageTrimmer         = windsorContainer.Resolve <IPageTrimmer>();
            this.documentInterpreter = new Interpreter();
        }
示例#4
0
        public OcrTranslateOverlay(ITranslate translate, IOverlay internalOverlay, IScreenImageProvider screenImageProvider, IOcr ocr,
                                   IOcrTranslateOverlayConfiguration ocrTranslateOverlayConfiguration, ILogger <OcrTranslateOverlay> log)
        {
            _translate           = translate;
            _internalOverlay     = internalOverlay;
            _screenImageProvider = screenImageProvider;
            _ocr = ocr;
            _ocrTranslateOverlayConfiguration = ocrTranslateOverlayConfiguration;
            _log = log;

            if (_ocrTranslateOverlayConfiguration.CaptureArea == null)
            {
                throw new ArgumentNullException(nameof(_ocrTranslateOverlayConfiguration.CaptureArea), "Screen capture area was not configured");
            }
        }
示例#5
0
 public OcrQuotaGuard(IOcr ocrImplementation, IQuotaRepository quotaRepository, IEnumerable <IQuotaConfig> configs) : base(quotaRepository, configs, QuotaType.GoogleOcr)
 {
     _ocrImplementation = ocrImplementation;
 }
示例#6
0
 public OcrDebugCache(IOcr decorated, IOcrConfig configuration)
 {
     _decorated     = decorated;
     _configuration = configuration;
 }
示例#7
0
 public ReceiptMaking(IOcr ocr, IShopDetection shopDetection)
 {
     _ocr           = ocr;
     _shopDetection = shopDetection;
 }
示例#8
0
 public ReceiptMaking()
 {
     _ocr           = new EmguOcr();
     _shopDetection = new ShopDetection();
 }
示例#9
0
 public override void Dispose()
 {
     base.Dispose();
     if (_ocr != null)
     {
         _ocr.Dispose();
         _ocr = null;
     }
     if (_recognitionResultLogger != null)
         Disposer.DisposeObject(_recognitionResultLogger);
 }
示例#10
0
 public ReceiptService(IOcr ocr, IDataConverter dataConverter, IDataManager dataManager)
 {
     _ocr           = ocr;
     _dataConverter = dataConverter;
     _dataManager   = dataManager;
 }
示例#11
0
 private void CreateOcr()
 {
     _ocr = new Ocr.Ocr();
     _ocr.SetEventsHandler(this);
     _ocr.StampTestLevel = _config.Ocr.Stamp.TestLevel;
     _ocr.ModelFilePath = Path.Combine(
         _fileSystemManager.GetDataDirectoryPath(FileType.RuntimeData),
         MODEL_FILE_NAME);
     _ocr.Init();
 }
示例#12
0
 public int GetHalfToneBuffer(IOcr ocr, short side, int x, int y, int height, int width, MemoryBlock image)
 {
     if (!_config.Ocr.GrayAnalysis.Enabled)
         return -1;
     try
     {
         var res = _scannerManager.GetHalftoneBuffer(
             (ScannedSide)side, (short)x, (short)y, (short)width, (short)height, image);
         if (res && _config.DebugImageSaving.Squares)
         {
             var imageDirectoryPath = _fileSystemManager.GetDataDirectoryPath(FileType.ScanningImage);
             long requiredSize = width * height;
             if (ReserveSpaceForImage(requiredSize))
             {
                 var filePathSb = GetImageFileName("SQ");
                 filePathSb.Insert(0, imageDirectoryPath + '/');
                 filePathSb.AppendFormat("_S{0}_X{1}_Y{2}_W{3}_H{4}.tif", side, x, y, width, height);
                 TiffImageHelper.SaveToFile(filePathSb.ToString(), ImageType.Halftone, image, width, height);
             }
         }
         return res ? width * height : -1;
     }
     catch (Exception ex)
     {
         Logger.LogError(Message.RecognizerGetBufferError, ex);
         return -1;
     }
 }
示例#13
0
 public int GetBinaryThreshold(IOcr ocr, short side)
 {
     int res = side == 0
         ? _scannerManager.BinarizationThresholdTop
         : _scannerManager.BinarizationThresholdBottom;
     Logger.LogVerbose(Message.RecognizerBinarizationThreshold, side, res);
     return res;
 }
示例#14
0
 public void Error(IOcr ocr, int errorCode, string message)
 {
     Logger.LogError(Message.RecognizerOcrError, errorCode, message);
 }
示例#15
0
 public OcrCoordinator(IOcr decorated, ISpatialTextConsolidator spatialTextConsolidator, ILogger <OcrCoordinator> logger)
 {
     _decorated = decorated;
     _spatialTextConsolidator = spatialTextConsolidator;
     _logger = logger;
 }
 public OcrService(ISpatialTextConsolidator spatialTextConsolidator, IMachineOcrRepository machineOcrRepository, IOcr ocr)
 {
     _spatialTextConsolidator = spatialTextConsolidator;
     _machineOcrRepository    = machineOcrRepository;
     _ocr = ocr;
 }
示例#17
0
 public void AppendToLog(IOcr ocr, string message)
 {
     Logger.LogVerbose(Message.RecognizerOcrDebug, message);
 }