Added diagnostic tools

This commit is contained in:
2023-04-10 10:21:21 +02:00
parent f6fdc8b150
commit 4d03070849
+22 -2
View File
@@ -7,6 +7,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace OCR_Decode
{
@@ -17,6 +18,8 @@ namespace OCR_Decode
const string TEMPORARY_IMAGE_FOLDER = @"C:\Users\Moi\Pictures\SeleniumScreens\DataSetHighRes\";
int pageNmbr = 82;
Reader Reader;
Stopwatch stopWatch = new Stopwatch();
int LoadMS = 0;
public Form1()
{
InitializeComponent();
@@ -24,17 +27,34 @@ namespace OCR_Decode
private void Form1_Load(object sender, EventArgs e)
{
stopWatch.Start();
Reader = new Reader(CONFIG_FILE,TEMPORARY_IMAGE_FOLDER);
stopWatch.Stop();
LoadMS = (int)stopWatch.ElapsedMilliseconds;
RefreshUi();
}
private void RefreshUi()
{
tbxResult.Text = "";
stopWatch.Restart();
pbxImage.Image = Reader.Draw(pageNmbr);
stopWatch.Stop();
int DrawMS = (int)stopWatch.ElapsedMilliseconds;
stopWatch.Restart();
tbxResult.Text = Reader.Decode(pageNmbr);
stopWatch.Stop();
int OcrMS = (int)stopWatch.ElapsedMilliseconds;
MessageBox.Show(
"Loading took : " + Reader.ConvertMsToTime(LoadMS) +
" Image splitting took : " + Reader.ConvertMsToTime(DrawMS) + Environment.NewLine +
" Reading the infos from the image took : " + Reader.ConvertMsToTime(OcrMS) + Environment.NewLine
);
}
private void btnNext_Click(object sender, EventArgs e)