LaneIn - Check card info then do recognize plate. ApiController: CardValidation IsValid change type.

This commit is contained in:
DucDangAnh 2020-06-26 17:46:45 +07:00
parent 44eb7c3ee7
commit b8e88aaafe
2 changed files with 15 additions and 5 deletions

View File

@ -195,7 +195,7 @@ namespace AIParkingApplication
public class CardValidation
{
[JsonProperty("status")]
public string IsValid { get; set; }
public bool IsValid { get; set; }
[JsonProperty("type")]
public string Direction { get; set; }

View File

@ -1,4 +1,5 @@
using System;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -62,9 +63,10 @@ namespace AIParkingApplication
}
}
private void C3Device_OnNewCardReceived(int doorId, string cardNumber)
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{
Task.Factory.StartNew(async () =>
var cardInfoResult = await apiController.CheckCard(cardNumber);
if (cardInfoResult.IsValid)
{
plateCamera.RequestCaptureOneFrame();
await Task.Delay(500);
@ -88,7 +90,15 @@ namespace AIParkingApplication
c3Device.OpenDoor(doorId);
}
}
});
}
else
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Purple;
lblRecogizePlateStatus.Text = "THẺ KHÔNG HỢP LỆ";
}));
}
}
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
@ -130,7 +140,7 @@ namespace AIParkingApplication
try
{
//TODO: check size before resizing
Cv2.Resize(frame, frame, new Size(1280, 720));
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))