Added detection of driver positions
This commit is contained in:
@@ -15,7 +15,19 @@ namespace OCR_Decode
|
|||||||
}
|
}
|
||||||
public override object DecodePng()
|
public override object DecodePng()
|
||||||
{
|
{
|
||||||
return 0;
|
string result = GetStringFromPng(true);
|
||||||
|
|
||||||
|
int position;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
position = Convert.ToInt32(result);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
position = -1;
|
||||||
|
WindowImage.Save(Reader.DEBUG_DUMP_FOLDER + "FailedPosition"+".png");
|
||||||
|
}
|
||||||
|
return position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-1
@@ -137,10 +137,20 @@ namespace OCR_Decode
|
|||||||
page.Dispose();
|
page.Dispose();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
protected string GetStringFromPng()
|
protected string GetStringFromPng(bool onlyDigit = false)
|
||||||
{
|
{
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|
||||||
|
if (onlyDigit)
|
||||||
|
{
|
||||||
|
Engine.SetVariable("tessedit_char_whitelist", "0123456789");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Engine.SetVariable("tessedit_char_whitelist", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Bitmap rawData = WindowImage;
|
Bitmap rawData = WindowImage;
|
||||||
Bitmap enhancedImage = new OcrImage(rawData).Enhance();
|
Bitmap enhancedImage = new OcrImage(rawData).Enhance();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user