Lap times are fucked once again

This commit is contained in:
2023-04-05 17:02:11 +02:00
parent 3271580a1e
commit 31074428b3
4 changed files with 22 additions and 7 deletions
+4 -3
View File
@@ -59,10 +59,11 @@ namespace OCR_Decode
}
public static int GetTimeFromPng(Bitmap wImage)
{
//returns milliseconds
string rawResult = "";
int result = 0;
Engine.SetVariable("tessedit_char_whitelist", "0123456789:.");
Bitmap enhancedImage = new OcrImage(wImage).Enhance();
var tessImage = Pix.LoadFromMemory(ImageToByte(enhancedImage));
@@ -94,10 +95,10 @@ namespace OCR_Decode
//Removes all non digit chars except for the important ones
//We will need to change this when trying to see the Leader and Lap texts
string cleanedResult = Regex.Replace(rawResult, "[^0-9.:]", "");
//string cleanedResult = Regex.Replace(rawResult, "[^0-9.:]", "");
//Splits into minuts seconds miliseconds
rawNumbers = cleanedResult.Split('.', ':').ToList<string>();
rawNumbers = rawResult.Split('.', ':').ToList<string>();
//removes any empty cells (tho this usually sign of a really bad OCR implementation tbh will have to be fixed higher in the chian)
rawNumbers.RemoveAll(x => ((string)x) == "");