Improved the old way of manually selecting windows, Added all the windows types and implemented them, You can now export to a bad json file

This commit is contained in:
2023-04-03 12:38:47 +02:00
parent 5ec9656b03
commit 5ca6d61a69
16 changed files with 369 additions and 13 deletions
+17 -1
View File
@@ -10,9 +10,12 @@ namespace OCR_tester
{
public class Window
{
private Bitmap FullImage;
protected Bitmap FullImage;
private string _name;
private Rectangle _bounds;
public string Name { get => _name; protected set => _name = value; }
public Rectangle Bounds { get => _bounds; protected set => _bounds = value; }
public static DirectoryInfo tessDataFolder = new DirectoryInfo(@"C:\Users\Moi\Pictures\SeleniumScreens\TessData");
@@ -27,6 +30,7 @@ namespace OCR_tester
return sample;
}
}
public Window(Bitmap fullImage, Rectangle bounds)
{
FullImage = fullImage;
@@ -44,5 +48,17 @@ namespace OCR_tester
return stream.ToArray();
}
}
public virtual string ToJSON()
{
string result = "";
result += "\"" + Name + "\"" + ":{" + Environment.NewLine;
result += "\t" + "\"x\":" + Bounds.X + "," + Environment.NewLine;
result += "\t" + "\"y\":" + Bounds.Y + "," + Environment.NewLine;
result += "\t" + "\"width\":" + Bounds.Width + Environment.NewLine;
result += "}";
return result;
}
}
}