Tyre recognition is still fucked but im going to bed rn
This commit is contained in:
@@ -85,7 +85,7 @@ namespace OCR_Decode
|
|||||||
Color limitColor = Color.FromArgb(0x50,0x50,0x50);
|
Color limitColor = Color.FromArgb(0x50,0x50,0x50);
|
||||||
Color currentColor = Color.FromArgb(0,0,0);
|
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)
|
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
|
//Its here to let the new window include a little bit of the right
|
||||||
int CorrectedX = currentPosition - (newWindowSize.Width);
|
int CorrectedX = currentPosition - (newWindowSize.Width) - Convert.ToInt32((float)newWindowSize.Width/100f*10f);
|
||||||
int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 30f);
|
int CorrectedY = Convert.ToInt32((float)newWindowSize.Height / 100f * 50f);
|
||||||
if (CorrectedX <= 0)
|
if (CorrectedX <= 0)
|
||||||
return new Rectangle(0,0,newWindowSize.Width,newWindowSize.Height);
|
return new Rectangle(0,0,newWindowSize.Width,newWindowSize.Height);
|
||||||
|
|
||||||
|
|||||||
+14
-2
@@ -48,14 +48,26 @@ namespace OCR_Decode
|
|||||||
result = Dilatation(result, 1);
|
result = Dilatation(result, 1);
|
||||||
break;
|
break;
|
||||||
case WindowType.Tyre:
|
case WindowType.Tyre:
|
||||||
//result = Tresholding(result, 200);
|
|
||||||
result = RemoveBG(result);
|
result = RemoveBG(result);
|
||||||
result = Grayscale(result);
|
result = Grayscale(result);
|
||||||
result = InvertColors(result);
|
result = InvertColors(result);
|
||||||
|
//result = Tresholding(result,80);
|
||||||
result = Resize(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 = Resize(result);
|
||||||
//result = Dilatation(result,1);
|
//result = Dilatation(result,1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
result = Tresholding(result, 165);
|
result = Tresholding(result, 165);
|
||||||
result = Resize(result);
|
result = Resize(result);
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ namespace OCR_Decode
|
|||||||
case 4:
|
case 4:
|
||||||
//Tyres
|
//Tyres
|
||||||
Tyre tyre = (Tyre)objects[objId];
|
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;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//Name
|
//Name
|
||||||
|
|||||||
@@ -171,8 +171,15 @@ namespace OCR_Decode
|
|||||||
result += iter.GetText(PageIteratorLevel.Word);
|
result += iter.GetText(PageIteratorLevel.Word);
|
||||||
} while (iter.Next(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();
|
page.Dispose();
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user