Lap times are fucked once again
This commit is contained in:
Generated
+1
@@ -71,6 +71,7 @@
|
||||
this.btnNext.TabIndex = 3;
|
||||
this.btnNext.Text = "Next";
|
||||
this.btnNext.UseVisualStyleBackColor = true;
|
||||
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
|
||||
//
|
||||
// lblFileName
|
||||
//
|
||||
|
||||
+15
-2
@@ -15,6 +15,7 @@ namespace OCR_Decode
|
||||
//This should be configurable
|
||||
const string CONFIG_FILE = @"C:\Users\Moi\Desktop\imgDump\Dump1.json";
|
||||
const string TEMPORARY_IMAGE_FOLDER = @"C:\Users\Moi\Pictures\SeleniumScreens\DataSetHighRes\";
|
||||
int pageNmbr = 9;
|
||||
Reader Reader;
|
||||
public Form1()
|
||||
{
|
||||
@@ -24,9 +25,21 @@ namespace OCR_Decode
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
Reader = new Reader(CONFIG_FILE,TEMPORARY_IMAGE_FOLDER);
|
||||
pbxImage.Image = Reader.Draw(9);
|
||||
RefreshUi();
|
||||
}
|
||||
private void RefreshUi()
|
||||
{
|
||||
tbxResult.Text = "";
|
||||
|
||||
tbxResult.Text = Reader.Decode(9);
|
||||
pbxImage.Image = Reader.Draw(pageNmbr);
|
||||
|
||||
tbxResult.Text = Reader.Decode(pageNmbr);
|
||||
}
|
||||
|
||||
private void btnNext_Click(object sender, EventArgs e)
|
||||
{
|
||||
pageNmbr++;
|
||||
RefreshUi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ namespace OCR_Decode
|
||||
Bitmap result = (Bitmap)InputImage.Clone();
|
||||
result = Grayscale(result);
|
||||
result = InvertColors(result);
|
||||
result = Tresholding(result, 100);
|
||||
result = Resize(result);
|
||||
//result = Resize(result);
|
||||
result = Tresholding(result, 165);
|
||||
result = Dilatation(result, 1);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -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) == "");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user