PlateProcessor - Add Try Catch In Method DetectPlateAndDoOcrEngineAsync

This commit is contained in:
DucDangAnh 2020-06-19 10:30:32 +07:00
parent e3ebc951fb
commit 88b2e3524e

View File

@ -32,7 +32,6 @@ namespace AIParkingApplication
private async Task<FinalPlateResult> DetectPlateAndDoOcrEngineAsync(PlateType plateType, Mat frame) private async Task<FinalPlateResult> DetectPlateAndDoOcrEngineAsync(PlateType plateType, Mat frame)
{ {
//TODO: check size before resizing
Mat plateDetected = plateType == PlateType.Square ? squarePlateDetector.DetectPlate(frame) : longPlateDetector.DetectPlate(frame); Mat plateDetected = plateType == PlateType.Square ? squarePlateDetector.DetectPlate(frame) : longPlateDetector.DetectPlate(frame);
//TODO: check size before resizing //TODO: check size before resizing
@ -62,6 +61,8 @@ namespace AIParkingApplication
} }
public async Task<FinalPlateResult> ProcessPlate(Mat frame) public async Task<FinalPlateResult> ProcessPlate(Mat frame)
{
try
{ {
//TODO: check size before resizing //TODO: check size before resizing
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720)); Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
@ -83,6 +84,12 @@ namespace AIParkingApplication
return plateResult; return plateResult;
} }
catch (Exception ex)
{
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
return new FinalPlateResult();
}
}
//TODO: Complete this //TODO: Complete this
private string NormalizePlateString(string plateString) private string NormalizePlateString(string plateString)