Add packages: Microsoft.AspNet.WebApi.Client, add Newtonsoft.Json. Call Engine to get OCR result.
This commit is contained in:
parent
8a2317f816
commit
b731d24880
|
@ -37,6 +37,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -48,6 +51,9 @@
|
|||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
|
13
AIParkingApplication/LaneIn.Designer.cs
generated
13
AIParkingApplication/LaneIn.Designer.cs
generated
|
@ -41,6 +41,7 @@
|
|||
this.lblCardTime = new System.Windows.Forms.Label();
|
||||
this.lblPlateString = new System.Windows.Forms.Label();
|
||||
this.lblRecogizePlateStatus = new System.Windows.Forms.Label();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImage)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateVideo)).BeginInit();
|
||||
this.grbPlateCamera.SuspendLayout();
|
||||
|
@ -146,6 +147,7 @@
|
|||
//
|
||||
// grbCardInformation
|
||||
//
|
||||
this.grbCardInformation.Controls.Add(this.button1);
|
||||
this.grbCardInformation.Controls.Add(this.lblCardType);
|
||||
this.grbCardInformation.Controls.Add(this.lblCardTime);
|
||||
this.grbCardInformation.Controls.Add(this.lblPlateString);
|
||||
|
@ -190,6 +192,16 @@
|
|||
this.lblRecogizePlateStatus.Text = "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ";
|
||||
this.lblRecogizePlateStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(315, 24);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "button1";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// LaneIn
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -228,5 +240,6 @@
|
|||
private System.Windows.Forms.Label lblPlateString;
|
||||
private System.Windows.Forms.Label lblCardTime;
|
||||
private System.Windows.Forms.Label lblRecogizePlateStatus;
|
||||
private System.Windows.Forms.Button button1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp.Extensions;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
|
@ -9,7 +11,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
private Camera overviewCamera;
|
||||
private Camera plateCamera;
|
||||
private PlateDetector plateDetector;
|
||||
private PlateDetector squarePlateDetector;
|
||||
|
||||
public LaneIn()
|
||||
{
|
||||
|
@ -28,7 +30,7 @@ namespace AIParkingApplication
|
|||
overviewCamera.Startcapture();
|
||||
plateCamera.Startcapture();
|
||||
|
||||
plateDetector = new PlateDetector(PlateType.Square, PlateDetectorConstant.MIN_SIZE_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.MAX_SIZE_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.SCALE_FACTOR_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE);
|
||||
squarePlateDetector = new PlateDetector(PlateType.Square, PlateDetectorConstant.MIN_SIZE_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.MAX_SIZE_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.SCALE_FACTOR_DEFAULT_SQUARE_PLATE, PlateDetectorConstant.MIN_NEIGHBORS_DEFAULT_SQUARE_PLATE);
|
||||
}
|
||||
|
||||
private void OverviewCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||
|
@ -42,12 +44,37 @@ namespace AIParkingApplication
|
|||
|
||||
private void PlateCamera_OnOneVideoFrameRequested(Mat videoFrame)
|
||||
{
|
||||
Cv2.Resize(videoFrame, videoFrame, new Size(1280, 720));
|
||||
Mat result = plateDetector.DetectPlate(videoFrame);
|
||||
Cv2.Resize(videoFrame, videoFrame, new OpenCvSharp.Size(1280, 720));
|
||||
Mat result = squarePlateDetector.DetectPlate(videoFrame);
|
||||
|
||||
Cv2.Resize(result, result, new OpenCvSharp.Size(272, 272));
|
||||
var response = Util.SendEngineRequestAsync(result, PlateType.Square);
|
||||
|
||||
Bitmap resultPlateImage;
|
||||
OcrResult ocrResult = response.Result;
|
||||
if (!string.IsNullOrEmpty(ocrResult.Ocr) && !string.IsNullOrEmpty(ocrResult.Plate))
|
||||
{
|
||||
var imageData = Convert.FromBase64String(ocrResult.Plate);
|
||||
using (var ms = new MemoryStream(imageData))
|
||||
{
|
||||
resultPlateImage = new Bitmap(ms);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resultPlateImage = result.ToBitmap();
|
||||
}
|
||||
|
||||
|
||||
lblPlateString.Invoke(new Action(() =>
|
||||
{
|
||||
lblPlateString.Text = ocrResult.Ocr;
|
||||
}));
|
||||
|
||||
pictureBoxPlateImage.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBoxPlateImage.Image?.Dispose();
|
||||
pictureBoxPlateImage.Image = result.ToBitmap();
|
||||
pictureBoxPlateImage.Image = resultPlateImage;
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -69,10 +96,15 @@ namespace AIParkingApplication
|
|||
}));
|
||||
}
|
||||
|
||||
private void CaptureAllCamera(object sender, EventArgs e)
|
||||
private void CaptureAllCamera()
|
||||
{
|
||||
this.plateCamera.RequestCaptureOneFrame();
|
||||
this.overviewCamera.RequestCaptureOneFrame();
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
CaptureAllCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,4 +117,49 @@
|
|||
<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="button1.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="lblRecogizePlateStatus.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>
|
197
AIParkingApplication/LaneOut.Designer.cs
generated
197
AIParkingApplication/LaneOut.Designer.cs
generated
|
@ -28,50 +28,34 @@
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
|
||||
this.pictureBox5 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox6 = new System.Windows.Forms.PictureBox();
|
||||
this.grbPlateRefernce = new System.Windows.Forms.GroupBox();
|
||||
this.pictureBox2 = new System.Windows.Forms.PictureBox();
|
||||
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.pictureBox4 = new System.Windows.Forms.PictureBox();
|
||||
this.pictureBox3 = new System.Windows.Forms.PictureBox();
|
||||
this.grbOverviewCamera = new System.Windows.Forms.GroupBox();
|
||||
this.backgroundWorker2 = new System.ComponentModel.BackgroundWorker();
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.lblLaneLabel = new System.Windows.Forms.Label();
|
||||
this.lblCardNumber = new System.Windows.Forms.Label();
|
||||
this.lblMoneyAmount = new System.Windows.Forms.Label();
|
||||
this.lblCardType = new System.Windows.Forms.Label();
|
||||
this.grbCardInformation = new System.Windows.Forms.GroupBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
|
||||
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.lblCardNumber = new System.Windows.Forms.Label();
|
||||
this.grbPlateRefernce.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.grbPlateCamera.SuspendLayout();
|
||||
this.grbCardInformation.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
|
||||
this.grbOverviewCamera.SuspendLayout();
|
||||
this.grbCardInformation.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pictureBox5
|
||||
//
|
||||
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;
|
||||
//
|
||||
// pictureBox6
|
||||
//
|
||||
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;
|
||||
//
|
||||
// grbPlateRefernce
|
||||
//
|
||||
this.grbPlateRefernce.Controls.Add(this.pictureBox6);
|
||||
|
@ -84,13 +68,21 @@
|
|||
this.grbPlateRefernce.TabStop = false;
|
||||
this.grbPlateRefernce.Text = "THAM CHIẾU BIỂN SỐ VÀO";
|
||||
//
|
||||
// pictureBox2
|
||||
// pictureBox6
|
||||
//
|
||||
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.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;
|
||||
//
|
||||
// pictureBox5
|
||||
//
|
||||
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
|
||||
//
|
||||
|
@ -112,55 +104,6 @@
|
|||
this.grbPlateCamera.TabStop = false;
|
||||
this.grbPlateCamera.Text = "CAMERA BIỂN SỐ";
|
||||
//
|
||||
// pictureBox4
|
||||
//
|
||||
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;
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
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;
|
||||
//
|
||||
// grbOverviewCamera
|
||||
//
|
||||
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";
|
||||
//
|
||||
// lblLaneLabel
|
||||
//
|
||||
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";
|
||||
//
|
||||
// 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.TabIndex = 0;
|
||||
this.lblCardNumber.Text = "Số thẻ";
|
||||
//
|
||||
// lblMoneyAmount
|
||||
//
|
||||
this.lblMoneyAmount.AutoSize = true;
|
||||
|
@ -192,6 +135,63 @@
|
|||
this.grbCardInformation.TabStop = false;
|
||||
this.grbCardInformation.Text = "THÔNG TIN THẺ";
|
||||
//
|
||||
// lblLaneLabel
|
||||
//
|
||||
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";
|
||||
//
|
||||
// pictureBox4
|
||||
//
|
||||
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;
|
||||
//
|
||||
// pictureBox3
|
||||
//
|
||||
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;
|
||||
//
|
||||
// grbOverviewCamera
|
||||
//
|
||||
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;
|
||||
//
|
||||
// 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.TabIndex = 0;
|
||||
this.lblCardNumber.Text = "Số thẻ";
|
||||
//
|
||||
// LaneOut
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -203,39 +203,38 @@
|
|||
this.Controls.Add(this.grbPlateCamera);
|
||||
this.Name = "LaneOut";
|
||||
this.Size = new System.Drawing.Size(671, 694);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
|
||||
this.grbPlateRefernce.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox6)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox5)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.grbPlateCamera.ResumeLayout(false);
|
||||
this.grbCardInformation.ResumeLayout(false);
|
||||
this.grbCardInformation.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit();
|
||||
this.grbOverviewCamera.ResumeLayout(false);
|
||||
this.grbCardInformation.ResumeLayout(false);
|
||||
this.grbCardInformation.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker2;
|
||||
private System.Windows.Forms.PictureBox pictureBox5;
|
||||
private System.Windows.Forms.PictureBox pictureBox6;
|
||||
private System.Windows.Forms.GroupBox grbPlateRefernce;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
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 pictureBox4;
|
||||
private System.Windows.Forms.PictureBox pictureBox3;
|
||||
private System.Windows.Forms.GroupBox grbOverviewCamera;
|
||||
private System.Windows.Forms.PictureBox pictureBox2;
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker2;
|
||||
private System.ComponentModel.BackgroundWorker backgroundWorker1;
|
||||
private System.Windows.Forms.Label lblLaneLabel;
|
||||
private System.Windows.Forms.Label lblCardNumber;
|
||||
private System.Windows.Forms.Label lblMoneyAmount;
|
||||
private System.Windows.Forms.Label lblCardType;
|
||||
private System.Windows.Forms.GroupBox grbCardInformation;
|
||||
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.GroupBox grbOverviewCamera;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AIParkingApplication
|
||||
|
@ -34,10 +40,61 @@ namespace AIParkingApplication
|
|||
|
||||
return pingTask.Result.Result;
|
||||
}
|
||||
|
||||
public static async Task<OcrResult> SendEngineRequestAsync(Mat plateImage, PlateType plateType)
|
||||
{
|
||||
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
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"SendEngineRequest : {ex.Message}");
|
||||
return new OcrResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PlateRequestEngineModel
|
||||
{
|
||||
[JsonProperty("img64")]
|
||||
public string Img64 { get; set; }
|
||||
|
||||
[JsonProperty("mode")]
|
||||
public string Mode { get; set; }
|
||||
|
||||
[JsonProperty("display")]
|
||||
public string Display { get; set; }
|
||||
}
|
||||
|
||||
public class OcrResult
|
||||
{
|
||||
[JsonProperty("ocr")]
|
||||
public string Ocr { get; set; }
|
||||
|
||||
[JsonProperty("plate")]
|
||||
public string Plate { get; set; }
|
||||
}
|
||||
|
||||
public static class UtilConstant
|
||||
{
|
||||
public const int PING_TIMEOUT_MS = 500;
|
||||
|
||||
public const string HTTP_POST_METHOD = "POST";
|
||||
public const string HTTP_POST_CONTENTTYPE = "application/json";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
|
||||
<package id="OpenCvSharp4" version="4.3.0.20200524" targetFramework="net461" />
|
||||
<package id="OpenCvSharp4.runtime.win" version="4.3.0.20200524" targetFramework="net461" />
|
||||
<package id="OpenCvSharp4.Windows" version="4.3.0.20200524" targetFramework="net461" />
|
||||
|
|
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/.signature.p7s
vendored
Normal file
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/.signature.p7s
vendored
Normal file
Binary file not shown.
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/net45/System.Net.Http.Formatting.dll
vendored
Normal file
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/net45/System.Net.Http.Formatting.dll
vendored
Normal file
Binary file not shown.
2094
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/net45/System.Net.Http.Formatting.xml
vendored
Normal file
2094
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/net45/System.Net.Http.Formatting.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/netstandard2.0/System.Net.Http.Formatting.dll
vendored
Normal file
BIN
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/netstandard2.0/System.Net.Http.Formatting.dll
vendored
Normal file
Binary file not shown.
4025
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/netstandard2.0/System.Net.Http.Formatting.xml
vendored
Normal file
4025
packages/Microsoft.AspNet.WebApi.Client.5.2.7/lib/netstandard2.0/System.Net.Http.Formatting.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/.signature.p7s
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/.signature.p7s
vendored
Normal file
Binary file not shown.
20
packages/Newtonsoft.Json.12.0.3/LICENSE.md
vendored
Normal file
20
packages/Newtonsoft.Json.12.0.3/LICENSE.md
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2007 James Newton-King
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
BIN
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10298
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.xml
vendored
Normal file
10298
packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9446
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.xml
vendored
Normal file
9446
packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9646
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.xml
vendored
Normal file
9646
packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11262
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.xml
vendored
Normal file
11262
packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10950
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.xml
vendored
Normal file
10950
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11072
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.xml
vendored
Normal file
11072
packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
11237
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.xml
vendored
Normal file
11237
packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
9010
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
9010
packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll
vendored
Normal file
Binary file not shown.
10950
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
10950
packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.xml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/Newtonsoft.Json.12.0.3/packageIcon.png
vendored
Normal file
BIN
packages/Newtonsoft.Json.12.0.3/packageIcon.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
Loading…
Reference in New Issue
Block a user