Messed around with different screenshots
This commit is contained in:
Generated
+1
@@ -87,6 +87,7 @@
|
||||
this.tbxResult.Location = new System.Drawing.Point(498, 288);
|
||||
this.tbxResult.Multiline = true;
|
||||
this.tbxResult.Name = "tbxResult";
|
||||
this.tbxResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.tbxResult.Size = new System.Drawing.Size(147, 270);
|
||||
this.tbxResult.TabIndex = 4;
|
||||
//
|
||||
|
||||
+10
-4
@@ -36,10 +36,14 @@ namespace TestVideo
|
||||
|
||||
//TESTING TESSERACT
|
||||
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Baneer.png";
|
||||
//string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Baneer.png";
|
||||
//string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Test.png";
|
||||
//string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Standings.png";
|
||||
//string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Gaps.png";
|
||||
//string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\SectorTimes.png";
|
||||
string path = AppDomain.CurrentDomain.BaseDirectory + "Screens\\Standings2.png";
|
||||
|
||||
tbxResult.Text = DecodeTessereactResults(testTesseract((Bitmap)Image.FromFile(path)), Image.FromFile(path), pbxOutput);
|
||||
//MessageBox.Show(DecodeTessereactResults(testTesseract(path), Image.FromFile(path), pbxOutput));
|
||||
}
|
||||
private Bitmap PrepareImage(Bitmap inputImage)
|
||||
{
|
||||
@@ -64,6 +68,7 @@ namespace TestVideo
|
||||
}
|
||||
private string DecodeTessereactResults(string tesseractResult, Image inputImage, PictureBox resultPbx)
|
||||
{
|
||||
MessageBox.Show(tesseractResult);
|
||||
string result = "";
|
||||
string[] lettersData = tesseractResult.Split('\n');
|
||||
using (Graphics g = Graphics.FromImage(inputImage))
|
||||
@@ -80,6 +85,8 @@ namespace TestVideo
|
||||
Size size = new Size(Convert.ToInt32(data[3]), Convert.ToInt32(data[4]));
|
||||
int unknownData = Convert.ToInt32(data[5]);
|
||||
|
||||
//A neat post processing Idea would be to separate letters that have a unusually big difference in X or Y axis to try and recognise words
|
||||
|
||||
//Use the data
|
||||
result += letter;
|
||||
g.DrawRectangle(new Pen(Brushes.Red, 5), new Rectangle(position, size));
|
||||
@@ -146,7 +153,6 @@ namespace TestVideo
|
||||
inputBmp = PrepareImage(inputBmp);
|
||||
Image<Bgr, byte> emguImage = inputBmp.ToImage<Bgr, byte>();
|
||||
|
||||
//using (var image = new Image<Bgr, byte>(inputBmp))
|
||||
using (var image = emguImage)
|
||||
{
|
||||
using (Tesseract tesseractOcrProvider = new Tesseract(AppDomain.CurrentDomain.BaseDirectory + "\\Data", "eng", OcrEngineMode.Default))
|
||||
@@ -156,7 +162,7 @@ namespace TestVideo
|
||||
result = tesseractOcrProvider.GetBoxText().TrimEnd();
|
||||
}
|
||||
}
|
||||
// File.Delete(filePath);
|
||||
//File.Delete(filePath);
|
||||
return result;
|
||||
}
|
||||
private void tmrScreenshots_Tick(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user