LaneIn - Remove using Task For Event: PlateCamera_OnOneVideoFrameRequested
This commit is contained in:
parent
a7fe049f15
commit
7529efa6d2
|
@ -106,45 +106,42 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlateCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
private async void PlateCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||||
{
|
{
|
||||||
Task.Factory.StartNew(new Action(async () =>
|
try
|
||||||
{
|
{
|
||||||
try
|
//TODO: check size before resizing
|
||||||
{
|
Cv2.Resize(videoFrame, videoFrame, new Size(1280, 720));
|
||||||
//TODO: check size before resizing
|
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
||||||
Cv2.Resize(videoFrame, videoFrame, new Size(1280, 720));
|
|
||||||
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
|
||||||
|
|
||||||
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
|
||||||
|
{
|
||||||
|
if (isRetryModeUntilOk) //TODO: TestMode
|
||||||
{
|
{
|
||||||
if (isRetryModeUntilOk) //TODO: TestMode
|
Thread.Sleep(500);
|
||||||
{
|
CaptureAllCamera();
|
||||||
Thread.Sleep(500);
|
|
||||||
CaptureAllCamera();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("PlateCamera_OnOneVideoFrameRequested Retry Mode");
|
|
||||||
Thread.Sleep(1000);
|
|
||||||
overviewCamera.RequestCaptureOneFrame();
|
|
||||||
finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
pictureBoxPlateImage.Invoke(new Action(() =>
|
|
||||||
{
|
{
|
||||||
pictureBoxPlateImage.Image?.Dispose();
|
Console.WriteLine("PlateCamera_OnOneVideoFrameRequested Retry Mode");
|
||||||
pictureBoxPlateImage.Image = finalPlateResult.PlateImage;
|
Thread.Sleep(1000);
|
||||||
}));
|
overviewCamera.RequestCaptureOneFrame();
|
||||||
|
finalPlateResult = await plateProcessor.ProcessPlate(videoFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ShowCardInfoOnUI("224", finalPlateResult.PlateString, "Thẻ tháng", DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
|
pictureBoxPlateImage.Invoke(new Action(() =>
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
{
|
||||||
Console.WriteLine($"PlateCamera_OnOneVideoFrameRequested\texMessage: {ex.Message}");
|
pictureBoxPlateImage.Image?.Dispose();
|
||||||
}
|
pictureBoxPlateImage.Image = finalPlateResult.PlateImage;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
ShowCardInfoOnUI("224", finalPlateResult.PlateString, "Thẻ tháng", DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"PlateCamera_OnOneVideoFrameRequested\texMessage: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user