From dbda3d3788d2740c4e6adf109167a9306e655399 Mon Sep 17 00:00:00 2001 From: maxluli Date: Thu, 13 Apr 2023 06:37:33 +0200 Subject: [PATCH] LapTime recognition has improved a lot --- OCR_Decode/OcrImage.cs | 6 +++--- OCR_Decode/Window.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OCR_Decode/OcrImage.cs b/OCR_Decode/OcrImage.cs index adbcb22..1c0e723 100644 --- a/OCR_Decode/OcrImage.cs +++ b/OCR_Decode/OcrImage.cs @@ -34,11 +34,11 @@ namespace OCR_Decode switch (type) { case WindowType.LapTime: - result = Grayscale(result); - result = InvertColors(result); - result = Tresholding(result, 165); + result = Tresholding(result, 185); result = Resize(result); result = Resize(result); + result = Dilatation(result,1); + result = Erode(result,1); break; case WindowType.Text: result = Grayscale(result); diff --git a/OCR_Decode/Window.cs b/OCR_Decode/Window.cs index 41bbdce..a7ce922 100644 --- a/OCR_Decode/Window.cs +++ b/OCR_Decode/Window.cs @@ -103,7 +103,7 @@ namespace OCR_Decode } while (iter.Next(PageIteratorLevel.Word)); } - //enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + Regex.Replace(rawResult, "[^0-9A-Za-z]", "") + ".png"); + enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + Regex.Replace(rawResult, "[^0-9A-Za-z]", "") + ".png"); List rawNumbers; @@ -170,7 +170,7 @@ namespace OCR_Decode result += iter.GetText(PageIteratorLevel.Word); } while (iter.Next(PageIteratorLevel.Word)); } - /* + if (allowedChars.Contains("S")) { enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + "Tyre" + result +".png"); @@ -179,7 +179,7 @@ namespace OCR_Decode { enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + result +".png"); } - */ + page.Dispose(); return result; }