public void ProcessChar(OcredChar ocredChar, int median, int charPosition) { if (ocrConfig.Mode == DefinitionMode.SplitZones) { double[] computedZonesTop; double[] computedZonesBottom; ocredChar.ComputeSplitZones(out computedZonesTop, out computedZonesBottom); ocredChar.RecognizedChar = charRecognizer.RecognizeCharSplitZones(computedZonesTop, computedZonesBottom, charPosition); } else { double[] computedZones = ocredChar.ComputeZones(); ocredChar.RecognizedChar = charRecognizer.RecognizeChar(computedZones, median, charPosition); } }
public string Initialize(OcrConfiguration ocrConfig, int imageWidth, int imageHeight) { this.ocrConfig = ocrConfig; for (int i = 0; i < ocrConfig.Alignment.CharPositions.Count; i++) { int leftPos = ocrConfig.Alignment.CharPositions[i]; var ocredChar = new OcredChar(i, leftPos, ocrConfig.Alignment.CharWidth, ocrConfig.Alignment.CharHeight); ocredChar.PopulateZones(ocrConfig.Zones); ocredCharsOdd.Add(ocredChar); ocredChar = new OcredChar(i, leftPos, ocrConfig.Alignment.CharWidth, ocrConfig.Alignment.CharHeight); ocredChar.PopulateZones(ocrConfig.Zones); ocredCharsEven.Add(ocredChar); } zoneChecker = new OcrZoneChecker( ocrConfig, ocrConfig.Alignment.Width, ocrConfig.Alignment.Height, ocrConfig.Zones, ocrConfig.Alignment.CharPositions); charRecognizer = new OcrCharRecognizer( ocrConfig.Zones, ocrConfig.CharDefinitions); cameraImage = new CameraImage(); testContext = new StateContext(); generateDebugImages = false; return null; }