Tyre recognition is still fucked but im going to bed rn

This commit is contained in:
2023-04-07 17:05:50 +02:00
parent 124d141181
commit c515e5ff62
4 changed files with 27 additions and 8 deletions
+3 -3
View File
@@ -85,7 +85,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 * 40f));
Size newWindowSize = new Size(bmp.Height -Convert.ToInt32((float)bmp.Height / 100f * 40f),bmp.Height - Convert.ToInt32((float)bmp.Height / 100f * 50f));
while(currentColor.R <= limitColor.R && currentColor.G <= limitColor.G && currentColor.B <= limitColor.B && currentPosition > 0)
{
@@ -94,8 +94,8 @@ namespace OCR_Decode
}
//Its here to let the new window include a little bit of the right
int CorrectedX = currentPosition - (newWindowSize.Width);
int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 30f);
int CorrectedX = currentPosition - (newWindowSize.Width) - Convert.ToInt32((float)newWindowSize.Width/100f*10f);
int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 50f);
if (CorrectedX <= 0)
return new Rectangle(0,0,newWindowSize.Width,newWindowSize.Height);
+13 -1
View File
@@ -48,11 +48,23 @@ namespace OCR_Decode
result = Dilatation(result, 1);
break;
case WindowType.Tyre:
//result = Tresholding(result, 200);
result = RemoveBG(result);
result = Grayscale(result);
result = InvertColors(result);
//result = Tresholding(result,80);
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;
+1 -1
View File
@@ -217,7 +217,7 @@ namespace OCR_Decode
case 4:
//Tyres
Tyre tyre = (Tyre)objects[objId];
result += "Tyre : " + tyre.Coumpound + " laps with the tyre : " + tyre.NumberOfLaps + " ";
result += "Uses " + tyre.Coumpound + " tyre for " + tyre.NumberOfLaps + " laps";
break;
case 5:
//Name
+8 -1
View File
@@ -171,8 +171,15 @@ 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");
}
else
{
enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + result +".png");
}
enhancedImage.Save(Reader.DEBUG_DUMP_FOLDER + Regex.Replace(result, "[^0-9A-Za-z]", "") + ".png");
page.Dispose();
return result;