diff --git a/AIParkingApplication/LaneIn.Designer.cs b/AIParkingApplication/LaneIn.Designer.cs
index 621e917..9b48e6a 100644
--- a/AIParkingApplication/LaneIn.Designer.cs
+++ b/AIParkingApplication/LaneIn.Designer.cs
@@ -69,6 +69,10 @@
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxPlateVideo.TabIndex = 0;
this.pictureBoxPlateVideo.TabStop = false;
+ this.pictureBoxPlateVideo.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxPlateVideo_Paint);
+ this.pictureBoxPlateVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseDown);
+ this.pictureBoxPlateVideo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseMove);
+ this.pictureBoxPlateVideo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseUp);
//
// grbPlateCamera
//
diff --git a/AIParkingApplication/LaneIn.cs b/AIParkingApplication/LaneIn.cs
index 20dd437..2fa3881 100644
--- a/AIParkingApplication/LaneIn.cs
+++ b/AIParkingApplication/LaneIn.cs
@@ -25,6 +25,11 @@ namespace AIParkingApplication
private ApiController apiController;
private Logger appLogger;
+ private System.Drawing.Point StartPoint { get; set; }
+ private System.Drawing.Point CurrentCursorPosition { get; set; }
+ private Rectangle roiBox;
+ private bool IsDrawBox { get; set; }
+
public LaneIn(int doorId,
string cameraId,
string plateStream,
@@ -235,5 +240,43 @@ namespace AIParkingApplication
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
ConnectToDoorAccessControl();
}
+
+ private void pictureBoxPlateVideo_MouseDown(object sender, MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Left)
+ {
+ StartPoint = e.Location;
+ roiBox = new Rectangle(StartPoint, new System.Drawing.Size(0, 0));
+ IsDrawBox = true;
+ }
+ }
+
+ private void pictureBoxPlateVideo_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (IsDrawBox)
+ {
+ CurrentCursorPosition = e.Location;
+ roiBox.Width = CurrentCursorPosition.X - StartPoint.X;
+ roiBox.Height = CurrentCursorPosition.Y - StartPoint.Y;
+ }
+ Refresh();
+ }
+
+ private void pictureBoxPlateVideo_MouseUp(object sender, MouseEventArgs e)
+ {
+ if (StartPoint.X + roiBox.Width > pictureBoxPlateVideo.Width || StartPoint.Y + roiBox.Height > pictureBoxPlateVideo.Height)
+ {
+ roiBox.X = roiBox.Y = 0;
+ roiBox.Width = pictureBoxPlateVideo.Width;
+ roiBox.Height = pictureBoxPlateVideo.Height;
+ }
+ IsDrawBox = false;
+ }
+
+ private void pictureBoxPlateVideo_Paint(object sender, PaintEventArgs e)
+ {
+ Pen redPen = new Pen(Color.FromArgb(255, 255, 0, 0), 4);
+ e.Graphics.DrawRectangle(redPen, roiBox);
+ }
}
}
\ No newline at end of file
diff --git a/AIParkingApplication/LaneIn.resx b/AIParkingApplication/LaneIn.resx
index 17cd4f2..1cbfb72 100644
--- a/AIParkingApplication/LaneIn.resx
+++ b/AIParkingApplication/LaneIn.resx
@@ -153,6 +153,12 @@
True
+
+ True
+
+
+ True
+
True
diff --git a/AIParkingApplication/LaneOut.Designer.cs b/AIParkingApplication/LaneOut.Designer.cs
index eb45171..09e8b4a 100644
--- a/AIParkingApplication/LaneOut.Designer.cs
+++ b/AIParkingApplication/LaneOut.Designer.cs
@@ -182,6 +182,10 @@
this.pictureBoxPlateVideo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBoxPlateVideo.TabIndex = 0;
this.pictureBoxPlateVideo.TabStop = false;
+ this.pictureBoxPlateVideo.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBoxPlateVideo_Paint);
+ this.pictureBoxPlateVideo.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseDown);
+ this.pictureBoxPlateVideo.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseMove);
+ this.pictureBoxPlateVideo.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBoxPlateVideo_MouseUp);
//
// grbPlateCamera
//
diff --git a/AIParkingApplication/LaneOut.cs b/AIParkingApplication/LaneOut.cs
index 517dc10..d2fcf09 100644
--- a/AIParkingApplication/LaneOut.cs
+++ b/AIParkingApplication/LaneOut.cs
@@ -27,6 +27,11 @@ namespace AIParkingApplication
private Logger appLogger;
private bool isUsePrinter;
+ private System.Drawing.Point StartPoint { get; set; }
+ private System.Drawing.Point CurrentCursorPosition { get; set; }
+ private Rectangle roiBox;
+ private bool IsDrawBox { get; set; }
+
public LaneOut(int doorId,
string cameraId,
string plateStream,
@@ -315,5 +320,43 @@ namespace AIParkingApplication
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
}
+
+ private void pictureBoxPlateVideo_MouseDown(object sender, MouseEventArgs e)
+ {
+ if (e.Button == MouseButtons.Left)
+ {
+ StartPoint = e.Location;
+ roiBox = new Rectangle(StartPoint, new System.Drawing.Size(0, 0));
+ IsDrawBox = true;
+ }
+ }
+
+ private void pictureBoxPlateVideo_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (IsDrawBox)
+ {
+ CurrentCursorPosition = e.Location;
+ roiBox.Width = CurrentCursorPosition.X - StartPoint.X;
+ roiBox.Height = CurrentCursorPosition.Y - StartPoint.Y;
+ }
+ Refresh();
+ }
+
+ private void pictureBoxPlateVideo_MouseUp(object sender, MouseEventArgs e)
+ {
+ if (StartPoint.X + roiBox.Width > pictureBoxPlateVideo.Width || StartPoint.Y + roiBox.Height > pictureBoxPlateVideo.Height)
+ {
+ roiBox.X = roiBox.Y = 0;
+ roiBox.Width = pictureBoxPlateVideo.Width;
+ roiBox.Height = pictureBoxPlateVideo.Height;
+ }
+ IsDrawBox = false;
+ }
+
+ private void pictureBoxPlateVideo_Paint(object sender, PaintEventArgs e)
+ {
+ Pen redPen = new Pen(Color.FromArgb(255, 255, 0, 0), 4);
+ e.Graphics.DrawRectangle(redPen, roiBox);
+ }
}
}
diff --git a/AIParkingApplication/LaneOut.resx b/AIParkingApplication/LaneOut.resx
index db4e197..010a19c 100644
--- a/AIParkingApplication/LaneOut.resx
+++ b/AIParkingApplication/LaneOut.resx
@@ -126,6 +126,12 @@
True
+
+ True
+
+
+ True
+
True
@@ -147,6 +153,24 @@
True
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
+
+ True
+
True