LaneIn - Remove field: isRetryModeUntilOk

This commit is contained in:
DucDangAnh 2020-06-29 09:28:20 +07:00
parent b0b062788e
commit b7eae98821

View File

@ -18,7 +18,6 @@ namespace AIParkingApplication
private bool isSupportLongPlate; private bool isSupportLongPlate;
private bool isAutoOpenDoor; private bool isAutoOpenDoor;
private bool isRetryMode; private bool isRetryMode;
private bool isRetryModeUntilOk; //TODO: Test mode
private C3DeviceController c3Device; private C3DeviceController c3Device;
private ApiController apiController; private ApiController apiController;
@ -30,8 +29,7 @@ namespace AIParkingApplication
bool isSupportSquarePlate = true, bool isSupportSquarePlate = true,
bool isSupportLongPlate = false, bool isSupportLongPlate = false,
bool isAutoOpenDoor = true, bool isAutoOpenDoor = true,
bool isRetryMode = false, bool isRetryMode = false)
bool isRetryModeUntilOk = false)
{ {
InitializeComponent(); InitializeComponent();
this.doorId = doorId; this.doorId = doorId;
@ -40,7 +38,6 @@ namespace AIParkingApplication
this.isSupportLongPlate = isSupportLongPlate; this.isSupportLongPlate = isSupportLongPlate;
this.isAutoOpenDoor = isAutoOpenDoor; this.isAutoOpenDoor = isAutoOpenDoor;
this.isRetryMode = isRetryMode; this.isRetryMode = isRetryMode;
this.isRetryModeUntilOk = isRetryModeUntilOk;
overviewCamera = new Camera(overviewStream); overviewCamera = new Camera(overviewStream);
plateCamera = new Camera(plateStream); plateCamera = new Camera(plateStream);
this.apiController = apiController; this.apiController = apiController;
@ -71,7 +68,7 @@ namespace AIParkingApplication
await Task.Delay(500); await Task.Delay(500);
var videoFrame = plateCamera.CurrentFrame; var videoFrame = plateCamera.CurrentFrame;
FinalPlateResult result = await ProcessFrameImage(plateProcessor, videoFrame, isRetryMode, isRetryModeUntilOk); FinalPlateResult result = await ProcessFrameImage(plateProcessor, videoFrame, isRetryMode);
pictureBoxPlateImage.Invoke(new Action(() => pictureBoxPlateImage.Invoke(new Action(() =>
{ {
pictureBoxPlateImage.Image?.Dispose(); pictureBoxPlateImage.Image?.Dispose();
@ -134,7 +131,7 @@ namespace AIParkingApplication
} }
} }
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode, bool isRetryModeUntilOk) private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
{ {
try try
{ {
@ -144,17 +141,10 @@ namespace AIParkingApplication
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString)) if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
{ {
if (isRetryModeUntilOk) //TODO: TestMode Console.WriteLine("ProcessFrameImage Retry Mode");
{ Thread.Sleep(1000);
Thread.Sleep(500); overviewCamera.RequestCaptureOneFrame();
} finalPlateResult = await plateProcessor.ProcessPlate(frame);
else
{
Console.WriteLine("ProcessFrameImage Retry Mode");
Thread.Sleep(1000);
overviewCamera.RequestCaptureOneFrame();
finalPlateResult = await plateProcessor.ProcessPlate(frame);
}
} }
return finalPlateResult; return finalPlateResult;
} }