Still not working well but a lot more does

This commit is contained in:
2023-04-27 11:18:53 +02:00
parent d1eb1720a2
commit 23de653bde
5 changed files with 137 additions and 39 deletions

View File

@@ -10,29 +10,62 @@ namespace Test_Merge
{
public class ConfigurationTool
{
private Zone mainZone;
const int NUMBER_OF_DRIVERS = 20;
const int NUMBER_OF_ZONES = 7;
public Zone MainZone;
public const int NUMBER_OF_DRIVERS = 20;
public const int NUMBER_OF_ZONES = 9;
public ConfigurationTool()
public ConfigurationTool(Bitmap fullImage,Rectangle mainZoneDimensions)
{
//empty for now
MainZone = new Zone(fullImage,mainZoneDimensions);
AutoCalibrate();
}
public void AddZones(List<Rectangle> rectangles)
public void AddWindows(List<Rectangle> rectangles)
{
foreach (Zone driverZone in mainZone.Zones)
foreach (Zone driverZone in MainZone.Zones)
{
Bitmap zoneImage = driverZone.ZoneImage;
for ()
for (int i = 1; i <= rectangles.Count; i++)
{
//We need to add all the zone and the types
//if i== 1 => driverZone.Add(new DriverPositionWindow)
}
foreach (Rectangle rectangle in rectangles) {
driverZone.AddWindow(new Window());
switch (i)
{
case 1:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverPositionWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 2:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverGapToLeaderWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 3:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverLapTimeWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 4:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverDrsWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 5:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverTyresWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 6:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverNameWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 7:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverSectorWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 8:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverSectorWindow(driverZone.ZoneImage, rectangles[i]));
break;
case 9:
//First zone should be the driver's Position
driverZone.AddWindow(new DriverSectorWindow(driverZone.ZoneImage, rectangles[i]));
break;
}
}
}
}
@@ -42,7 +75,7 @@ namespace Test_Merge
List<Zone> zones = new List<Zone>();
TesseractEngine engine = new TesseractEngine(Window.TESS_DATA_FOLDER.FullName, "eng", EngineMode.Default);
Image image = mainZone.ZoneImage;
Image image = MainZone.ZoneImage;
var tessImage = Pix.LoadFromMemory(Window.ImageToByte(image));
Page page = engine.Process(tessImage);
@@ -89,7 +122,7 @@ namespace Test_Merge
Point windowLocation = new Point(0, (Rectangle.Y + Rectangle.Height / 2) - windowSize.Height / 2);
windowRectangle = new Rectangle(windowLocation, windowSize);
//We add the driver zones
mainZone.AddZone(new Zone(mainZone.ZoneImage, windowRectangle));
MainZone.AddZone(new Zone(MainZone.ZoneImage, windowRectangle));
}
}
}