From 4d03070849409e8a95b2cb90e638e44ccf2d73e2 Mon Sep 17 00:00:00 2001 From: maxluli Date: Mon, 10 Apr 2023 10:21:21 +0200 Subject: [PATCH] Added diagnostic tools --- OCR_Decode/Form1.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/OCR_Decode/Form1.cs b/OCR_Decode/Form1.cs index 46856f2..20943bb 100644 --- a/OCR_Decode/Form1.cs +++ b/OCR_Decode/Form1.cs @@ -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)