You can now also add windows and it all gets dump into a nice directory for each driver.

This commit is contained in:
2023-03-31 15:24:03 +02:00
parent d60de1a0c0
commit 5ec9656b03
5 changed files with 86 additions and 20 deletions
+16 -2
View File
@@ -72,16 +72,30 @@ namespace OCR_tester
Zones.Add(new Zone(ZoneImage, windowRectangle));
}
}
public Bitmap Draw()
public override Bitmap Draw()
{
Bitmap image = ZoneImage;
Graphics g = Graphics.FromImage(image);
string imgDumbFil = @"C:\Users\Moi\Desktop\imgDump\";
int count = 0;
foreach (Zone z in Zones)
{
g.DrawRectangle(Pens.Red,z.Bounds);
z.ZoneImage.Save(@"C:\Users\Moi\Desktop\imgDump\"+"driver"+count+".png");
string dir = imgDumbFil + "driver" + count + @"\";
if (Directory.Exists(dir))
Directory.Delete(dir, true);
Directory.CreateDirectory(dir);
z.ZoneImage.Save(Path.Combine(dir,("driver"+count+".png")));
int count2 = 0;
foreach (Window w in z.Windows)
{
g.DrawRectangle(Pens.Blue,w.Bounds);
w.WindowImage.Save(dir+"data"+count2+".png");
count2++;
}
count++;
}
image.Save(@"C:\Users\Moi\Desktop\imgDump\test.png");