You can now also add windows and it all gets dump into a nice directory for each driver.
This commit is contained in:
+16
-2
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user