From f6fdc8b150003733db34afb6e2bff5f587ffa1d1 Mon Sep 17 00:00:00 2001 From: maxluli Date: Mon, 10 Apr 2023 09:37:19 +0200 Subject: [PATCH] Letters are not recognized way better --- OCR_Decode/DriverTyresWindow.cs | 6 +++--- OCR_Decode/OcrImage.cs | 23 +---------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/OCR_Decode/DriverTyresWindow.cs b/OCR_Decode/DriverTyresWindow.cs index 90196eb..81a5b93 100644 --- a/OCR_Decode/DriverTyresWindow.cs +++ b/OCR_Decode/DriverTyresWindow.cs @@ -90,7 +90,7 @@ namespace OCR_Decode Color limitColor = Color.FromArgb(0x50,0x50,0x50); Color currentColor = Color.FromArgb(0,0,0); - Size newWindowSize = new Size(bmp.Height -Convert.ToInt32((float)bmp.Height / 100f * 40f),bmp.Height - Convert.ToInt32((float)bmp.Height / 100f * 50f)); + Size newWindowSize = new Size(bmp.Height -Convert.ToInt32((float)bmp.Height / 100f * 25f),bmp.Height - Convert.ToInt32((float)bmp.Height / 100f * 35f)); while(currentColor.R <= limitColor.R && currentColor.G <= limitColor.G && currentColor.B <= limitColor.B && currentPosition > 0) { @@ -99,8 +99,8 @@ namespace OCR_Decode } //Its here to let the new window include a little bit of the right - int CorrectedX = currentPosition - (newWindowSize.Width) - Convert.ToInt32((float)newWindowSize.Width/100f*10f); - int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 50f); + int CorrectedX = currentPosition - (newWindowSize.Width) + Convert.ToInt32((float)newWindowSize.Width/100f*10f); + int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 35f); if (CorrectedX <= 0) return new Rectangle(0,0,newWindowSize.Width,newWindowSize.Height); diff --git a/OCR_Decode/OcrImage.cs b/OCR_Decode/OcrImage.cs index 55594bb..adbcb22 100644 --- a/OCR_Decode/OcrImage.cs +++ b/OCR_Decode/OcrImage.cs @@ -48,32 +48,12 @@ namespace OCR_Decode result = Dilatation(result, 1); break; case WindowType.Tyre: - + //result = RemoveBG(result); result = RemoveUseless(result); result = Resize(result); result = Resize(result); result = Resize(result); result = Dilatation(result, 1); - - //result = Grayscale(result); - //result = Tresholding(result,80); - //result = InvertColors(result); - //result = Resize(result); - //result = Dilatation(result, 1); - //result = Resize(result); - //result = Dilatation(result,1); - - //result = Erode(result,1); - - //result = Resize(result); - - //result = Dilatation(result, 1); - - //result = Dilatation(result, 1); - //result = InvertColors(result); - //result = Resize(result); - //result = Resize(result); - //result = Dilatation(result,1); break; default: result = Tresholding(result, 165); @@ -82,7 +62,6 @@ namespace OCR_Decode result = Erode(result, 1); break; } - //result = Dilatation(result, 1); return result; }