Compare commits

...

11 Commits

12 changed files with 208 additions and 158 deletions

View File

@ -28,13 +28,37 @@
/// </summary>
private void InitializeComponent()
{
this.btnStopLaneIn = new System.Windows.Forms.Button();
this.btnStartLaneIn = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStopLaneIn
//
this.btnStopLaneIn.Location = new System.Drawing.Point(840, 205);
this.btnStopLaneIn.Name = "btnStopLaneIn";
this.btnStopLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStopLaneIn.TabIndex = 0;
this.btnStopLaneIn.Text = "Stop";
this.btnStopLaneIn.UseVisualStyleBackColor = true;
this.btnStopLaneIn.Click += new System.EventHandler(this.btnStopLaneIn_Click);
//
// btnStartLaneIn
//
this.btnStartLaneIn.Location = new System.Drawing.Point(840, 246);
this.btnStartLaneIn.Name = "btnStartLaneIn";
this.btnStartLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStartLaneIn.TabIndex = 0;
this.btnStartLaneIn.Text = "Start";
this.btnStartLaneIn.UseVisualStyleBackColor = true;
this.btnStartLaneIn.Click += new System.EventHandler(this.btnStartLaneIn_Click);
//
// AIParkingApplicationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1350, 729);
this.Controls.Add(this.btnStartLaneIn);
this.Controls.Add(this.btnStopLaneIn);
this.MinimumSize = new System.Drawing.Size(1366, 768);
this.Name = "AIParkingApplicationForm";
this.Text = "AIParking Application";
@ -43,6 +67,9 @@
}
#endregion
private System.Windows.Forms.Button btnStopLaneIn;
private System.Windows.Forms.Button btnStartLaneIn;
}
}

View File

@ -5,16 +5,18 @@ namespace AIParkingApplication
public partial class AIParkingApplicationForm : Form
{
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
private ApiController apiController;
private C3DeviceController c3Device;
private LaneIn laneIn;
public AIParkingApplicationForm()
{
InitializeComponent();
string serverBaseAddress = "http://localhost:80/";
ApiController apiController = new ApiController(serverBaseAddress);
C3DeviceController c3Device = new C3DeviceController("192.168.1.200");
LaneIn laneIn = new LaneIn(1, @"C:\HS_test.mp4", @"C:\HS_test.mp4", c3Device, apiController, true, false, true);
//LaneIn laneOut = new LaneIn();
apiController = new ApiController(serverBaseAddress);
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);
laneIn.Start();
//laneOut.Location = new System.Drawing.Point(550, 0);
//Controls.Add(laneOut);
@ -23,5 +25,15 @@ namespace AIParkingApplication
//Controls.Add(laneIn1);
//laneIn1.Start();
}
private void btnStopLaneIn_Click(object sender, System.EventArgs e)
{
laneIn.Stop();
}
private void btnStartLaneIn_Click(object sender, System.EventArgs e)
{
laneIn.Start();
}
}
}

View File

@ -94,12 +94,12 @@ namespace AIParkingApplication
}
//Neu Dicrection la Out thi logID la logID lay ve khi check the
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat PlateFrameImage, Mat FrameImage, string logID = "")
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat plateFrameImage, Mat frameImage, string logID = "")
{
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
string plateImageResultBase64 = Convert.ToBase64String(plateImageResult.ToBytes());
string PlateFrameImageBase64 = Convert.ToBase64String(PlateFrameImage.ToBytes());
string FrameImageBase64 = Convert.ToBase64String(FrameImage.ToBytes());
string PlateFrameImageBase64 = Convert.ToBase64String(plateFrameImage.ToBytes());
string FrameImageBase64 = Convert.ToBase64String(frameImage.ToBytes());
try
{
var request = new SaveLogModel

View File

@ -20,9 +20,9 @@ namespace AIParkingApplication
{
this.streamUrl = streamUrl;
isFrameRequested = false;
videoCapture = new VideoCapture();
readStreamThread = new Thread(new ThreadStart(ReadVideoStream));
readStreamThread.IsBackground = true;
videoCapture = new VideoCapture();
}
~Camera()
@ -48,13 +48,13 @@ namespace AIParkingApplication
public void ReadVideoStream()
{
Mat videoFrame = new Mat();
if (!videoCapture.Open(streamUrl))
{
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
return;
}
Mat videoFrame = new Mat();
while (true)
{
Thread.Sleep(50); //Stream Thread Sleep
@ -69,6 +69,10 @@ namespace AIParkingApplication
isFrameRequested = false;
}
}
else
{
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
}
}
}

View File

@ -40,7 +40,7 @@
this.grbCardInformation = new System.Windows.Forms.GroupBox();
this.lblCardTime = new System.Windows.Forms.Label();
this.lblPlateString = new System.Windows.Forms.Label();
this.lblRecogizePlateStatus = new System.Windows.Forms.Label();
this.lblStatusInfo = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).BeginInit();
this.grbPlateCamera.SuspendLayout();
@ -176,24 +176,24 @@
this.lblPlateString.TabIndex = 0;
this.lblPlateString.Text = "Biển số";
//
// lblRecogizePlateStatus
// lblStatusInfo
//
this.lblRecogizePlateStatus.BackColor = System.Drawing.Color.CornflowerBlue;
this.lblRecogizePlateStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblRecogizePlateStatus.ForeColor = System.Drawing.SystemColors.Control;
this.lblRecogizePlateStatus.Location = new System.Drawing.Point(1, 159);
this.lblRecogizePlateStatus.Margin = new System.Windows.Forms.Padding(0);
this.lblRecogizePlateStatus.Name = "lblRecogizePlateStatus";
this.lblRecogizePlateStatus.Size = new System.Drawing.Size(440, 40);
this.lblRecogizePlateStatus.TabIndex = 15;
this.lblRecogizePlateStatus.Text = "XIN CHÀO";
this.lblRecogizePlateStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
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(440, 40);
this.lblStatusInfo.TabIndex = 15;
this.lblStatusInfo.Text = "XIN CHÀO";
this.lblStatusInfo.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// LaneIn
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.lblRecogizePlateStatus);
this.Controls.Add(this.lblStatusInfo);
this.Controls.Add(this.grbPlateCamera);
this.Controls.Add(this.grbOverviewCamera);
this.Controls.Add(this.lblLaneLabel);
@ -201,6 +201,7 @@
this.Margin = new System.Windows.Forms.Padding(0);
this.Name = "LaneIn";
this.Size = new System.Drawing.Size(442, 692);
this.Load += new System.EventHandler(this.LaneIn_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).EndInit();
this.grbPlateCamera.ResumeLayout(false);
@ -226,6 +227,6 @@
private System.Windows.Forms.GroupBox grbCardInformation;
private System.Windows.Forms.Label lblPlateString;
private System.Windows.Forms.Label lblCardTime;
private System.Windows.Forms.Label lblRecogizePlateStatus;
private System.Windows.Forms.Label lblStatusInfo;
}
}

View File

@ -51,105 +51,73 @@ namespace AIParkingApplication
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
if (!this.c3Device.Connect().HasError)
{
_ = this.c3Device.GetLogToReceiveNewCard();
}
}
private async void C3Device_OnNewCardReceived(int doorId, string cardNumber)
{
ClearPlateAndOverviewImage();
var cardInfoResult = await apiController.GetCardInformation(cardNumber);
if (cardInfoResult.IsValid)
if (!cardInfoResult.IsValid)
{
if (cardInfoResult.Direction == "in")
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
return;
}
if (cardInfoResult.Direction != "in")
{
lblStatusInfo.UpdateLabel("THẺ ĐÃ ĐƯỢC SỬ DỤNG", Color.Red);
return;
}
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);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
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);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)
{
plateCamera.RequestCaptureOneFrame();
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
pictureBoxPlateImage.Invoke(new Action(() =>
{
pictureBoxPlateImage.Image?.Dispose();
pictureBoxPlateImage.Image = result.PlateImage.ToBitmap();
}));
var overviewVideoFrame = overviewCamera.CurrentFrame;
pictureBoxOverviewImage.Invoke(new Action(() =>
{
pictureBoxOverviewImage.Image?.Dispose();
pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap();
}));
var cardInformation = await apiController.GetCardInformation(cardNumber);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
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);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)
{
OpenDoor(doorId);
}
}
else
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ";
}));
}
}
else
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "THẺ ĐÃ ĐƯỢC SỬ DỤNG";
}));
OpenDoor(doorId);
}
}
else
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Purple;
lblRecogizePlateStatus.Text = "THẺ KHÔNG HỢP LỆ";
}));
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
}
}
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
{
pictureBoxPlateVideo.Invoke(new Action(() =>
{
pictureBoxPlateVideo.Image?.Dispose();
pictureBoxPlateVideo.Image = videoFrame.ToBitmap();
}));
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
}
private void OverviewCamera_OnOpenVideoStreamFailed(Mat videoFrame)
{
pictureBoxOverviewVideo.Invoke(new Action(() =>
{
pictureBoxOverviewImage.Image?.Dispose();
pictureBoxOverviewVideo.Image = videoFrame.ToBitmap();
}));
pictureBoxOverviewVideo.UpdateImage(videoFrame.ToBitmap());
}
private void ClearPlateAndOverviewImage()
{
pictureBoxPlateImage.UpdateImage(null);
pictureBoxOverviewImage.UpdateImage(null);
}
private void OpenDoor(int doorId)
{
if (c3Device.OpenDoor(doorId).HasError)
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI TỚI THIẾT BỊ MỞ CỬA";
}));
lblStatusInfo.UpdateLabel("KHÔNG THỂ MỞ CỬA", Color.Red);
}
}
@ -157,7 +125,6 @@ namespace AIParkingApplication
{
try
{
//TODO: check size before resizing
Cv2.Resize(frame, frame, new OpenCvSharp.Size(1280, 720));
FinalPlateResult finalPlateResult = await plateProcessor.ProcessPlate(frame);
@ -196,42 +163,18 @@ namespace AIParkingApplication
private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTime)
{
lblCardNumber.Invoke(new Action(() =>
{
lblCardNumber.Text = $"Số thẻ: {cardNumber}";
}));
lblPlateString.Invoke(new Action(() =>
{
lblPlateString.Text = $"Biển số: {plateString}";
}));
lblCardType.Invoke(new Action(() =>
{
lblCardType.Text = $"Loại thẻ: {cardType}";
}));
lblCardTime.Invoke(new Action(() =>
{
lblCardTime.Text = $"Thời gian: {cardTime}";
}));
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.Text = string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} VÀO";
lblRecogizePlateStatus.BackColor = string.IsNullOrEmpty(plateString) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
}));
lblCardNumber.UpdateLabel($"Số thẻ: {cardNumber}", lblCardNumber.BackColor);
lblPlateString.UpdateLabel($"Biển số: {plateString}", lblPlateString.BackColor);
lblCardType.UpdateLabel($"Loại thẻ: {cardType}", lblCardType.BackColor);
lblCardTime.UpdateLabel($"Thời gian: {cardTime}", lblCardTime.BackColor);
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);
}
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)
{
try
{
pictureBoxOverviewVideo.Invoke(new Action(() =>
{
pictureBoxOverviewVideo.Image?.Dispose();
pictureBoxOverviewVideo.Image = videoFrame.ToBitmap();
}));
pictureBoxOverviewVideo.UpdateImage(videoFrame.ToBitmap());
}
catch (Exception ex)
{
@ -243,16 +186,29 @@ namespace AIParkingApplication
{
try
{
pictureBoxPlateVideo.Invoke(new Action(() =>
{
pictureBoxPlateVideo.Image?.Dispose();
pictureBoxPlateVideo.Image = videoFrame.ToBitmap();
}));
pictureBoxPlateVideo.UpdateImage(videoFrame.ToBitmap());
}
catch (Exception ex)
{
Console.WriteLine($"{Util.GetCurrentMethodName()}\texMessage: {ex.Message}");
}
}
private void ConnectToDoorAccessControl()
{
if (!this.c3Device.Connect().HasError)
{
_ = this.c3Device.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,4 +117,46 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<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="lblCardType.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="grbCardInformation.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="lblPlateString.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

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Forms;
namespace AIParkingApplication
{

View File

@ -71,7 +71,6 @@ namespace AIParkingApplication
}
Console.WriteLine($"GetBiggestPlate - Width: {biggestPlateRect.Width}\tHeight: {biggestPlateRect.Height}");
Rect extendedRect = ExtendPlateRect(biggestPlateRect);
//TODO: check oversize frame
Mat plateImage;
try
{

View File

@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following

View File

@ -3,7 +3,6 @@ using System.Windows.Forms;
using System.Threading;
using Newtonsoft.Json;
using System.Net.Http;
using System.Xml.Serialization;
namespace AIParkingApplication
{

View File

@ -2,14 +2,18 @@
using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AIParkingApplication
{
public static class Util
{
private static HttpClient httpClientEngine = new HttpClient { BaseAddress = new Uri("http://localhost:8080/"), Timeout = TimeSpan.FromMilliseconds(5000) };
public static bool IsPingable(string destinationIPAddress, out long pingTime, int timeOut = UtilConstant.PING_TIMEOUT_MS)
{
var pingTask = Task.Factory.StartNew(async () =>
@ -55,19 +59,16 @@ namespace AIParkingApplication
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
try
{
using (var client = new HttpClient { BaseAddress = new Uri("http://localhost:8080/"), Timeout = TimeSpan.FromMilliseconds(5000) })
var request = new PlateRequestEngineModel
{
var request = new PlateRequestEngineModel
{
Img64 = plateImageBase64,
Mode = plateType == PlateType.Square ? "square" : "long",
Display = "full"
};
HttpResponseMessage response = await client.PostAsJsonAsync("/get-from-frame", request);
response.EnsureSuccessStatusCode();
var ocrResult = await response.Content.ReadAsAsync<OcrResult>();
return ocrResult;
}
Img64 = plateImageBase64,
Mode = plateType == PlateType.Square ? "square" : "long",
Display = "full"
};
HttpResponseMessage response = await httpClientEngine.PostAsJsonAsync("/get-from-frame", request);
response.EnsureSuccessStatusCode();
var ocrResult = await response.Content.ReadAsAsync<OcrResult>();
return ocrResult;
}
catch (Exception ex)
{
@ -75,6 +76,24 @@ namespace AIParkingApplication
return new OcrResult();
}
}
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
{
pictureBox.Invoke(new Action(() =>
{
pictureBox.Image?.Dispose();
pictureBox.Image = image;
}));
}
public static void UpdateLabel(this Label label, string text, Color color)
{
label.Invoke(new Action(() =>
{
label.BackColor = color;
label.Text = text;
}));
}
}
public class PlateRequestEngineModel