Compare commits
No commits in common. "3f22ddceb1e34b6c71439c517750558d4087d413" and "8a8e8c84817d33e9deddc80372b59ad6e3e58fd1" have entirely different histories.
3f22ddceb1
...
8a8e8c8481
|
@ -139,9 +139,6 @@
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Images\CantConnectCamera.jpg">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="plate.xml">
|
<Content Include="plate.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -149,7 +146,6 @@
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -28,37 +28,13 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.button1 = new System.Windows.Forms.Button();
|
|
||||||
this.button2 = new System.Windows.Forms.Button();
|
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// button1
|
|
||||||
//
|
|
||||||
this.button1.Location = new System.Drawing.Point(840, 223);
|
|
||||||
this.button1.Name = "button1";
|
|
||||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.button1.TabIndex = 0;
|
|
||||||
this.button1.Text = "button1";
|
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
|
||||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
|
||||||
//
|
|
||||||
// button2
|
|
||||||
//
|
|
||||||
this.button2.Location = new System.Drawing.Point(840, 267);
|
|
||||||
this.button2.Name = "button2";
|
|
||||||
this.button2.Size = new System.Drawing.Size(75, 23);
|
|
||||||
this.button2.TabIndex = 0;
|
|
||||||
this.button2.Text = "button1";
|
|
||||||
this.button2.UseVisualStyleBackColor = true;
|
|
||||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
|
||||||
//
|
|
||||||
// AIParkingApplicationForm
|
// AIParkingApplicationForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1350, 729);
|
this.ClientSize = new System.Drawing.Size(1350, 729);
|
||||||
this.Controls.Add(this.button2);
|
|
||||||
this.Controls.Add(this.button1);
|
|
||||||
this.MinimumSize = new System.Drawing.Size(1366, 768);
|
this.MinimumSize = new System.Drawing.Size(1366, 768);
|
||||||
this.Name = "AIParkingApplicationForm";
|
this.Name = "AIParkingApplicationForm";
|
||||||
this.Text = "AIParking Application";
|
this.Text = "AIParking Application";
|
||||||
|
@ -67,9 +43,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Button button1;
|
|
||||||
private System.Windows.Forms.Button button2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,26 +4,14 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
public partial class AIParkingApplicationForm : Form
|
public partial class AIParkingApplicationForm : Form
|
||||||
{
|
{
|
||||||
//@"C:\CongRa_1.mp4"; @"C:\HS_test.mp4"; @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov"
|
|
||||||
LaneIn laneIn = new LaneIn(@"C:\HS_test.mp4", @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", true, false, false);
|
|
||||||
public AIParkingApplicationForm()
|
public AIParkingApplicationForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
LaneIn laneIn = new LaneIn(@"C:\HS_test.mp4", @"rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", true, true); //@"C:\CongRa_1.mp4";
|
||||||
//LaneIn laneOut = new LaneIn();
|
//LaneIn laneOut = new LaneIn();
|
||||||
Controls.Add(laneIn);
|
Controls.Add(laneIn);
|
||||||
//laneOut.Location = new System.Drawing.Point(550, 0);
|
//laneOut.Location = new System.Drawing.Point(550, 0);
|
||||||
//Controls.Add(laneOut);
|
//Controls.Add(laneOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void button1_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
laneIn.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void button2_Click(object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
laneIn.Start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,5 @@
|
||||||
public const string ERROR_TITLE = "Lỗi";
|
public const string ERROR_TITLE = "Lỗi";
|
||||||
public const string DATETIME_FORMAT = "HH:mm:ss dd/MM/yyyy";
|
public const string DATETIME_FORMAT = "HH:mm:ss dd/MM/yyyy";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public const string CAMERA_FAILED_IMAGE_PATH = @"Images\CantConnectCamera.jpg";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
public delegate void C3DeviceEvent(int doorId, string cardNumber);
|
public delegate void C3EventHandler(ActionResult actionResult);
|
||||||
|
public delegate void C3RTLogEventHandler(ActionResult actionResult, int doorId, string cardNumber);
|
||||||
|
|
||||||
public class C3DeviceController
|
public class C3DeviceController
|
||||||
{
|
{
|
||||||
|
@ -14,10 +14,17 @@ namespace AIParkingApplication
|
||||||
private IntPtr oneTimeConnectedParamHandler;
|
private IntPtr oneTimeConnectedParamHandler;
|
||||||
private string connectionString;
|
private string connectionString;
|
||||||
private bool isReconnected;
|
private bool isReconnected;
|
||||||
|
public event C3EventHandler OnConnected;
|
||||||
|
public event C3EventHandler OnConnectFailed;
|
||||||
|
public event C3EventHandler OnReconnect;
|
||||||
|
public event C3EventHandler OnDoorOpenned;
|
||||||
|
public event C3EventHandler OnDoorOpenFailed;
|
||||||
|
public event C3EventHandler OnPingFailed;
|
||||||
|
public event C3EventHandler OnDisconnected;
|
||||||
|
public event C3RTLogEventHandler OnGetRTLog;
|
||||||
|
public event C3EventHandler OnGetRTLogFailed;
|
||||||
private int reconnectCounter;
|
private int reconnectCounter;
|
||||||
|
|
||||||
public event C3DeviceEvent OnNewCardReceived;
|
|
||||||
|
|
||||||
public C3DeviceController(string ipAddress, int port = C3Constant.DEFAULT_C3_PORT)
|
public C3DeviceController(string ipAddress, int port = C3Constant.DEFAULT_C3_PORT)
|
||||||
{
|
{
|
||||||
IPAddress = ipAddress;
|
IPAddress = ipAddress;
|
||||||
|
@ -60,6 +67,7 @@ namespace AIParkingApplication
|
||||||
HasError = false,
|
HasError = false,
|
||||||
Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
Message = string.Format(C3Constant.CONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnConnected?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -69,6 +77,7 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress, PullLastError())
|
||||||
};
|
};
|
||||||
|
OnConnectFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +88,8 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnPingFailed?.Invoke(result);
|
||||||
|
OnConnectFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,6 +106,7 @@ namespace AIParkingApplication
|
||||||
HasError = false,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnDoorOpenned?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -104,6 +116,7 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnDoorOpenFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,23 +127,11 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
HasError = true,
|
||||||
Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
Message = string.Format(C3Constant.NOT_CONNECTTED, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnDoorOpenFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GetLogToReceiveNewCard()
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
await Task.Delay(1000);
|
|
||||||
ActionResult getRTLogResult = GetRTLog(out int doorId, out string cardNumber);
|
|
||||||
if (doorId != C3Constant.DEFAULT_DOOR_ID && cardNumber != C3Constant.DEFAULT_CARD_NUMBER)
|
|
||||||
{
|
|
||||||
OnNewCardReceived?.Invoke(doorId, cardNumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ActionResult GetRTLog(out int doorId, out string cardNumber)
|
public ActionResult GetRTLog(out int doorId, out string cardNumber)
|
||||||
{
|
{
|
||||||
doorId = C3Constant.DEFAULT_DOOR_ID;
|
doorId = C3Constant.DEFAULT_DOOR_ID;
|
||||||
|
@ -144,6 +145,7 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnPingFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +167,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
HasError = false
|
HasError = false
|
||||||
};
|
};
|
||||||
|
OnGetRTLog?.Invoke(result, doorId, cardNumber);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -179,6 +182,7 @@ namespace AIParkingApplication
|
||||||
reconnectCounter = 0;
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress);
|
||||||
}
|
}
|
||||||
|
OnReconnect?.Invoke(reconnectResult);
|
||||||
return reconnectResult;
|
return reconnectResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +191,7 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnGetRTLogFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,6 +204,7 @@ namespace AIParkingApplication
|
||||||
HasError = true,
|
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.ToString(AppConstant.DATETIME_FORMAT), IPAddress, ex.Message)
|
||||||
};
|
};
|
||||||
|
OnGetRTLogFailed?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,6 +218,7 @@ namespace AIParkingApplication
|
||||||
HasError = false,
|
HasError = false,
|
||||||
Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
Message = string.Format(C3Constant.DISCONNECTED_SUCCESSFULLY, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), IPAddress)
|
||||||
};
|
};
|
||||||
|
OnDisconnected?.Invoke(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ using System.Threading;
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
public delegate void CameraEvent(Mat videoFrame);
|
public delegate void CameraEvent(Mat videoFrame);
|
||||||
|
|
||||||
public class Camera
|
public class Camera
|
||||||
{
|
{
|
||||||
private string streamUrl;
|
private string streamUrl;
|
||||||
|
@ -13,7 +12,6 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public event CameraEvent OnVideoFrameReceived;
|
public event CameraEvent OnVideoFrameReceived;
|
||||||
public event CameraEvent OnOneVideoFrameRequested;
|
public event CameraEvent OnOneVideoFrameRequested;
|
||||||
public event CameraEvent OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
public Camera(string streamUrl)
|
public Camera(string streamUrl)
|
||||||
{
|
{
|
||||||
|
@ -45,11 +43,10 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
public void ReadVideoStream()
|
public void ReadVideoStream()
|
||||||
{
|
{
|
||||||
VideoCapture videoCapture = new VideoCapture(); //TODO: Need to dispose this videoCapture?
|
VideoCapture videoCapture = new VideoCapture();
|
||||||
Mat videoFrame = new Mat();
|
Mat videoFrame = new Mat();
|
||||||
if (!videoCapture.Open(streamUrl))
|
if (!videoCapture.Open(streamUrl))
|
||||||
{
|
{
|
||||||
OnOpenVideoStreamFailed?.Invoke(Cv2.ImRead(AppConstant.CAMERA_FAILED_IMAGE_PATH));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 52 KiB |
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using OpenCvSharp;
|
||||||
|
using OpenCvSharp.Extensions;
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenCvSharp;
|
|
||||||
using OpenCvSharp.Extensions;
|
|
||||||
|
|
||||||
namespace AIParkingApplication
|
namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
|
@ -12,82 +12,28 @@ namespace AIParkingApplication
|
||||||
private Camera overviewCamera;
|
private Camera overviewCamera;
|
||||||
private Camera plateCamera;
|
private Camera plateCamera;
|
||||||
private PlateProcessor plateProcessor;
|
private PlateProcessor plateProcessor;
|
||||||
private int doorId;
|
|
||||||
private bool isSupportSquarePlate;
|
private bool isSupportSquarePlate;
|
||||||
private bool isSupportLongPlate;
|
private bool isSupportLongPlate;
|
||||||
private bool isAutoOpenDoor;
|
|
||||||
private bool isRetryMode;
|
private bool isRetryMode;
|
||||||
private bool isRetryModeUntilOk; //TODO: Test mode
|
private bool isRetryModeUntilOk; //TODO: Test mode
|
||||||
private C3DeviceController c3Device;
|
|
||||||
|
|
||||||
public LaneIn(int doorId,
|
public LaneIn(string plateStream, string overviewStream, bool isSupportSquarePlate = true, bool isSupportLongPlate = false, bool isRetryMode = false, bool isRetryModeUntilOk = false)
|
||||||
string plateStream,
|
|
||||||
string overviewStream,
|
|
||||||
C3DeviceController c3Device,
|
|
||||||
bool isSupportSquarePlate = true,
|
|
||||||
bool isSupportLongPlate = false,
|
|
||||||
bool isAutoOpenDoor = true,
|
|
||||||
bool isRetryMode = false,
|
|
||||||
bool isRetryModeUntilOk = false)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.doorId = doorId;
|
|
||||||
this.isSupportSquarePlate = isSupportSquarePlate;
|
this.isSupportSquarePlate = isSupportSquarePlate;
|
||||||
this.isSupportLongPlate = isSupportLongPlate;
|
this.isSupportLongPlate = isSupportLongPlate;
|
||||||
this.isAutoOpenDoor = isAutoOpenDoor;
|
|
||||||
this.isRetryMode = isRetryMode;
|
this.isRetryMode = isRetryMode;
|
||||||
this.isRetryModeUntilOk = isRetryModeUntilOk;
|
this.isRetryModeUntilOk = isRetryModeUntilOk;
|
||||||
overviewCamera = new Camera(overviewStream);
|
overviewCamera = new Camera(overviewStream);
|
||||||
plateCamera = new Camera(plateStream);
|
plateCamera = new Camera(plateStream);
|
||||||
this.c3Device = c3Device;
|
|
||||||
this.c3Device.OnNewCardReceived += C3Device_OnNewCardReceived;
|
|
||||||
|
|
||||||
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
||||||
plateCamera.OnOneVideoFrameRequested += PlateCamera_OnOneVideoFrameRequested;
|
plateCamera.OnOneVideoFrameRequested += PlateCamera_OnOneVideoFrameRequested;
|
||||||
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
||||||
overviewCamera.OnOneVideoFrameRequested += OverviewCamera_OnOneVideoFrameRequested;
|
overviewCamera.OnOneVideoFrameRequested += OverviewCamera_OnOneVideoFrameRequested;
|
||||||
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
|
plateProcessor = new PlateProcessor(this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||||
|
|
||||||
if (!this.c3Device.Connect().HasError)
|
|
||||||
{
|
|
||||||
_ = this.c3Device.GetLogToReceiveNewCard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void C3Device_OnNewCardReceived(int doorId, string cardNumber)
|
|
||||||
{
|
|
||||||
//Request To Capture And Process Frame.
|
|
||||||
CaptureAllCamera();
|
|
||||||
//Request Card Info
|
|
||||||
if (isAutoOpenDoor)
|
|
||||||
{
|
|
||||||
if (this.doorId == doorId)
|
|
||||||
{
|
|
||||||
c3Device.OpenDoor(doorId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void PlateCamera_OnOpenVideoStreamFailed(Mat videoFrame)
|
|
||||||
{
|
|
||||||
pictureBoxPlateVideo.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
pictureBoxPlateVideo.Image?.Dispose();
|
|
||||||
pictureBoxPlateVideo.Image = videoFrame.ToBitmap();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OverviewCamera_OnOpenVideoStreamFailed(Mat videoFrame)
|
|
||||||
{
|
|
||||||
pictureBoxOverviewVideo.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
pictureBoxOverviewImage.Image?.Dispose();
|
|
||||||
pictureBoxOverviewVideo.Image = videoFrame.ToBitmap();
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OverviewCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
private void OverviewCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||||
|
@ -180,7 +126,7 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
lblCardTime.Text = $"Thời gian: {cardTime}";
|
lblCardTime.Text = $"Thời gian: {cardTime}";
|
||||||
}));
|
}));
|
||||||
|
|
||||||
lblRecogizePlateStatus.Invoke(new Action(() =>
|
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.Text = string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} VÀO";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user