Compare commits

...

13 Commits

12 changed files with 562 additions and 197 deletions

View File

@ -34,7 +34,7 @@
//
// btnStopLaneIn
//
this.btnStopLaneIn.Location = new System.Drawing.Point(840, 205);
this.btnStopLaneIn.Location = new System.Drawing.Point(1221, 88);
this.btnStopLaneIn.Name = "btnStopLaneIn";
this.btnStopLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStopLaneIn.TabIndex = 0;
@ -44,7 +44,7 @@
//
// btnStartLaneIn
//
this.btnStartLaneIn.Location = new System.Drawing.Point(840, 246);
this.btnStartLaneIn.Location = new System.Drawing.Point(1221, 129);
this.btnStartLaneIn.Name = "btnStartLaneIn";
this.btnStartLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStartLaneIn.TabIndex = 0;

View File

@ -8,6 +8,7 @@ namespace AIParkingApplication
private ApiController apiController;
private IDoorControlAccess c3Device;
private LaneIn laneIn;
private LaneOut laneOut;
public AIParkingApplicationForm()
{
@ -17,23 +18,29 @@ namespace AIParkingApplication
c3Device = new C3DeviceController("192.168.1.200");
laneIn = new LaneIn(1, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true);
Controls.Add(laneIn);
//laneOut.Location = new System.Drawing.Point(550, 0);
//Controls.Add(laneOut);
//LaneIn laneIn1 = new LaneIn(@"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, true, false, false);
//laneIn1.Location = new System.Drawing.Point(550, 0);
//Controls.Add(laneIn1);
//laneIn1.Start();
laneOut = new LaneOut(2, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true);
laneOut.Location = new System.Drawing.Point(450, 0);
Controls.Add(laneOut);
StartLanes();
}
private void btnStopLaneIn_Click(object sender, System.EventArgs e)
{
laneIn.Stop();
laneOut.Stop();
}
private void StartLanes()
{
laneIn.Start();
laneOut.Start();
}
private void btnStartLaneIn_Click(object sender, System.EventArgs e)
{
laneIn.Start();
StartLanes();
}
}
}

View File

@ -39,7 +39,7 @@ namespace AIParkingApplication
}
catch (Exception ex)
{
Console.WriteLine($"Login Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
return new LoginDataModel
{
IsLoginSuccess = false
@ -68,7 +68,7 @@ namespace AIParkingApplication
}
catch (Exception ex)
{
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
return new Statistic.ParkInfo();
}
}
@ -88,7 +88,7 @@ namespace AIParkingApplication
}
catch (Exception ex)
{
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
Console.WriteLine($"CheckCard Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
return new CardInformation();
}
}
@ -124,7 +124,7 @@ namespace AIParkingApplication
}
catch (Exception ex)
{
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.ToString(AppConstant.DATETIME_FORMAT)} \t {ex.Message}");
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
return new SaveLogRespone();
}
}
@ -155,7 +155,7 @@ namespace AIParkingApplication
public string Direction { get; set; }
[JsonProperty("cardID")]
public string CardIP { get; set; }
public string CardId { get; set; }
[JsonProperty("cardRealID")]
public int CardRealID { get; set; }
@ -173,7 +173,7 @@ namespace AIParkingApplication
public bool AutoOpenDoor { get; set; }
[JsonProperty("plate")]
public string Plate { get; set; }
public string PlateString { get; set; }
[JsonProperty("time")]
public string TimeIn { get; set; }

View File

@ -58,7 +58,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = false,
Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -67,7 +67,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.FAILED_TO_CONNECT, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress, PullLastError())
Message = string.Format(C3Constant.FAILED_TO_CONNECT, DateTime.Now.GetTimeFormatted(), ipAddress, PullLastError())
};
return result;
}
@ -77,7 +77,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -93,7 +93,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = false,
Message = string.Format(C3Constant.OPENNED_DOOR_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.OPENNED_DOOR_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -102,7 +102,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.FAILED_TO_OPEN_DOOR, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.FAILED_TO_OPEN_DOOR, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -112,7 +112,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -142,7 +142,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.FAILED_TO_PING, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -177,7 +177,7 @@ namespace AIParkingApplication
{
isReconnected = true;
reconnectCounter = 0;
reconnectResult.Message = string.Format(C3Constant.RECONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress);
reconnectResult.Message = string.Format(C3Constant.RECONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress);
}
return reconnectResult;
}
@ -185,7 +185,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.FAILED_TO_READ_LOG, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.FAILED_TO_READ_LOG, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}
@ -197,7 +197,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = true,
Message = string.Format(C3Constant.WRONG_FORMAT_DATA, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress, ex.Message)
Message = string.Format(C3Constant.WRONG_FORMAT_DATA, DateTime.Now.GetTimeFormatted(), ipAddress, ex.Message)
};
return result;
}
@ -210,7 +210,7 @@ namespace AIParkingApplication
var result = new ActionResult
{
HasError = false,
Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), ipAddress)
Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.GetTimeFormatted(), ipAddress)
};
return result;
}

View File

@ -130,18 +130,18 @@
this.lblCardType.AutoSize = true;
this.lblCardType.Location = new System.Drawing.Point(12, 64);
this.lblCardType.Name = "lblCardType";
this.lblCardType.Size = new System.Drawing.Size(60, 18);
this.lblCardType.Size = new System.Drawing.Size(64, 18);
this.lblCardType.TabIndex = 0;
this.lblCardType.Text = "Loại thẻ";
this.lblCardType.Text = "Loại thẻ:";
//
// lblCardNumber
//
this.lblCardNumber.AutoSize = true;
this.lblCardNumber.Location = new System.Drawing.Point(12, 31);
this.lblCardNumber.Name = "lblCardNumber";
this.lblCardNumber.Size = new System.Drawing.Size(51, 18);
this.lblCardNumber.Size = new System.Drawing.Size(55, 18);
this.lblCardNumber.TabIndex = 0;
this.lblCardNumber.Text = "Số thẻ";
this.lblCardNumber.Text = "Số thẻ:";
//
// grbCardInformation
//
@ -163,18 +163,18 @@
this.lblCardTime.AutoSize = true;
this.lblCardTime.Location = new System.Drawing.Point(223, 64);
this.lblCardTime.Name = "lblCardTime";
this.lblCardTime.Size = new System.Drawing.Size(68, 18);
this.lblCardTime.Size = new System.Drawing.Size(72, 18);
this.lblCardTime.TabIndex = 0;
this.lblCardTime.Text = "Thời gian";
this.lblCardTime.Text = "Thời gian:";
//
// lblPlateString
//
this.lblPlateString.AutoSize = true;
this.lblPlateString.Location = new System.Drawing.Point(223, 31);
this.lblPlateString.Name = "lblPlateString";
this.lblPlateString.Size = new System.Drawing.Size(58, 18);
this.lblPlateString.Size = new System.Drawing.Size(62, 18);
this.lblPlateString.TabIndex = 0;
this.lblPlateString.Text = "Biển số";
this.lblPlateString.Text = "Biển số:";
//
// lblStatusInfo
//

View File

@ -55,6 +55,10 @@ namespace AIParkingApplication
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{
if (this.doorId != doorId)
{
return;
}
ClearPlateAndOverviewImage();
var cardInfoResult = await apiController.GetCardInformation(cardNumber);
if (!cardInfoResult.IsValid)
@ -65,7 +69,7 @@ namespace AIParkingApplication
if (cardInfoResult.Direction != "in")
{
lblStatusInfo.UpdateLabel("THẺ ĐÃ ĐƯỢC SỬ DỤNG", Color.Red);
lblStatusInfo.UpdateLabel("XE ĐÃ Ở TRONG BÃI", Color.Red);
return;
}
@ -81,9 +85,9 @@ namespace AIParkingApplication
pictureBoxOverviewImage.UpdateImage(overviewVideoFrame.ToBitmap());
var cardInformation = await apiController.GetCardInformation(cardNumber);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.GetTimeFormatted());
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)
@ -167,7 +171,7 @@ namespace AIParkingApplication
lblPlateString.UpdateLabel($"Biển số: {plateString}");
lblCardType.UpdateLabel($"Loại thẻ: {cardType}");
lblCardTime.UpdateLabel($"Thời gian: {cardTime}");
lblStatusInfo.UpdateLabel(string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} VÀO", string.IsNullOrEmpty(plateString) ? Color.Red : Color.Green);
lblStatusInfo.UpdateLabel(string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} QUA", string.IsNullOrEmpty(plateString) ? Color.Red : Color.Green);
}
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)

View File

@ -29,212 +29,271 @@
private void InitializeComponent()
{
this.grbPlateRefernce = new System.Windows.Forms.GroupBox();
this.pictureBox6 = new System.Windows.Forms.PictureBox();
this.pictureBox5 = new System.Windows.Forms.PictureBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.grbPlateCamera = new System.Windows.Forms.GroupBox();
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.lblMoneyAmount = new System.Windows.Forms.Label();
this.lblCardType = new System.Windows.Forms.Label();
this.pictureBoxOverviewImageIn = new System.Windows.Forms.PictureBox();
this.pictureBoxPlateImageIn = new System.Windows.Forms.PictureBox();
this.grbCardInformation = new System.Windows.Forms.GroupBox();
this.lblLaneLabel = new System.Windows.Forms.Label();
this.pictureBox4 = new System.Windows.Forms.PictureBox();
this.pictureBox3 = new System.Windows.Forms.PictureBox();
this.grbOverviewCamera = new System.Windows.Forms.GroupBox();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.lblCardType = new System.Windows.Forms.Label();
this.lblCardTime = new System.Windows.Forms.Label();
this.lblMoneyAmount = new System.Windows.Forms.Label();
this.lblPlateString = new System.Windows.Forms.Label();
this.lblCardNumber = new System.Windows.Forms.Label();
this.pictureBoxPlateImage = new System.Windows.Forms.PictureBox();
this.pictureBoxPlateVideo = new System.Windows.Forms.PictureBox();
this.grbPlateCamera = new System.Windows.Forms.GroupBox();
this.pictureBoxOverviewImage = new System.Windows.Forms.PictureBox();
this.pictureBoxOverviewVideo = new System.Windows.Forms.PictureBox();
this.grbOverviewCamera = new System.Windows.Forms.GroupBox();
this.lblLaneLabel = new System.Windows.Forms.Label();
this.lblStatusInfo = new System.Windows.Forms.Label();
this.lblCardTimeOut = new System.Windows.Forms.Label();
this.grbPlateRefernce.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.grbPlateCamera.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImageIn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImageIn)).BeginInit();
this.grbCardInformation.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).BeginInit();
this.grbPlateCamera.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewVideo)).BeginInit();
this.grbOverviewCamera.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// grbPlateRefernce
//
this.grbPlateRefernce.Controls.Add(this.pictureBox6);
this.grbPlateRefernce.Controls.Add(this.pictureBox5);
this.grbPlateRefernce.Controls.Add(this.pictureBoxOverviewImageIn);
this.grbPlateRefernce.Controls.Add(this.pictureBoxPlateImageIn);
this.grbPlateRefernce.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbPlateRefernce.Location = new System.Drawing.Point(445, 171);
this.grbPlateRefernce.Location = new System.Drawing.Point(453, 208);
this.grbPlateRefernce.Name = "grbPlateRefernce";
this.grbPlateRefernce.Size = new System.Drawing.Size(212, 510);
this.grbPlateRefernce.Size = new System.Drawing.Size(226, 484);
this.grbPlateRefernce.TabIndex = 9;
this.grbPlateRefernce.TabStop = false;
this.grbPlateRefernce.Text = "THAM CHIẾU BIỂN SỐ VÀO";
this.grbPlateRefernce.Text = "Tham chiếu vào";
//
// pictureBox6
// pictureBoxOverviewImageIn
//
this.pictureBox6.Location = new System.Drawing.Point(6, 296);
this.pictureBox6.Name = "pictureBox6";
this.pictureBox6.Size = new System.Drawing.Size(200, 200);
this.pictureBox6.TabIndex = 0;
this.pictureBox6.TabStop = false;
this.pictureBoxOverviewImageIn.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.pictureBoxOverviewImageIn.Location = new System.Drawing.Point(13, 270);
this.pictureBoxOverviewImageIn.Name = "pictureBoxOverviewImageIn";
this.pictureBoxOverviewImageIn.Size = new System.Drawing.Size(200, 200);
this.pictureBoxOverviewImageIn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxOverviewImageIn.TabIndex = 0;
this.pictureBoxOverviewImageIn.TabStop = false;
//
// pictureBox5
// pictureBoxPlateImageIn
//
this.pictureBox5.Location = new System.Drawing.Point(6, 23);
this.pictureBox5.Name = "pictureBox5";
this.pictureBox5.Size = new System.Drawing.Size(200, 200);
this.pictureBox5.TabIndex = 0;
this.pictureBox5.TabStop = false;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(212, 23);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(200, 200);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// grbPlateCamera
//
this.grbPlateCamera.Controls.Add(this.pictureBox1);
this.grbPlateCamera.Controls.Add(this.pictureBox2);
this.grbPlateCamera.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbPlateCamera.Location = new System.Drawing.Point(15, 171);
this.grbPlateCamera.Name = "grbPlateCamera";
this.grbPlateCamera.Size = new System.Drawing.Size(424, 238);
this.grbPlateCamera.TabIndex = 7;
this.grbPlateCamera.TabStop = false;
this.grbPlateCamera.Text = "CAMERA BIỂN SỐ";
//
// lblMoneyAmount
//
this.lblMoneyAmount.AutoSize = true;
this.lblMoneyAmount.Location = new System.Drawing.Point(209, 31);
this.lblMoneyAmount.Name = "lblMoneyAmount";
this.lblMoneyAmount.Size = new System.Drawing.Size(54, 18);
this.lblMoneyAmount.TabIndex = 0;
this.lblMoneyAmount.Text = "Số tiền";
//
// lblCardType
//
this.lblCardType.AutoSize = true;
this.lblCardType.Location = new System.Drawing.Point(12, 59);
this.lblCardType.Name = "lblCardType";
this.lblCardType.Size = new System.Drawing.Size(60, 18);
this.lblCardType.TabIndex = 0;
this.lblCardType.Text = "Loại thẻ";
this.pictureBoxPlateImageIn.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.pictureBoxPlateImageIn.Location = new System.Drawing.Point(13, 23);
this.pictureBoxPlateImageIn.Name = "pictureBoxPlateImageIn";
this.pictureBoxPlateImageIn.Size = new System.Drawing.Size(200, 200);
this.pictureBoxPlateImageIn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxPlateImageIn.TabIndex = 0;
this.pictureBoxPlateImageIn.TabStop = false;
//
// grbCardInformation
//
this.grbCardInformation.Controls.Add(this.lblCardType);
this.grbCardInformation.Controls.Add(this.lblCardTimeOut);
this.grbCardInformation.Controls.Add(this.lblCardTime);
this.grbCardInformation.Controls.Add(this.lblMoneyAmount);
this.grbCardInformation.Controls.Add(this.lblPlateString);
this.grbCardInformation.Controls.Add(this.lblCardNumber);
this.grbCardInformation.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbCardInformation.Location = new System.Drawing.Point(15, 69);
this.grbCardInformation.Location = new System.Drawing.Point(1, 55);
this.grbCardInformation.Margin = new System.Windows.Forms.Padding(0);
this.grbCardInformation.Name = "grbCardInformation";
this.grbCardInformation.Size = new System.Drawing.Size(642, 91);
this.grbCardInformation.TabIndex = 8;
this.grbCardInformation.Size = new System.Drawing.Size(678, 104);
this.grbCardInformation.TabIndex = 19;
this.grbCardInformation.TabStop = false;
this.grbCardInformation.Text = "THÔNG TIN THẺ";
this.grbCardInformation.Text = "Thông tin thẻ";
//
// lblLaneLabel
// lblCardType
//
this.lblLaneLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblLaneLabel.AutoSize = true;
this.lblLaneLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLaneLabel.Location = new System.Drawing.Point(262, 22);
this.lblLaneLabel.Name = "lblLaneLabel";
this.lblLaneLabel.Size = new System.Drawing.Size(141, 39);
this.lblLaneLabel.TabIndex = 5;
this.lblLaneLabel.Text = "LÀN RA";
this.lblCardType.AutoSize = true;
this.lblCardType.Location = new System.Drawing.Point(12, 64);
this.lblCardType.Name = "lblCardType";
this.lblCardType.Size = new System.Drawing.Size(64, 18);
this.lblCardType.TabIndex = 0;
this.lblCardType.Text = "Loại thẻ:";
//
// pictureBox4
// lblCardTime
//
this.pictureBox4.Location = new System.Drawing.Point(6, 24);
this.pictureBox4.Name = "pictureBox4";
this.pictureBox4.Size = new System.Drawing.Size(200, 200);
this.pictureBox4.TabIndex = 0;
this.pictureBox4.TabStop = false;
this.lblCardTime.AutoSize = true;
this.lblCardTime.Location = new System.Drawing.Point(223, 64);
this.lblCardTime.Name = "lblCardTime";
this.lblCardTime.Size = new System.Drawing.Size(38, 18);
this.lblCardTime.TabIndex = 0;
this.lblCardTime.Text = "Vào:";
//
// pictureBox3
// lblMoneyAmount
//
this.pictureBox3.Location = new System.Drawing.Point(212, 24);
this.pictureBox3.Name = "pictureBox3";
this.pictureBox3.Size = new System.Drawing.Size(200, 200);
this.pictureBox3.TabIndex = 0;
this.pictureBox3.TabStop = false;
this.lblMoneyAmount.AutoSize = true;
this.lblMoneyAmount.Location = new System.Drawing.Point(462, 31);
this.lblMoneyAmount.Name = "lblMoneyAmount";
this.lblMoneyAmount.Size = new System.Drawing.Size(58, 18);
this.lblMoneyAmount.TabIndex = 0;
this.lblMoneyAmount.Text = "Số tiền:";
//
// grbOverviewCamera
// lblPlateString
//
this.grbOverviewCamera.Controls.Add(this.pictureBox3);
this.grbOverviewCamera.Controls.Add(this.pictureBox4);
this.grbOverviewCamera.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbOverviewCamera.Location = new System.Drawing.Point(15, 443);
this.grbOverviewCamera.Name = "grbOverviewCamera";
this.grbOverviewCamera.Size = new System.Drawing.Size(424, 238);
this.grbOverviewCamera.TabIndex = 6;
this.grbOverviewCamera.TabStop = false;
this.grbOverviewCamera.Text = "CAMERA TOÀN CẢNH";
//
// pictureBox2
//
this.pictureBox2.Location = new System.Drawing.Point(6, 23);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(200, 200);
this.pictureBox2.TabIndex = 0;
this.pictureBox2.TabStop = false;
this.lblPlateString.AutoSize = true;
this.lblPlateString.Location = new System.Drawing.Point(223, 31);
this.lblPlateString.Name = "lblPlateString";
this.lblPlateString.Size = new System.Drawing.Size(62, 18);
this.lblPlateString.TabIndex = 0;
this.lblPlateString.Text = "Biển số:";
//
// lblCardNumber
//
this.lblCardNumber.AutoSize = true;
this.lblCardNumber.Location = new System.Drawing.Point(12, 31);
this.lblCardNumber.Name = "lblCardNumber";
this.lblCardNumber.Size = new System.Drawing.Size(51, 18);
this.lblCardNumber.Size = new System.Drawing.Size(55, 18);
this.lblCardNumber.TabIndex = 0;
this.lblCardNumber.Text = "Số thẻ";
this.lblCardNumber.Text = "Số thẻ:";
//
// pictureBoxPlateImage
//
this.pictureBoxPlateImage.Location = new System.Drawing.Point(226, 23);
this.pictureBoxPlateImage.Name = "pictureBoxPlateImage";
this.pictureBoxPlateImage.Size = new System.Drawing.Size(200, 200);
this.pictureBoxPlateImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxPlateImage.TabIndex = 0;
this.pictureBoxPlateImage.TabStop = false;
//
// pictureBoxPlateVideo
//
this.pictureBoxPlateVideo.Location = new System.Drawing.Point(15, 23);
this.pictureBoxPlateVideo.Name = "pictureBoxPlateVideo";
this.pictureBoxPlateVideo.Size = new System.Drawing.Size(200, 200);
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxPlateVideo.TabIndex = 0;
this.pictureBoxPlateVideo.TabStop = false;
//
// grbPlateCamera
//
this.grbPlateCamera.Controls.Add(this.pictureBoxPlateImage);
this.grbPlateCamera.Controls.Add(this.pictureBoxPlateVideo);
this.grbPlateCamera.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbPlateCamera.Location = new System.Drawing.Point(1, 208);
this.grbPlateCamera.Margin = new System.Windows.Forms.Padding(0);
this.grbPlateCamera.Name = "grbPlateCamera";
this.grbPlateCamera.Size = new System.Drawing.Size(439, 238);
this.grbPlateCamera.TabIndex = 18;
this.grbPlateCamera.TabStop = false;
this.grbPlateCamera.Text = "Camera biển số";
//
// pictureBoxOverviewImage
//
this.pictureBoxOverviewImage.Location = new System.Drawing.Point(226, 24);
this.pictureBoxOverviewImage.Name = "pictureBoxOverviewImage";
this.pictureBoxOverviewImage.Size = new System.Drawing.Size(200, 200);
this.pictureBoxOverviewImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxOverviewImage.TabIndex = 0;
this.pictureBoxOverviewImage.TabStop = false;
//
// pictureBoxOverviewVideo
//
this.pictureBoxOverviewVideo.Location = new System.Drawing.Point(15, 24);
this.pictureBoxOverviewVideo.Name = "pictureBoxOverviewVideo";
this.pictureBoxOverviewVideo.Size = new System.Drawing.Size(200, 200);
this.pictureBoxOverviewVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxOverviewVideo.TabIndex = 0;
this.pictureBoxOverviewVideo.TabStop = false;
//
// grbOverviewCamera
//
this.grbOverviewCamera.Controls.Add(this.pictureBoxOverviewImage);
this.grbOverviewCamera.Controls.Add(this.pictureBoxOverviewVideo);
this.grbOverviewCamera.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbOverviewCamera.Location = new System.Drawing.Point(1, 454);
this.grbOverviewCamera.Margin = new System.Windows.Forms.Padding(0);
this.grbOverviewCamera.Name = "grbOverviewCamera";
this.grbOverviewCamera.Size = new System.Drawing.Size(439, 238);
this.grbOverviewCamera.TabIndex = 17;
this.grbOverviewCamera.TabStop = false;
this.grbOverviewCamera.Text = "Camera toàn cảnh";
//
// lblLaneLabel
//
this.lblLaneLabel.BackColor = System.Drawing.Color.Red;
this.lblLaneLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblLaneLabel.ForeColor = System.Drawing.SystemColors.Control;
this.lblLaneLabel.Location = new System.Drawing.Point(1, 1);
this.lblLaneLabel.Margin = new System.Windows.Forms.Padding(0);
this.lblLaneLabel.Name = "lblLaneLabel";
this.lblLaneLabel.Size = new System.Drawing.Size(678, 50);
this.lblLaneLabel.TabIndex = 16;
this.lblLaneLabel.Text = "LÀN RA";
this.lblLaneLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblStatusInfo
//
this.lblStatusInfo.BackColor = System.Drawing.Color.CornflowerBlue;
this.lblStatusInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblStatusInfo.ForeColor = System.Drawing.SystemColors.Control;
this.lblStatusInfo.Location = new System.Drawing.Point(1, 159);
this.lblStatusInfo.Margin = new System.Windows.Forms.Padding(0);
this.lblStatusInfo.Name = "lblStatusInfo";
this.lblStatusInfo.Size = new System.Drawing.Size(678, 40);
this.lblStatusInfo.TabIndex = 20;
this.lblStatusInfo.Text = "XIN CHÀO";
this.lblStatusInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lblCardTimeOut
//
this.lblCardTimeOut.AutoSize = true;
this.lblCardTimeOut.Location = new System.Drawing.Point(462, 64);
this.lblCardTimeOut.Name = "lblCardTimeOut";
this.lblCardTimeOut.Size = new System.Drawing.Size(31, 18);
this.lblCardTimeOut.TabIndex = 0;
this.lblCardTimeOut.Text = "Ra:";
//
// LaneOut
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.grbPlateRefernce);
this.Controls.Add(this.grbCardInformation);
this.Controls.Add(this.lblLaneLabel);
this.Controls.Add(this.grbOverviewCamera);
this.Controls.Add(this.grbPlateCamera);
this.Controls.Add(this.grbOverviewCamera);
this.Controls.Add(this.lblLaneLabel);
this.Controls.Add(this.lblStatusInfo);
this.Controls.Add(this.grbPlateRefernce);
this.Name = "LaneOut";
this.Size = new System.Drawing.Size(671, 694);
this.Size = new System.Drawing.Size(680, 692);
this.grbPlateRefernce.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.grbPlateCamera.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImageIn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImageIn)).EndInit();
this.grbCardInformation.ResumeLayout(false);
this.grbCardInformation.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).EndInit();
this.grbPlateCamera.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewVideo)).EndInit();
this.grbOverviewCamera.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox grbPlateRefernce;
private System.Windows.Forms.PictureBox pictureBox6;
private System.Windows.Forms.PictureBox pictureBox5;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.GroupBox grbPlateCamera;
private System.Windows.Forms.PictureBox pictureBox2;
private System.ComponentModel.BackgroundWorker backgroundWorker2;
private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.Label lblMoneyAmount;
private System.Windows.Forms.Label lblCardType;
private System.Windows.Forms.PictureBox pictureBoxOverviewImageIn;
private System.Windows.Forms.PictureBox pictureBoxPlateImageIn;
private System.Windows.Forms.GroupBox grbCardInformation;
private System.Windows.Forms.Label lblCardType;
private System.Windows.Forms.Label lblCardTime;
private System.Windows.Forms.Label lblPlateString;
private System.Windows.Forms.Label lblCardNumber;
private System.Windows.Forms.Label lblLaneLabel;
private System.Windows.Forms.PictureBox pictureBox4;
private System.Windows.Forms.PictureBox pictureBox3;
private System.Windows.Forms.PictureBox pictureBoxPlateImage;
private System.Windows.Forms.PictureBox pictureBoxPlateVideo;
private System.Windows.Forms.GroupBox grbPlateCamera;
private System.Windows.Forms.PictureBox pictureBoxOverviewImage;
private System.Windows.Forms.PictureBox pictureBoxOverviewVideo;
private System.Windows.Forms.GroupBox grbOverviewCamera;
private System.Windows.Forms.Label lblLaneLabel;
private System.Windows.Forms.Label lblStatusInfo;
private System.Windows.Forms.Label lblMoneyAmount;
private System.Windows.Forms.Label lblCardTimeOut;
}
}

View File

@ -1,12 +1,238 @@
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIParkingApplication
{
public partial class LaneOut : UserControl
public partial class LaneOut : UserControl, ILane
{
public LaneOut()
private Camera overviewCamera;
private Camera plateCamera;
private PlateProcessor plateProcessor;
private int doorId;
private bool isSupportSquarePlate;
private bool isSupportLongPlate;
private bool isAutoOpenDoor;
private bool isRetryMode;
private IDoorControlAccess doorControlAccess;
private ApiController apiController;
public LaneOut(int doorId,
string plateStream,
string overviewStream,
IDoorControlAccess doorControlAccess,
ApiController apiController,
bool isSupportSquarePlate = true,
bool isSupportLongPlate = false,
bool isAutoOpenDoor = true,
bool isRetryMode = false)
{
InitializeComponent();
this.doorId = doorId;
this.isSupportSquarePlate = isSupportSquarePlate;
this.isSupportLongPlate = isSupportLongPlate;
this.isAutoOpenDoor = isAutoOpenDoor;
this.isRetryMode = isRetryMode;
overviewCamera = new Camera(overviewStream);
plateCamera = new Camera(plateStream);
this.apiController = apiController;
this.doorControlAccess = doorControlAccess;
this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
}
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{
if (this.doorId != doorId)
{
return;
}
ClearPlateAndOverviewImage();
ClearPlateAndOverviewImageIn();
var cardInfoResult = await apiController.GetCardInformation(cardNumber);
if (!cardInfoResult.IsValid)
{
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
return;
}
if (cardInfoResult.Direction != "out")
{
lblStatusInfo.UpdateLabel("CHƯA NHẬN THẺ VÀO", Color.Red);
return;
}
Bitmap plateImageIn = Util.ConvertFromBase64Image(cardInfoResult.PlateImageBase64);
Bitmap overviewImageIn = Util.ConvertFromBase64Image(cardInfoResult.FrameImageBase64);
pictureBoxPlateImageIn.UpdateImage(plateImageIn);
pictureBoxOverviewImageIn.UpdateImage(overviewImageIn);
plateCamera.RequestCaptureOneFrame();
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
pictureBoxPlateImage.UpdateImage(result.PlateImage.ToBitmap());
var overviewVideoFrame = overviewCamera.CurrentFrame;
pictureBoxOverviewImage.UpdateImage(overviewVideoFrame.ToBitmap());
var cardInformation = await apiController.GetCardInformation(cardNumber);
var saveLogResult = await apiController.SaveLog(LaneDirection.Out, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame, cardInformation.LogID.ToString());
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, cardInformation.TimeIn, DateTime.Now.GetTimeFormatted(), saveLogResult.Cost);
if (saveLogResult.Status)
{
if (isAutoOpenDoor)
{
OpenDoor(doorId);
}
}
else
{
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
}
}
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
{
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
}
private void OverviewCamera_OnOpenVideoStreamFailed(Mat videoFrame)
{
pictureBoxOverviewVideo.UpdateImage(videoFrame.ToBitmap());
}
private void ClearPlateAndOverviewImage()
{
pictureBoxPlateImage.UpdateImage(null);
pictureBoxOverviewImage.UpdateImage(null);
}
private void ClearPlateAndOverviewImageIn()
{
pictureBoxPlateImageIn.UpdateImage(null);
pictureBoxOverviewImageIn.UpdateImage(null);
}
private void OpenDoor(int doorId)
{
if (doorControlAccess.OpenDoor(doorId).HasError)
{
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
}
}
private async Task<FinalPlateResult> ProcessFrameImage(PlateProcessor plateProcessor, Mat frame, bool isRetryMode)
{
try
{
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
if (isRetryMode && !plateProcessor.IsPlateStringValid(finalPlateResult.PlateString))
{
Console.WriteLine("ProcessFrameImage Retry Mode");
Thread.Sleep(1000);
overviewCamera.RequestCaptureOneFrame();
finalPlateResult = await plateProcessor.ProcessPlate(frame);
}
return finalPlateResult;
}
catch (Exception ex)
{
Console.WriteLine($"ProcessFrameImage\texMessage: {ex.Message}");
return new FinalPlateResult
{
PlateImage = frame,
PlateString = string.Empty,
PlateType = PlateType.Square
};
}
}
public void Stop()
{
plateCamera.Stop();
overviewCamera.Stop();
}
public void Start()
{
plateCamera.Start();
overviewCamera.Start();
}
private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTimeIn, string cardTimeOut, string money)
{
lblCardNumber.UpdateLabel($"Số thẻ: {cardNumber}");
lblPlateString.UpdateLabel($"Biển số: {plateString}");
lblCardType.UpdateLabel($"Loại thẻ: {cardType}");
lblCardTime.UpdateLabel($"Vào: {cardTimeIn}");
lblCardTimeOut.UpdateLabel($"Ra: {cardTimeOut}");
int.TryParse(money, out int moneyAmount);
lblMoneyAmount.UpdateLabel($"Số tiền: {string.Format("{0:n0}", moneyAmount)} vnđ");
lblStatusInfo.UpdateLabel(string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} QUA", string.IsNullOrEmpty(plateString) ? Color.Red : Color.Green);
}
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)
{
try
{
pictureBoxOverviewVideo.UpdateImage(videoFrame.ToBitmap());
}
catch (Exception ex)
{
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
}
}
private void PlateCameraOnVideoFrameReceived(Mat videoFrame)
{
try
{
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
}
catch (Exception ex)
{
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
}
}
private void ConnectToDoorAccessControl()
{
if (!this.doorControlAccess.Connect().HasError)
{
_ = this.doorControlAccess.GetLogToReceiveNewCard();
}
else
{
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI TỚI C3200", Color.Purple);
}
}
private void LaneIn_Load(object sender, EventArgs e)
{
ConnectToDoorAccessControl();
}
}
}

View File

@ -117,10 +117,67 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="backgroundWorker2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>176, 17</value>
<metadata name="grbPlateRefernce.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="backgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>12, 17</value>
<metadata name="pictureBoxOverviewImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxPlateImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxOverviewImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxPlateImageIn.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="grbCardInformation.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCardType.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCardTimeOut.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCardTime.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblMoneyAmount.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblPlateString.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblCardNumber.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxPlateImage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxPlateVideo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="grbPlateCamera.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxOverviewImage.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="pictureBoxOverviewVideo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="grbOverviewCamera.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblLaneLabel.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblStatusInfo.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@ -39,12 +39,8 @@ namespace AIParkingApplication
Mat finalPlateImage;
if (!string.IsNullOrEmpty(plateOcrResultFromEngine.PlateString) && !string.IsNullOrEmpty(plateOcrResultFromEngine.PlateImageBase64))
{
byte[] imageData = Convert.FromBase64String(plateOcrResultFromEngine.PlateImageBase64);
using (var ms = new MemoryStream(imageData))
{
Bitmap image = new Bitmap(ms);
finalPlateImage = BitmapConverter.ToMat(image);
}
Bitmap plateBitmapImage = Util.ConvertFromBase64Image(plateOcrResultFromEngine.PlateImageBase64);
finalPlateImage = BitmapConverter.ToMat(plateBitmapImage);
}
else
{

View File

@ -28,7 +28,7 @@ namespace AIParkingApplication
{
if (IsHandleCreated)
{
lblDateTime.UpdateLabel(DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
lblDateTime.UpdateLabel(DateTime.Now.GetTimeFormatted());
PingResult pingDoorAccessControlResult = GetPingStatus(doorAccessControlDeviceIP);
lblPingTimeC3.UpdateLabel($"{pingDoorAccessControlResult.ReplyTime} ms", pingDoorAccessControlResult.BackColor, pingDoorAccessControlResult.ForeColor);

View File

@ -3,6 +3,7 @@ using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
@ -112,6 +113,21 @@ namespace AIParkingApplication
label.Text = text;
}));
}
public static Bitmap ConvertFromBase64Image(string base64ImageString)
{
byte[] imageData = Convert.FromBase64String(base64ImageString);
using (var memoryStream = new MemoryStream(imageData))
{
Bitmap image = new Bitmap(memoryStream);
return image;
}
}
public static string GetTimeFormatted(this DateTime dateTime)
{
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
}
}
public class PlateRequestEngineModel