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.Location = new System.Drawing.Point(498, 288);
|
||||||
this.tbxResult.Multiline = true;
|
this.tbxResult.Multiline = true;
|
||||||
this.tbxResult.Name = "tbxResult";
|
this.tbxResult.Name = "tbxResult";
|
||||||
|
this.tbxResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||||
this.tbxResult.Size = new System.Drawing.Size(147, 270);
|
this.tbxResult.Size = new System.Drawing.Size(147, 270);
|
||||||
this.tbxResult.TabIndex = 4;
|
this.tbxResult.TabIndex = 4;
|
||||||
//
|
//
|
||||||
|
|||||||
+9
-3
@@ -36,10 +36,14 @@ namespace TestVideo
|
|||||||
|
|
||||||
//TESTING TESSERACT
|
//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);
|
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)
|
private Bitmap PrepareImage(Bitmap inputImage)
|
||||||
{
|
{
|
||||||
@@ -64,6 +68,7 @@ namespace TestVideo
|
|||||||
}
|
}
|
||||||
private string DecodeTessereactResults(string tesseractResult, Image inputImage, PictureBox resultPbx)
|
private string DecodeTessereactResults(string tesseractResult, Image inputImage, PictureBox resultPbx)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show(tesseractResult);
|
||||||
string result = "";
|
string result = "";
|
||||||
string[] lettersData = tesseractResult.Split('\n');
|
string[] lettersData = tesseractResult.Split('\n');
|
||||||
using (Graphics g = Graphics.FromImage(inputImage))
|
using (Graphics g = Graphics.FromImage(inputImage))
|
||||||
@@ -80,6 +85,8 @@ namespace TestVideo
|
|||||||
Size size = new Size(Convert.ToInt32(data[3]), Convert.ToInt32(data[4]));
|
Size size = new Size(Convert.ToInt32(data[3]), Convert.ToInt32(data[4]));
|
||||||
int unknownData = Convert.ToInt32(data[5]);
|
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
|
//Use the data
|
||||||
result += letter;
|
result += letter;
|
||||||
g.DrawRectangle(new Pen(Brushes.Red, 5), new Rectangle(position, size));
|
g.DrawRectangle(new Pen(Brushes.Red, 5), new Rectangle(position, size));
|
||||||
@@ -146,7 +153,6 @@ namespace TestVideo
|
|||||||
inputBmp = PrepareImage(inputBmp);
|
inputBmp = PrepareImage(inputBmp);
|
||||||
Image<Bgr, byte> emguImage = inputBmp.ToImage<Bgr, byte>();
|
Image<Bgr, byte> emguImage = inputBmp.ToImage<Bgr, byte>();
|
||||||
|
|
||||||
//using (var image = new Image<Bgr, byte>(inputBmp))
|
|
||||||
using (var image = emguImage)
|
using (var image = emguImage)
|
||||||
{
|
{
|
||||||
using (Tesseract tesseractOcrProvider = new Tesseract(AppDomain.CurrentDomain.BaseDirectory + "\\Data", "eng", OcrEngineMode.Default))
|
using (Tesseract tesseractOcrProvider = new Tesseract(AppDomain.CurrentDomain.BaseDirectory + "\\Data", "eng", OcrEngineMode.Default))
|
||||||
|
|||||||
Reference in New Issue
Block a user