PlateProcessor - ProcessPlate: Catch Exception Return Result with frame, Remove Cv2.Resize Frame.

This commit is contained in:
DucDangAnh 2020-06-19 14:46:15 +07:00
parent 7fcb3cc5c6
commit f9fcca2902
2 changed files with 7 additions and 4 deletions

View File

@ -61,6 +61,8 @@ namespace AIParkingApplication
{ {
try try
{ {
//TODO: check size before resizing
Cv2.Resize(videoFrame, videoFrame, new Size(1280, 720));
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(videoFrame); FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString)) if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))

View File

@ -64,10 +64,7 @@ namespace AIParkingApplication
{ {
try try
{ {
//TODO: check size before resizing
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
FinalPlateResult plateResult; FinalPlateResult plateResult;
if (isSupportLongPlate) if (isSupportLongPlate)
{ {
plateResult = await DetectPlateAndDoOcrEngineAsync(PlateType.Long, frame); plateResult = await DetectPlateAndDoOcrEngineAsync(PlateType.Long, frame);
@ -87,7 +84,11 @@ namespace AIParkingApplication
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}"); Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
return new FinalPlateResult(); return new FinalPlateResult
{
PlateString = string.Empty,
PlateImage = frame.ToBitmap()
};
} }
} }