PlateDetector - Move weight file name to constant
This commit is contained in:
parent
267e6cfaa3
commit
d1d1640a31
|
@ -20,7 +20,7 @@ namespace AIParkingApplication
|
|||
this.maxSizePlate = maxSizePlate;
|
||||
this.scaleFactor = scaleFactor;
|
||||
this.minNeighbors = minNeighbors;
|
||||
plateCascadeClassifier = new CascadeClassifier(this.plateType == PlateType.Square ? "plate.xml" : "plateLong.xml");
|
||||
plateCascadeClassifier = new CascadeClassifier(this.plateType == PlateType.Square ? PlateDetectorConstant.SQUARE_PLATE_WEIGHT_FILENAME : PlateDetectorConstant.LONG_PLATE_WEIGHT_FILENAME);
|
||||
}
|
||||
|
||||
public Mat DetectPlate(Mat frame)
|
||||
|
@ -56,7 +56,6 @@ namespace AIParkingApplication
|
|||
Console.WriteLine($"{i}\t{plateRects[i].Width}\t{plateRects[i].Height}");
|
||||
}
|
||||
Console.WriteLine($"GetBiggestPlate - Width: {biggestPlateRect.Width}\tHeight: {biggestPlateRect.Height}");
|
||||
|
||||
Rect extendedRect = ExtendPlateRect(biggestPlateRect);
|
||||
//TODO: check oversize frame
|
||||
Mat plateImage;
|
||||
|
@ -66,9 +65,8 @@ namespace AIParkingApplication
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error While Extending Plate Rect");
|
||||
plateImage = frame[biggestPlateRect];
|
||||
throw;
|
||||
Console.WriteLine($"Error While Extending Plate Rect: {ex.Message}");
|
||||
}
|
||||
return plateImage;
|
||||
}
|
||||
|
@ -82,6 +80,9 @@ namespace AIParkingApplication
|
|||
|
||||
public static class PlateDetectorConstant
|
||||
{
|
||||
public const string SQUARE_PLATE_WEIGHT_FILENAME = "plate.xml";
|
||||
public const string LONG_PLATE_WEIGHT_FILENAME = "plateLong.xml";
|
||||
|
||||
public const double SCALE_FACTOR_DEFAULT_SQUARE_PLATE = 1.03;
|
||||
public static int MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE = 2;
|
||||
public static Size MIN_SIZE_DEFAULT_SQUARE_PLATE = new Size(105, 100);
|
||||
|
|
Loading…
Reference in New Issue
Block a user