diff --git a/HisenceYoloDetection/CheckDiffSciHelper.cs b/HisenceYoloDetection/CheckDiffSciHelper.cs
index 580fc6a..ddea8f9 100644
--- a/HisenceYoloDetection/CheckDiffSciHelper.cs
+++ b/HisenceYoloDetection/CheckDiffSciHelper.cs
@@ -77,6 +77,7 @@ namespace HisenceYoloDetection
detrect.Width += 20;
detrect.Height += 60;
Mat matCutblack1 = new Mat(thr1, sqlrect);
+
if (IfWhiteWord)
{
matCutblack1.SetTo(Scalar.Black);
@@ -268,7 +269,7 @@ namespace HisenceYoloDetection
}
else
{
- Cv2.Threshold(gimg1, thr1, 100, 255, ThresholdTypes.Binary );//| ThresholdTypes.Otsu
+ Cv2.Threshold(gimg1, thr1, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
}
@@ -292,7 +293,7 @@ namespace HisenceYoloDetection
}
else
{
- Cv2.Threshold(gimg2, thr2, 100, 255, ThresholdTypes.Binary );//| ThresholdTypes.Otsu
+ Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
}
@@ -324,35 +325,36 @@ namespace HisenceYoloDetection
DateTime dt = DateTime.Now;
string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
- //string savePath4 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr1.png");
- //// 保存结果
+ string savePath4 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr1.png");
+ // 保存结果
- //Cv2.ImWrite(savePath4, thr1);
- //string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr2.png");
- //// 保存结果
+ Cv2.ImWrite(savePath4, thr1);
+ string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr2.png");
+ // 保存结果
- //Cv2.ImWrite(savePath3, thr2);
+ Cv2.ImWrite(savePath3, thr2);
// 创建卷积核
-
- Mat filter1 = new Mat(15,15, MatType.CV_32F, new Scalar(0));
- filter1.Row(7).SetTo(new Scalar(0.025));
- filter1.Col(7).SetTo(new Scalar(0.025));
-
+ Mat filter1 = new Mat(15, 15, MatType.CV_32F, new Scalar(0));
+ filter1.Row(7).SetTo(new Scalar(0.025));
+ filter1.Row(7).SetTo(new Scalar(0.025));
+
+
+
// 应用卷积
Mat final_result1 = new Mat();
Cv2.Filter2D(thr1, final_result1, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
Cv2.Filter2D(final_result1, final_result1, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
Cv2.Filter2D(final_result1, final_result1, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
-
+
//Cv2.Filter2D(final_result1, final_result1, -1, filter2, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
Mat final_result2 = new Mat();
Cv2.Filter2D(thr2, final_result2, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
Cv2.Filter2D(final_result2, final_result2, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
Cv2.Filter2D(final_result2, final_result2, -1, filter1, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
-
+
//Cv2.Filter2D(final_result2, final_result2, -1, filter2, anchor: new Point(-1, -1), 0, BorderTypes.Reflect);
//裁剪才行
@@ -377,25 +379,25 @@ namespace HisenceYoloDetection
Mat devIMG_ = new Mat();
Cv2.Subtract(final_result1, final_result2, devIMG);
Cv2.Subtract(final_result2, final_result1, devIMG_);
- //string savePathd = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "devIMG.png");
- //// 保存结果
-
- //Cv2.ImWrite(savePathd, devIMG);
- //string savePathd1 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "devIMG_.png");
- //// 保存结果
-
- //Cv2.ImWrite(savePathd1, devIMG_);
+ string savePathd = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "devIMG.png");
+ // 保存结果
+
+ Cv2.ImWrite(savePathd, devIMG);
+ string savePathd1 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "devIMG_.png");
+ // 保存结果
+
+ Cv2.ImWrite(savePathd1, devIMG_);
// 对差异图像应用阈值
- Cv2.Threshold(devIMG, devIMG, 45, 255, ThresholdTypes.Binary);
- Cv2.Threshold(devIMG_, devIMG_, 45, 255, ThresholdTypes.Binary);
+ Cv2.Threshold(devIMG, devIMG, 9, 255, ThresholdTypes.Binary);
+ Cv2.Threshold(devIMG_, devIMG_, 9, 255, ThresholdTypes.Binary);
// 结合差异
Mat sumIMG = new Mat();
Cv2.Add(devIMG, devIMG_, sumIMG);
- //string savePaths = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "sumIMG.png");
- //// 保存结果
+ string savePaths = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "sumIMG.png");
+ // 保存结果
- //Cv2.ImWrite(savePaths, sumIMG);
+ Cv2.ImWrite(savePaths, sumIMG);
// 应用形态学操作
Mat kernelCL = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(3, 3));
Mat blackhatImg = new Mat();
@@ -407,7 +409,7 @@ namespace HisenceYoloDetection
bool isMatch = true;
foreach (var contour in contours)
{
- if (Cv2.ContourArea(contour) <= 100)
+ if (Cv2.ContourArea(contour) <= 500)
{
Cv2.DrawContours(blackhatImg, new Point[][] { contour }, -1, Scalar.Black, thickness: Cv2.FILLED);
// 框选轮廓
@@ -434,3 +436,4 @@ namespace HisenceYoloDetection
}
}
}
+
\ No newline at end of file
diff --git a/HisenceYoloDetection/MainForm.Designer.cs b/HisenceYoloDetection/MainForm.Designer.cs
index 8fe48f9..ca1ee67 100644
--- a/HisenceYoloDetection/MainForm.Designer.cs
+++ b/HisenceYoloDetection/MainForm.Designer.cs
@@ -29,10 +29,10 @@
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
- OpenCvSharp.Mat mat4 = new OpenCvSharp.Mat();
- OpenCvSharp.Mat mat3 = new OpenCvSharp.Mat();
- OpenCvSharp.Mat mat2 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat1 = new OpenCvSharp.Mat();
+ OpenCvSharp.Mat mat2 = new OpenCvSharp.Mat();
+ OpenCvSharp.Mat mat3 = new OpenCvSharp.Mat();
+ OpenCvSharp.Mat mat4 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat5 = new OpenCvSharp.Mat();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
tabPage2 = new TabPage();
@@ -125,9 +125,14 @@
panel4 = new Panel();
panel5 = new Panel();
groupBox2 = new GroupBox();
+ canvas4 = new XKRS.UI.Canvas();
+ canvas3 = new XKRS.UI.Canvas();
+ canvas2 = new XKRS.UI.Canvas();
+ canvas1 = new XKRS.UI.Canvas();
originMatShow = new PictureBox();
ResultMatShow = new PictureBox();
panel8 = new Panel();
+ canvas5 = new XKRS.UI.Canvas();
textBox2 = new TextBox();
label36 = new Label();
textBox1 = new TextBox();
@@ -189,11 +194,6 @@
richTextBox1 = new RichTextBox();
contextMenuStrip1 = new ContextMenuStrip(components);
backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
- canvas1 = new XKRS.UI.Canvas();
- canvas2 = new XKRS.UI.Canvas();
- canvas3 = new XKRS.UI.Canvas();
- canvas4 = new XKRS.UI.Canvas();
- canvas5 = new XKRS.UI.Canvas();
tabPage2.SuspendLayout();
panel1.SuspendLayout();
groupBox5.SuspendLayout();
@@ -271,7 +271,7 @@
DistanceShow.Margin = new Padding(4, 2, 4, 2);
DistanceShow.Name = "DistanceShow";
DistanceShow.ReadOnly = true;
- DistanceShow.Size = new Size(127, 23);
+ DistanceShow.Size = new Size(117, 23);
DistanceShow.TabIndex = 10;
//
// label21
@@ -322,11 +322,11 @@
groupBox4.Controls.Add(label13);
groupBox4.Controls.Add(label12);
groupBox4.Controls.Add(label11);
- groupBox4.Location = new Point(786, 101);
+ groupBox4.Location = new Point(622, 101);
groupBox4.Margin = new Padding(4, 2, 4, 2);
groupBox4.Name = "groupBox4";
groupBox4.Padding = new Padding(4, 2, 4, 2);
- groupBox4.Size = new Size(716, 351);
+ groupBox4.Size = new Size(880, 351);
groupBox4.TabIndex = 13;
groupBox4.TabStop = false;
groupBox4.Text = "位置显示";
@@ -358,7 +358,7 @@
SetlnEditmiZOP.Location = new Point(526, 296);
SetlnEditmiZOP.Margin = new Padding(4, 2, 4, 2);
SetlnEditmiZOP.Name = "SetlnEditmiZOP";
- SetlnEditmiZOP.Size = new Size(127, 23);
+ SetlnEditmiZOP.Size = new Size(116, 23);
SetlnEditmiZOP.TabIndex = 27;
//
// SetlnEditmiYOP
@@ -382,7 +382,7 @@
SetlnEditmiZH.Location = new Point(526, 242);
SetlnEditmiZH.Margin = new Padding(4, 2, 4, 2);
SetlnEditmiZH.Name = "SetlnEditmiZH";
- SetlnEditmiZH.Size = new Size(127, 23);
+ SetlnEditmiZH.Size = new Size(116, 23);
SetlnEditmiZH.TabIndex = 23;
//
// SetlnEditmiYH
@@ -406,7 +406,7 @@
lnEditmiZOP.Location = new Point(526, 189);
lnEditmiZOP.Margin = new Padding(4, 2, 4, 2);
lnEditmiZOP.Name = "lnEditmiZOP";
- lnEditmiZOP.Size = new Size(127, 23);
+ lnEditmiZOP.Size = new Size(116, 23);
lnEditmiZOP.TabIndex = 19;
//
// lnEditmiYOP
@@ -441,7 +441,7 @@
lnEditmiZS.Margin = new Padding(4, 2, 4, 2);
lnEditmiZS.Name = "lnEditmiZS";
lnEditmiZS.ReadOnly = true;
- lnEditmiZS.Size = new Size(127, 23);
+ lnEditmiZS.Size = new Size(116, 23);
lnEditmiZS.TabIndex = 15;
//
// lnEditmiYS
@@ -478,7 +478,7 @@
lnEditmiZHS.Margin = new Padding(4, 2, 4, 2);
lnEditmiZHS.Name = "lnEditmiZHS";
lnEditmiZHS.ReadOnly = true;
- lnEditmiZHS.Size = new Size(127, 23);
+ lnEditmiZHS.Size = new Size(116, 23);
lnEditmiZHS.TabIndex = 11;
//
// lnEditmiYHS
@@ -608,17 +608,17 @@
ModeleShow.Margin = new Padding(4, 2, 4, 2);
ModeleShow.Name = "ModeleShow";
ModeleShow.Padding = new Padding(4, 2, 4, 2);
- ModeleShow.Size = new Size(744, 351);
+ ModeleShow.Size = new Size(596, 351);
ModeleShow.TabIndex = 12;
ModeleShow.TabStop = false;
ModeleShow.Text = "模组显示";
//
// handStopBtn
//
- handStopBtn.Location = new Point(342, 250);
+ handStopBtn.Location = new Point(323, 250);
handStopBtn.Margin = new Padding(4, 2, 4, 2);
handStopBtn.Name = "handStopBtn";
- handStopBtn.Size = new Size(161, 78);
+ handStopBtn.Size = new Size(107, 78);
handStopBtn.TabIndex = 23;
handStopBtn.Text = "手动阻塞";
handStopBtn.UseVisualStyleBackColor = true;
@@ -626,10 +626,10 @@
//
// HandRuningBtn
//
- HandRuningBtn.Location = new Point(527, 250);
+ HandRuningBtn.Location = new Point(466, 250);
HandRuningBtn.Margin = new Padding(4, 2, 4, 2);
HandRuningBtn.Name = "HandRuningBtn";
- HandRuningBtn.Size = new Size(161, 78);
+ HandRuningBtn.Size = new Size(106, 78);
HandRuningBtn.TabIndex = 22;
HandRuningBtn.Text = "手动放行";
HandRuningBtn.UseVisualStyleBackColor = true;
@@ -638,10 +638,10 @@
// ZBackwardrbx
//
ZBackwardrbx.Appearance = Appearance.Button;
- ZBackwardrbx.Location = new Point(527, 169);
+ ZBackwardrbx.Location = new Point(466, 169);
ZBackwardrbx.Margin = new Padding(4, 2, 4, 2);
ZBackwardrbx.Name = "ZBackwardrbx";
- ZBackwardrbx.Size = new Size(161, 58);
+ ZBackwardrbx.Size = new Size(106, 58);
ZBackwardrbx.TabIndex = 21;
ZBackwardrbx.Text = "Z反向";
ZBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -651,10 +651,10 @@
// YBackwardrbx
//
YBackwardrbx.Appearance = Appearance.Button;
- YBackwardrbx.Location = new Point(342, 169);
+ YBackwardrbx.Location = new Point(323, 169);
YBackwardrbx.Margin = new Padding(4, 2, 4, 2);
YBackwardrbx.Name = "YBackwardrbx";
- YBackwardrbx.Size = new Size(161, 58);
+ YBackwardrbx.Size = new Size(107, 58);
YBackwardrbx.TabIndex = 20;
YBackwardrbx.Text = "Y反向";
YBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -667,7 +667,7 @@
XBackwardrbx.Location = new Point(162, 169);
XBackwardrbx.Margin = new Padding(4, 2, 4, 2);
XBackwardrbx.Name = "XBackwardrbx";
- XBackwardrbx.Size = new Size(161, 58);
+ XBackwardrbx.Size = new Size(116, 58);
XBackwardrbx.TabIndex = 19;
XBackwardrbx.Text = "X反向";
XBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -677,10 +677,10 @@
// ZForwardrbx
//
ZForwardrbx.Appearance = Appearance.Button;
- ZForwardrbx.Location = new Point(527, 98);
+ ZForwardrbx.Location = new Point(466, 98);
ZForwardrbx.Margin = new Padding(4, 2, 4, 2);
ZForwardrbx.Name = "ZForwardrbx";
- ZForwardrbx.Size = new Size(161, 58);
+ ZForwardrbx.Size = new Size(106, 58);
ZForwardrbx.TabIndex = 18;
ZForwardrbx.Text = "Z正向";
ZForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -690,10 +690,10 @@
// YForwardrbx
//
YForwardrbx.Appearance = Appearance.Button;
- YForwardrbx.Location = new Point(342, 96);
+ YForwardrbx.Location = new Point(323, 97);
YForwardrbx.Margin = new Padding(4, 2, 4, 2);
YForwardrbx.Name = "YForwardrbx";
- YForwardrbx.Size = new Size(161, 58);
+ YForwardrbx.Size = new Size(107, 58);
YForwardrbx.TabIndex = 17;
YForwardrbx.Text = "Y正向";
YForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -706,7 +706,7 @@
XForwardrbx.Location = new Point(162, 98);
XForwardrbx.Margin = new Padding(4, 2, 4, 2);
XForwardrbx.Name = "XForwardrbx";
- XForwardrbx.Size = new Size(161, 58);
+ XForwardrbx.Size = new Size(116, 58);
XForwardrbx.TabIndex = 16;
XForwardrbx.Text = "X正向";
XForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -716,10 +716,10 @@
// ZZerorbx
//
ZZerorbx.Appearance = Appearance.Button;
- ZZerorbx.Location = new Point(527, 21);
+ ZZerorbx.Location = new Point(466, 21);
ZZerorbx.Margin = new Padding(4, 2, 4, 2);
ZZerorbx.Name = "ZZerorbx";
- ZZerorbx.Size = new Size(161, 58);
+ ZZerorbx.Size = new Size(106, 58);
ZZerorbx.TabIndex = 15;
ZZerorbx.Text = "Z归零";
ZZerorbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -729,10 +729,10 @@
// YZerorbx
//
YZerorbx.Appearance = Appearance.Button;
- YZerorbx.Location = new Point(342, 21);
+ YZerorbx.Location = new Point(323, 20);
YZerorbx.Margin = new Padding(4, 2, 4, 2);
YZerorbx.Name = "YZerorbx";
- YZerorbx.Size = new Size(161, 58);
+ YZerorbx.Size = new Size(107, 59);
YZerorbx.TabIndex = 14;
YZerorbx.Text = "Y归零";
YZerorbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -745,7 +745,7 @@
XZerorbx.Location = new Point(162, 21);
XZerorbx.Margin = new Padding(4, 2, 4, 2);
XZerorbx.Name = "XZerorbx";
- XZerorbx.Size = new Size(161, 58);
+ XZerorbx.Size = new Size(116, 58);
XZerorbx.TabIndex = 13;
XZerorbx.Text = "X归零";
XZerorbx.TextAlign = ContentAlignment.MiddleCenter;
@@ -757,7 +757,7 @@
PLCPostion.Location = new Point(8, 250);
PLCPostion.Margin = new Padding(4, 2, 4, 2);
PLCPostion.Name = "PLCPostion";
- PLCPostion.Size = new Size(125, 95);
+ PLCPostion.Size = new Size(99, 95);
PLCPostion.TabIndex = 2;
PLCPostion.Text = "定位";
PLCPostion.UseVisualStyleBackColor = true;
@@ -768,7 +768,7 @@
PLCDiskZero.Location = new Point(8, 133);
PLCDiskZero.Margin = new Padding(4, 2, 4, 2);
PLCDiskZero.Name = "PLCDiskZero";
- PLCDiskZero.Size = new Size(125, 95);
+ PLCDiskZero.Size = new Size(99, 95);
PLCDiskZero.TabIndex = 1;
PLCDiskZero.Text = "归零";
PLCDiskZero.UseVisualStyleBackColor = true;
@@ -779,7 +779,7 @@
PLCPowerON.Location = new Point(8, 21);
PLCPowerON.Margin = new Padding(4, 2, 4, 2);
PLCPowerON.Name = "PLCPowerON";
- PLCPowerON.Size = new Size(125, 95);
+ PLCPowerON.Size = new Size(99, 95);
PLCPowerON.TabIndex = 0;
PLCPowerON.Text = "使能ON";
PLCPowerON.UseVisualStyleBackColor = true;
@@ -1220,6 +1220,90 @@
groupBox2.Text = "图片";
groupBox2.Enter += groupBox2_Enter;
//
+ // canvas4
+ //
+ canvas4.AllowSelectDefect = true;
+ canvas4.BrushColor = null;
+ canvas4.ImagePath = "";
+ mat1.IsEnabledDispose = true;
+ canvas4.ImaMAt = mat1;
+ canvas4.ImgData = null;
+ canvas4.Location = new Point(367, 517);
+ canvas4.MoveStep = 5F;
+ canvas4.Name = "canvas4";
+ canvas4.Route = 0D;
+ canvas4.Scale = 1D;
+ canvas4.Size = new Size(351, 198);
+ canvas4.TabIndex = 7;
+ canvas4.WholeScale = 0F;
+ canvas4.XMove = 0F;
+ canvas4.XScale = 0F;
+ canvas4.YMove = 0F;
+ canvas4.YScale = 0F;
+ //
+ // canvas3
+ //
+ canvas3.AllowSelectDefect = true;
+ canvas3.BrushColor = null;
+ canvas3.ImagePath = "";
+ mat2.IsEnabledDispose = true;
+ canvas3.ImaMAt = mat2;
+ canvas3.ImgData = null;
+ canvas3.Location = new Point(0, 515);
+ canvas3.MoveStep = 5F;
+ canvas3.Name = "canvas3";
+ canvas3.Route = 0D;
+ canvas3.Scale = 1D;
+ canvas3.Size = new Size(351, 198);
+ canvas3.TabIndex = 6;
+ canvas3.WholeScale = 0F;
+ canvas3.XMove = 0F;
+ canvas3.XScale = 0F;
+ canvas3.YMove = 0F;
+ canvas3.YScale = 0F;
+ //
+ // canvas2
+ //
+ canvas2.AllowSelectDefect = true;
+ canvas2.BrushColor = null;
+ canvas2.ImagePath = "";
+ mat3.IsEnabledDispose = true;
+ canvas2.ImaMAt = mat3;
+ canvas2.ImgData = null;
+ canvas2.Location = new Point(367, 237);
+ canvas2.MoveStep = 5F;
+ canvas2.Name = "canvas2";
+ canvas2.Route = 0D;
+ canvas2.Scale = 1D;
+ canvas2.Size = new Size(351, 198);
+ canvas2.TabIndex = 5;
+ canvas2.WholeScale = 0F;
+ canvas2.XMove = 0F;
+ canvas2.XScale = 0F;
+ canvas2.YMove = 0F;
+ canvas2.YScale = 0F;
+ //
+ // canvas1
+ //
+ canvas1.AllowSelectDefect = true;
+ canvas1.BrushColor = null;
+ canvas1.ImagePath = "";
+ mat4.IsEnabledDispose = true;
+ canvas1.ImaMAt = mat4;
+ canvas1.ImgData = null;
+ canvas1.Location = new Point(8, 237);
+ canvas1.MoveStep = 5F;
+ canvas1.Name = "canvas1";
+ canvas1.Route = 0D;
+ canvas1.Scale = 1D;
+ canvas1.Size = new Size(351, 198);
+ canvas1.TabIndex = 4;
+ canvas1.WholeScale = 0F;
+ canvas1.XMove = 0F;
+ canvas1.XScale = 0F;
+ canvas1.YMove = 0F;
+ canvas1.YScale = 0F;
+ //
// originMatShow
//
originMatShow.Location = new Point(8, 21);
@@ -1266,6 +1350,27 @@
panel8.TabIndex = 2;
panel8.Paint += panel8_Paint;
//
+ // canvas5
+ //
+ canvas5.AllowSelectDefect = true;
+ canvas5.BrushColor = null;
+ canvas5.ImagePath = "";
+ mat5.IsEnabledDispose = true;
+ canvas5.ImaMAt = mat5;
+ canvas5.ImgData = null;
+ canvas5.Location = new Point(7, 515);
+ canvas5.MoveStep = 5F;
+ canvas5.Name = "canvas5";
+ canvas5.Route = 0D;
+ canvas5.Scale = 1D;
+ canvas5.Size = new Size(351, 198);
+ canvas5.TabIndex = 18;
+ canvas5.WholeScale = 0F;
+ canvas5.XMove = 0F;
+ canvas5.XScale = 0F;
+ canvas5.YMove = 0F;
+ canvas5.YScale = 0F;
+ //
// textBox2
//
textBox2.Location = new Point(437, 287);
@@ -1828,111 +1933,6 @@
contextMenuStrip1.Name = "contextMenuStrip1";
contextMenuStrip1.Size = new Size(61, 4);
//
- // canvas1
- //
- canvas1.AllowSelectDefect = true;
- canvas1.BrushColor = null;
- canvas1.ImagePath = "";
- mat4.IsEnabledDispose = true;
- canvas1.ImaMAt = mat4;
- canvas1.ImgData = null;
- canvas1.Location = new Point(8, 237);
- canvas1.MoveStep = 5F;
- canvas1.Name = "canvas1";
- canvas1.Route = 0D;
- canvas1.Scale = 1D;
- canvas1.Size = new Size(351, 198);
- canvas1.TabIndex = 4;
- canvas1.WholeScale = 0F;
- canvas1.XMove = 0F;
- canvas1.XScale = 0F;
- canvas1.YMove = 0F;
- canvas1.YScale = 0F;
- //
- // canvas2
- //
- canvas2.AllowSelectDefect = true;
- canvas2.BrushColor = null;
- canvas2.ImagePath = "";
- mat3.IsEnabledDispose = true;
- canvas2.ImaMAt = mat3;
- canvas2.ImgData = null;
- canvas2.Location = new Point(367, 237);
- canvas2.MoveStep = 5F;
- canvas2.Name = "canvas2";
- canvas2.Route = 0D;
- canvas2.Scale = 1D;
- canvas2.Size = new Size(351, 198);
- canvas2.TabIndex = 5;
- canvas2.WholeScale = 0F;
- canvas2.XMove = 0F;
- canvas2.XScale = 0F;
- canvas2.YMove = 0F;
- canvas2.YScale = 0F;
- //
- // canvas3
- //
- canvas3.AllowSelectDefect = true;
- canvas3.BrushColor = null;
- canvas3.ImagePath = "";
- mat2.IsEnabledDispose = true;
- canvas3.ImaMAt = mat2;
- canvas3.ImgData = null;
- canvas3.Location = new Point(0, 515);
- canvas3.MoveStep = 5F;
- canvas3.Name = "canvas3";
- canvas3.Route = 0D;
- canvas3.Scale = 1D;
- canvas3.Size = new Size(351, 198);
- canvas3.TabIndex = 6;
- canvas3.WholeScale = 0F;
- canvas3.XMove = 0F;
- canvas3.XScale = 0F;
- canvas3.YMove = 0F;
- canvas3.YScale = 0F;
- //
- // canvas4
- //
- canvas4.AllowSelectDefect = true;
- canvas4.BrushColor = null;
- canvas4.ImagePath = "";
- mat1.IsEnabledDispose = true;
- canvas4.ImaMAt = mat1;
- canvas4.ImgData = null;
- canvas4.Location = new Point(367, 517);
- canvas4.MoveStep = 5F;
- canvas4.Name = "canvas4";
- canvas4.Route = 0D;
- canvas4.Scale = 1D;
- canvas4.Size = new Size(351, 198);
- canvas4.TabIndex = 7;
- canvas4.WholeScale = 0F;
- canvas4.XMove = 0F;
- canvas4.XScale = 0F;
- canvas4.YMove = 0F;
- canvas4.YScale = 0F;
- //
- // canvas5
- //
- canvas5.AllowSelectDefect = true;
- canvas5.BrushColor = null;
- canvas5.ImagePath = "";
- mat5.IsEnabledDispose = true;
- canvas5.ImaMAt = mat5;
- canvas5.ImgData = null;
- canvas5.Location = new Point(7, 515);
- canvas5.MoveStep = 5F;
- canvas5.Name = "canvas5";
- canvas5.Route = 0D;
- canvas5.Scale = 1D;
- canvas5.Size = new Size(351, 198);
- canvas5.TabIndex = 18;
- canvas5.WholeScale = 0F;
- canvas5.XMove = 0F;
- canvas5.XScale = 0F;
- canvas5.YMove = 0F;
- canvas5.YScale = 0F;
- //
// MainForm
//
AutoScaleDimensions = new SizeF(8F, 17F);
diff --git a/HisenceYoloDetection/MainForm.cs b/HisenceYoloDetection/MainForm.cs
index 9ac23c9..55c6643 100644
--- a/HisenceYoloDetection/MainForm.cs
+++ b/HisenceYoloDetection/MainForm.cs
@@ -112,10 +112,10 @@ namespace HisenceYoloDetection
string Cam1TwoPath = "";
string ModelChangePath = "";
//
- string GreenLightingAdress = "";
- string YellowLightingAdress = "";
- string RedLightingAdress = "";
- string WaringAdress = "";
+ string GreenLightingAdress = "556";
+ string YellowLightingAdress = "554";
+ string RedLightingAdress = "552";
+ string WaringAdress = "558";
///
/// 鿴б
///
@@ -289,89 +289,121 @@ namespace HisenceYoloDetection
/// Ĭ application/json , application/x-www-form-urlencoded,multipart/form-data,raw,binary
/// Ĭapplication/json
///
- public string Post(string parameterData, string serviceUrl, string ContentType = "application/json", string Accept = "application/json")
+ //public string Post(string parameterData, string serviceUrl, string contentType = "application/x-www-form-urlencoded", string accept = "application/json")
+ //{
+ // try
+ // {
+ // // Web
+ // HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);
+ // byte[] buf = Encoding.UTF8.GetBytes($"inputvalue={Uri.EscapeDataString(parameterData)}");
+
+ // myRequest.Method = "POST";
+ // myRequest.Accept = accept;
+ // myRequest.ContentType = contentType;
+ // myRequest.ContentLength = buf.Length;
+
+ // //
+ // using (Stream stream = myRequest.GetRequestStream())
+ // {
+ // stream.Write(buf, 0, buf.Length);
+ // }
+
+ // // ȡӦ
+ // using (HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse())
+ // using (StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8))
+ // {
+ // return reader.ReadToEnd();
+ // }
+ // }
+ // catch (WebException ex)
+ // {
+ // if (ex.Response != null)
+ // {
+ // using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream()))
+ // {
+ // string errorResponse = reader.ReadToEnd();
+ // Console.WriteLine("WebException: " + errorResponse);
+ // return errorResponse;
+ // }
+ // }
+ // else
+ // {
+ // Console.WriteLine("WebException: " + ex.Message);
+ // return null;
+ // }
+ // }
+ // catch (Exception ex)
+ // {
+ // Console.WriteLine("Exception: " + ex.Message);
+ // return null;
+ // }
+ //}
+
+ #endregion
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void MainForm_Load(object sender, EventArgs e)
{
- //ȸûuriַ
- //string serviceUrl = string.Format("{0}/{1}", this.BaseUri, uri);
+ //string path3 = "D:\\Hisence\\Test1\\3.jpg";
+ //Mat pathmat = Cv2.ImRead(path3);
+ //string path2 = "D:\\Hisence\\Test1\\4-1.jpg";
- //Webʶ
- HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(serviceUrl);
- //ûתɡUTF-8ֽ
- byte[] buf = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(parameterData);
+ //Rect rect3 = new Rect(0, 0, 0, 0);
- myRequest.Method = "POST";
- //myRequest.Accept = "application/json";
- //myRequest.ContentType = "application/json"; // //Content-Type: application/x-www-form-urlencoded
- myRequest.AutomaticDecompression = DecompressionMethods.GZip;
- myRequest.Accept = Accept;
- //myRequest.ContentType = ContentType;
- myRequest.ContentType = "application/json; charset=UTF-8";
- myRequest.ContentLength = buf.Length;
- myRequest.MaximumAutomaticRedirections = 1;
- myRequest.AllowAutoRedirect = true;
+ //CheckDiffSciHelper1.CheckDiffSci(path2, pathmat, rect3, rect3, false, "D://Hisence//Test1");
+ //string path22 = "D:\\Hisence\\Test2\\2.jpg";
+ //Mat pathmat2 = Cv2.ImRead(path22);
+ //string path222 = "D:\\Hisence\\Test2\\3.jpg";
+ //Rect rect = new Rect(0, 0, 0, 0);
- //myRequest.Headers.Add("content-type", "application/json");
- //myRequest.Headers.Add("accept-encoding", "gzip");
- //myRequest.Headers.Add("accept-charset", "utf-8");
- //
- Stream stream = myRequest.GetRequestStream();
- stream.Write(buf, 0, buf.Length);
- stream.Close();
+ //CheckDiffSciHelper.CheckDiffSci(path222, pathmat2, rect, rect, true, "D://Hisence//Test2");
- //ͨWebʶȡӦ
- HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
- //ͨӦStreamReaderΪStreamReader
- StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
- //string returnXml = HttpUtility.UrlDecode(reader.ReadToEnd());//б
- string returnData = reader.ReadToEnd();//StreamReaderͿԴӦݴͷβ
+ // ַ
+ //string url = "http://172.16.139.146/FCCBOMWebService/FCCBomService.asmx/GetFCCBomInfoPDJson";
- reader.Close();
- myResponse.Close();
+ //DateTime dt = DateTime.Now;
+ //string today = dt.ToString("yyyy-MM-dd");
- return returnData;
- }
- #endregion
+ //string startTime = today;
+ //string endTime = today;
+ //string lineBody = "BZ-PC";
+ //string materialDescript = "";
- ///
- ///
- ///
- ///
- ///
- private void MainForm_Load(object sender, EventArgs e)
- {
- //ַ
- //string url = "https://inner-apisix.hisense.com/mes-plus/api/Fcc/GetWorkOrderBOMlnfo?user_key=k7gzo1fsfcami7n5hmpxtybyluf9xeue";
- ////string url = "https://echo.hoppscotch.io";
- //string PostUrl = url;
- //DateTime dt= DateTime.Now;
-
- //string starttime=string.Format("{0:yyyy_mm_dd}", dt); //17 17 2017 2017
-
- //string startTime = starttime;
- //string EndTime = starttime;
- //string lineBody = "ZZ-P";
- //string MaterialDescripts = "";
- //string MaterialDescripts2 = "չ";
- //JObject patientinfo = new JObject();
- //JArray ids = new JArray();
- //ids.Add(MaterialDescripts);
- //ids.Add(MaterialDescripts2);
- //patientinfo["startTime"] = startTime;
- //patientinfo["EndTime"] = EndTime;
- //patientinfo["lineBody"] = lineBody;
- //patientinfo["MaterialDescripts"] = ids;
- //string sendData = JsonConvert.SerializeObject(patientinfo);
- ////eg: UrlҪĸʽsendData={"ids":[123],"Name":С}
- //string resultData = Post(sendData, PostUrl);
- //resultData = "{\r\n\t\"Result\": [],\r\n\t\"success\": false,\r\n\t\"ReturnMsg\": \"-starttime ȷ!\"\r\n}";
- //JObject jo = (JObject)JsonConvert.DeserializeObject(resultData);
- //string sucessIf = jo["success"].ToString();
- //if(sucessIf.ToLower()=="true")
+ //JObject patientInfo = new JObject
//{
- // string ProductType = jo["ProductType"].ToString();
- // string FinalDefIo = jo["FinalDefIo"].ToString();
- // //ֶ
+ // ["StartTime"] = startTime,
+ // ["EndTime"] = endTime,
+ // ["LineBody"] = lineBody,
+ // ["MaterialDescripts"] = new JArray { materialDescript }
+ //};
+
+ //string sendData = patientInfo.ToString();
+ //string resultData = Post(sendData, url, "application/x-www-form-urlencoded", "application/json");
+
+ //if (resultData != null)
+ //{
+ // JObject responseJson = JObject.Parse(resultData);
+ // bool success = responseJson["success"] != null && (bool)responseJson["success"];
+ // if (success)
+ // {
+ // string productType = responseJson["ProductType"] != null ? responseJson["ProductType"].ToString() : "N/A";
+ // string finalDefIo = responseJson["FinalDefIo"] != null ? responseJson["FinalDefIo"].ToString() : "N/A";
+ // // ֶ
+ // }
+ // else
+ // {
+ // string returnMsg = responseJson["ReturnMsg"] != null ? responseJson["ReturnMsg"].ToString() : "Unknown error";
+ // Console.WriteLine("ʧܣ" + returnMsg);
+ // }
+ //}
+ //else
+ //{
+ // Console.WriteLine("ʧܣδ");
//}
if (_runHandleBefore == null)
{
@@ -460,7 +492,7 @@ namespace HisenceYoloDetection
OnSpeedShow();//߳̿ٶʾڽ
OnPostionShow();//߳̿λʾڽ
melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//Ƶ
-
+ melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 0);//̵
//t = new System.Timers.Timer(10000);//ʵTimer࣬üʱΪ10000룻
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//ʱʱִ¼
//t.AutoReset = true;//ִһΣfalseһֱִ(true)
@@ -777,7 +809,7 @@ namespace HisenceYoloDetection
Cam1.OnHImageOutput -= OnCameraMatOutPut;
Cam1.OnHImageOutput += OnCameraMatOutPut;
//Cam2.OnHImageOutput -= OnCameraMatOutPut2;
- // Cam2.OnHImageOutput += OnCameraMatOutPut2;
+ // Cam2.OnHImageOutput += OnCameraMatOutPut2;
OKOrNGShow.Image = OKbitmap;
//ʼɨǹ
@@ -1228,18 +1260,18 @@ namespace HisenceYoloDetection
xKNow = GetModeFromBar("VWJ070541V0WW824F120223");//ݿвѯֵ
- if (xKNow==null)
+ if (xKNow == null)
{
myLog("ݿûƥ" + m_sKEYENCEBar, DateTime.Now);
break;
}
//if(xKNow.OcrBar!= Old_xKNow.OcrBar)
//{
-
+
//}
if (Regex.IsMatch(xKNow.MoveX.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveY.ToString(), @"^[0-9]+$") && Regex.IsMatch(xKNow.MoveZ.ToString(), @"^[0-9]+$"))
{
- // Old_xKNow = xKNow;
+ // Old_xKNow = xKNow;
myLog("ͺƥɹ" + xKNow.OcrBar, DateTime.Now);
bBarTriger = true;
//MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLCƵƶ
@@ -1291,7 +1323,7 @@ namespace HisenceYoloDetection
}
#endregion
int YPos = 14957;
- int ZPos = 4382;
+ int ZPos = 1695;
bool StopM = false;//һźŵ
///
/// ϴ»544Ƿ䴫
@@ -1398,7 +1430,7 @@ namespace HisenceYoloDetection
if (xKNow == null)
{
myLog("ݿûƥ" + m_sKEYENCEBar, DateTime.Now);
- break;
+ // break;
}
//if(xKNow.OcrBar!= Old_xKNow.OcrBar)
//{
@@ -1408,21 +1440,21 @@ namespace HisenceYoloDetection
{
// Old_xKNow = xKNow;
myLog("ͺƥɹ" + xKNow.OcrBar, DateTime.Now);
-
+
//MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);// PLCƵƶ
}
- // break;
+ // break;
}
- Thread.Sleep(2);
+ // Thread.Sleep(2);
bBar = false;
#if true
- // if (bBarTriger)//֤
+ // if (bBarTriger)//֤
{
-
+
myLog("һβɼͼ", DateTime.Now);
//ƶģ βĵַ Ƿǰƶ
@@ -1448,7 +1480,7 @@ namespace HisenceYoloDetection
{
MoveToP(5815, YPos, ZPos + (int)(dismove));
}
-
+
Cam1.SnapshotCount = 0;
Cam1.Snapshot();
@@ -1460,8 +1492,8 @@ namespace HisenceYoloDetection
//{
// MoveToP(xKNow.MoveTwoX, xKNow.MoveTwoY, xKNow.MoveTwoZ);
//}
-
- // MoveToP(51043, YPos, ZPos + (int)(dismove));
+
+ // MoveToP(51043, YPos, ZPos + (int)(dismove));
//Cam1.Snapshot();
MoveToP(5815, YPos, ZPos);
melsecPLCTCPDriver.WriteInt("550", 0);//
@@ -1609,13 +1641,13 @@ namespace HisenceYoloDetection
//ڶ
if (SnapshotCount == 2)
{
-
- Cam1ImgTwo = Cv2.ImRead("D:\\Hisence\\\\1\\002.jpg");
+
+ Cam1ImgTwo = Cv2.ImRead("D:\\Hisence\\\\1\\002.jpg");
//Cam1ImgTwo = cameraMat;
IfCam1TwoTriger = true;
//originMatShow2.Image = cameraMat.ToBitmap();
-
+
}
@@ -1698,7 +1730,7 @@ namespace HisenceYoloDetection
{
xK_HisenceSQLWord = xkWordList[0];
}
- if(xKNow==null)
+ if (xKNow == null)
{
myLog("δƥ" + IOcrBAr, DateTime.Now);
break;
@@ -1728,7 +1760,7 @@ namespace HisenceYoloDetection
//}
myLog("ͺƥɹ" + IOcrBAr, DateTime.Now);
-
+
}
@@ -1739,7 +1771,7 @@ namespace HisenceYoloDetection
}
//1ڶ
- // if (IfCam1TwoTriger && bBarTriger)
+ // if (IfCam1TwoTriger && bBarTriger)
{
IfCam1TwoTriger = false;
bBarTriger = false;//ûʲô
@@ -1752,7 +1784,7 @@ namespace HisenceYoloDetection
Defet_OnDetectionDone(whiteMat, 5);
Defet_OnDetectionDone(whiteMat, 6);
Defet_OnDetectionDone(whiteMat, 7);
-
+
XK_HisenceWord xK_MatchDet = new XK_HisenceWord();
xK_MatchDet.TwoIFWhile = xK_HisenceSQLWord.TwoIFWhile;
AllDsums++;
@@ -1774,14 +1806,14 @@ namespace HisenceYoloDetection
List strMatListOne = new List();
List strMatFuzzyListOne = new List();
Mat mResultCut = req.currentMat.Clone();
-
+
if (mL.ResultMap != null)
{
mL.ResultMap.Save("D://cam1//" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "1result.jpg");
ResultMatShow.Image = mL.ResultMap;
}
-
+
////
//MLRequest req2 = new MLRequest();
//req2.currentMat = Cam1ImgTwo;
@@ -1801,7 +1833,7 @@ namespace HisenceYoloDetection
List strMatListTwo = new List();
List strMatFuzzyListTwo = new List();
- // Mat mResultCut2 = req2.currentMat.Clone();
+ // Mat mResultCut2 = req2.currentMat.Clone();
Dictionary keyValueResult = new Dictionary();
Dictionary keyValueResult2 = new Dictionary();
#region ִжλȶ
@@ -1839,18 +1871,18 @@ namespace HisenceYoloDetection
//Mat mCut = new Mat();
Stopwatch sw = new Stopwatch();
sw.Start();
-
- InsertSqlRunDataButton(ref keyValueResult, false, ref mResultCut, mL, mLButton, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
-
- // InsertSqlRunData(ref keyValueResult2, false, ref mResultCut2, mL2, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListTwo, ref strMatFuzzyListTwo, ref paddleOcrModel);
+ InsertSqlRunDataButton(ref keyValueResult, false, ref mResultCut, mL, mLButton, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
+
+
+ // InsertSqlRunData(ref keyValueResult2, false, ref mResultCut2, mL2, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListTwo, ref strMatFuzzyListTwo, ref paddleOcrModel);
sw.Stop();
myLog("ʱ" + sw.ElapsedMilliseconds, DateTime.Now);
}
-
-
+
+
if (MatchStr)
{
@@ -1867,7 +1899,7 @@ namespace HisenceYoloDetection
// int sqlblocksum=
-
+
melsecPLCTCPDriver.WriteInt("550", 0);//
if (MatchStr)
@@ -1886,19 +1918,22 @@ namespace HisenceYoloDetection
else
{
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 1);//
+ melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 0);//Ƶ
+ melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 0);//̵
melsecPLCTCPDriver.WriteInt(WaringAdress, 1);//
-
+
//ΪжǷNGϴ»
DialogResult dr = MessageBox.Show("Ƿ죿", "Ƿ", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//
+ melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//Ƶ
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//
OKDsums++;
WUsums++;
this.Invoke(new Action(() =>
{
- double percent = (double)WUsums/ AllDsums;
+ double percent = (double)WUsums / AllDsums;
string percentText = percent.ToString("0.0%");//percentTextֵΪ10.0%
textBox1.Text = percentText;
OKOrNGShow.Image = OKbitmap;
@@ -1906,11 +1941,12 @@ namespace HisenceYoloDetection
myLog("ƥʧ", DateTime.Now);
}
else
- {
+ {
NGDsums++;
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//
-
+ melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//Ƶ
+
this.Invoke(new Action(() =>
{
OKOrNGShow.Image = NGbitmap;
@@ -1918,7 +1954,7 @@ namespace HisenceYoloDetection
myLog("ƥɹ", DateTime.Now);
}
-
+
}
@@ -2005,7 +2041,7 @@ namespace HisenceYoloDetection
//
if (data.Length > 10)
{
- m_sKEYENCEBar=string.Empty;
+ m_sKEYENCEBar = string.Empty;
m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data);
// myLog("ͺOcr" + m_sKEYENCEBar, DateTime.Now);
_runHandleBefore.Set();
@@ -2193,21 +2229,22 @@ namespace HisenceYoloDetection
Mat pathmat2 = Cv2.ImRead(path22);
string path222 = "D:\\Hisence\\Test2\\BatchW96c0ModelWNHB6X2SDSPresult2024628923102_Rect.png";
Rect rect1 = new Rect(1929, 745, 396, 377);
- Rect rect = new Rect(368, 53, 396, 377);
+
CheckDiffSciHelper.CheckDiffSci(path222, pathmat2, rect, rect, true, "D://Hisence//Test2");
-
+
string path = "D:\\Hisence\\Test1\\1.png";
Mat pathmat =Cv2.ImRead(path);
string path2 = "D:\\Hisence\\Test1\\2.png";
-
+
Rect rect2 = new Rect(0, 0, 0, 0);
CheckDiffSciHelper1.CheckDiffSci(path2, pathmat, rect2, rect2, false, "D://Hisence//Test1");
-
- */
- // OnGetBar();
- melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 1);//Ƶ
+ */
+
+ // OnGetBar();
+ melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 1);//̵
+ melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 0);//Ƶ
TriggerCameral2();
ReadyDetect();
myLog("̳ɹ", DateTime.Now);
@@ -2607,7 +2644,7 @@ namespace HisenceYoloDetection
Mat mResultCut = CamOneI.currentMat.Clone();
//Mat mCut = new Mat();
Dictionary keyValueResult = new Dictionary();
- InsertSqlRunDataButton(ref keyValueResult, true, ref mResultCut, mL3, mLButton, ref xK_HisenceSQLWord, ref xkWord, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
+ InsertSqlRunDataButton(ref keyValueResult, true, ref mResultCut, mL3, mLButton, ref xK_HisenceSQLWord, ref xkWord, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
@@ -3041,7 +3078,7 @@ namespace HisenceYoloDetection
break;
case 7:
{
- // canvas7.ImaMAt = detectionImage;
+ // canvas7.ImaMAt = detectionImage;
}
break;
case 8:
@@ -3071,7 +3108,7 @@ namespace HisenceYoloDetection
/// صĶλĽ
///
///
- public void InsertSqlRunDataButton(ref Dictionary keyValueResult, bool saveimage, ref Mat currentMatC, MLResult cam1TwoML, MLResult cam1Button, ref XK_HisenceWord SQlxK_HisenceWord, ref XK_HisenceWord xK_HisenceWord, ref List strMatList, ref List strMatRefList, ref PaddleOcrModel IOcrModel)
+ public void InsertSqlRunDataButton(ref Dictionary keyValueResult, bool saveimage, ref Mat currentMatC, MLResult cam1TwoML, MLResult cam1Button, ref XK_HisenceWord SQlxK_HisenceWord, ref XK_HisenceWord xK_HisenceWord, ref List strMatList, ref List strMatRefList, ref PaddleOcrModel IOcrModel)
{
#if true
//try
@@ -3480,7 +3517,7 @@ namespace HisenceYoloDetection
{
SQLStr = SQlxK_HisenceWord.SevenblockMainWord;
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
-
+
Rect rect = new Rect(0, 0, 0, 0);
string PathSql = SQlxK_HisenceWord.SevenblockPath;
@@ -3603,6 +3640,14 @@ namespace HisenceYoloDetection
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
melsecPLCTCPDriver.WriteInt("550", 0);
+ melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 0);
+ melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 0);
+
+ }
+
+ private void panel1_Paint(object sender, PaintEventArgs e)
+ {
+
}
}
}
diff --git a/HisenceYoloDetection/MainForm.resx b/HisenceYoloDetection/MainForm.resx
index cbb8e7a..87eea4b 100644
--- a/HisenceYoloDetection/MainForm.resx
+++ b/HisenceYoloDetection/MainForm.resx
@@ -142,7 +142,7 @@
733, 17
- 29
+ 52
diff --git a/HisenceYoloDetection/MelsecPLCTCPDriver.cs b/HisenceYoloDetection/MelsecPLCTCPDriver.cs
index bc8b626..ad6e1bf 100644
--- a/HisenceYoloDetection/MelsecPLCTCPDriver.cs
+++ b/HisenceYoloDetection/MelsecPLCTCPDriver.cs
@@ -11,7 +11,7 @@ using static OpenCvSharp.FileStorage;
-public class MelsecPLCTCPDriver1
+public class MelsecPLCTCPDriver
{
private MelsecMcNet melsecMc = new MelsecMcNet();
// private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet();
diff --git a/HisenceYoloDetection/VirtualPLCTCPDriver.cs b/HisenceYoloDetection/VirtualPLCTCPDriver.cs
index d52874e..cb6e723 100644
--- a/HisenceYoloDetection/VirtualPLCTCPDriver.cs
+++ b/HisenceYoloDetection/VirtualPLCTCPDriver.cs
@@ -12,7 +12,7 @@ using static OpenCvSharp.FileStorage;
-public class MelsecPLCTCPDriver
+public class MelsecPLCTCPDriver1
{
// private MelsecMcNet melsecMc = new MelsecMcNet();
// private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet();