Compare commits

..

4 Commits
master ... Dev

Author SHA1 Message Date
0ed659e482 no message 2024-06-27 16:51:09 +08:00
2db802c899 修改界面 和遮挡第一块显示NG 2024-06-27 16:25:52 +08:00
d82f308fed 更改字符比对 2024-06-27 14:40:37 +08:00
YZJ
e2dc220aaf 修改冲突 2024-06-27 13:48:39 +08:00
4 changed files with 158 additions and 119 deletions

View File

@ -31,11 +31,13 @@
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
OpenCvSharp.Mat mat1 = new OpenCvSharp.Mat(); OpenCvSharp.Mat mat1 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat2 = 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();
OpenCvSharp.Mat mat6 = new OpenCvSharp.Mat(); OpenCvSharp.Mat mat6 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat7 = new OpenCvSharp.Mat(); OpenCvSharp.Mat mat7 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat8 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat5 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat9 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat4 = new OpenCvSharp.Mat();
OpenCvSharp.Mat mat3 = new OpenCvSharp.Mat();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
tabPage2 = new TabPage(); tabPage2 = new TabPage();
panel1 = new Panel(); panel1 = new Panel();
@ -128,7 +130,6 @@
panel5 = new Panel(); panel5 = new Panel();
DefetShow5 = new XKRS.UI.Canvas(); DefetShow5 = new XKRS.UI.Canvas();
panel8 = new Panel(); panel8 = new Panel();
RefeshData = new Button();
= new Label(); = new Label();
OKOrNGShow = new PictureBox(); OKOrNGShow = new PictureBox();
OKDNum = new TextBox(); OKDNum = new TextBox();
@ -137,7 +138,6 @@
label19 = new Label(); label19 = new Label();
AllDSum = new TextBox(); AllDSum = new TextBox();
label18 = new Label(); label18 = new Label();
InsertSqlBtn = new Button();
StartDecBtn = new Button(); StartDecBtn = new Button();
ScanDevList = new Button(); ScanDevList = new Button();
DevNameCombo = new ComboBox(); DevNameCombo = new ComboBox();
@ -198,6 +198,8 @@
richTextBox1 = new RichTextBox(); richTextBox1 = new RichTextBox();
contextMenuStrip1 = new ContextMenuStrip(components); contextMenuStrip1 = new ContextMenuStrip(components);
backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
DefetShow6 = new XKRS.UI.Canvas();
DefetShow7 = new XKRS.UI.Canvas();
tabPage2.SuspendLayout(); tabPage2.SuspendLayout();
panel1.SuspendLayout(); panel1.SuspendLayout();
groupBox5.SuspendLayout(); groupBox5.SuspendLayout();
@ -1129,8 +1131,10 @@
// //
// panel5 // panel5
// //
panel5.Controls.Add(DefetShow5); panel5.Controls.Add(DefetShow7);
panel5.Controls.Add(DefetShow6);
panel5.Controls.Add(panel8); panel5.Controls.Add(panel8);
panel5.Controls.Add(DefetShow2);
panel5.Controls.Add(panel6); panel5.Controls.Add(panel6);
panel5.Dock = DockStyle.Top; panel5.Dock = DockStyle.Top;
panel5.Location = new Point(0, 0); panel5.Location = new Point(0, 0);
@ -1143,15 +1147,15 @@
DefetShow5.AllowSelectDefect = true; DefetShow5.AllowSelectDefect = true;
DefetShow5.BrushColor = null; DefetShow5.BrushColor = null;
DefetShow5.ImagePath = ""; DefetShow5.ImagePath = "";
mat3.IsEnabledDispose = true; mat6.IsEnabledDispose = true;
DefetShow5.ImaMAt = mat3; DefetShow5.ImaMAt = mat6;
DefetShow5.ImgData = null; DefetShow5.ImgData = null;
DefetShow5.Location = new Point(853, 464); DefetShow5.Location = new Point(537, 460);
DefetShow5.MoveStep = 5F; DefetShow5.MoveStep = 5F;
DefetShow5.Name = "DefetShow5"; DefetShow5.Name = "DefetShow5";
DefetShow5.Route = 0D; DefetShow5.Route = 0D;
DefetShow5.Scale = 1D; DefetShow5.Scale = 1D;
DefetShow5.Size = new Size(254, 196); DefetShow5.Size = new Size(209, 196);
DefetShow5.TabIndex = 10; DefetShow5.TabIndex = 10;
DefetShow5.WholeScale = 0F; DefetShow5.WholeScale = 0F;
DefetShow5.XMove = 0F; DefetShow5.XMove = 0F;
@ -1161,7 +1165,6 @@
// //
// panel8 // panel8
// //
panel8.Controls.Add(RefeshData);
panel8.Controls.Add(); panel8.Controls.Add();
panel8.Controls.Add(OKOrNGShow); panel8.Controls.Add(OKOrNGShow);
panel8.Controls.Add(OKDNum); panel8.Controls.Add(OKDNum);
@ -1170,31 +1173,20 @@
panel8.Controls.Add(label19); panel8.Controls.Add(label19);
panel8.Controls.Add(AllDSum); panel8.Controls.Add(AllDSum);
panel8.Controls.Add(label18); panel8.Controls.Add(label18);
panel8.Controls.Add(InsertSqlBtn);
panel8.Controls.Add(StartDecBtn); panel8.Controls.Add(StartDecBtn);
panel8.Controls.Add(ScanDevList); panel8.Controls.Add(ScanDevList);
panel8.Controls.Add(DevNameCombo); panel8.Controls.Add(DevNameCombo);
panel8.Controls.Add(InitMachine); panel8.Controls.Add(InitMachine);
panel8.Location = new Point(853, 0); panel8.Location = new Point(853, 0);
panel8.Name = "panel8"; panel8.Name = "panel8";
panel8.Size = new Size(440, 458); panel8.Size = new Size(440, 244);
panel8.TabIndex = 2; panel8.TabIndex = 2;
panel8.Paint += panel8_Paint; panel8.Paint += panel8_Paint;
// //
// RefeshData
//
RefeshData.Location = new Point(24, 340);
RefeshData.Name = "RefeshData";
RefeshData.Size = new Size(94, 43);
RefeshData.TabIndex = 13;
RefeshData.Text = "刷新";
RefeshData.UseVisualStyleBackColor = true;
RefeshData.Click += RefeshData_Click;
//
// 实时显示 // 实时显示
// //
.AutoSize = true; .AutoSize = true;
.Location = new Point(326, 175); .Location = new Point(332, 26);
.Name = "实时显示"; .Name = "实时显示";
.Size = new Size(56, 17); .Size = new Size(56, 17);
.TabIndex = 12; .TabIndex = 12;
@ -1202,7 +1194,7 @@
// //
// OKOrNGShow // OKOrNGShow
// //
OKOrNGShow.Location = new Point(254, 204); OKOrNGShow.Location = new Point(254, 60);
OKOrNGShow.Name = "OKOrNGShow"; OKOrNGShow.Name = "OKOrNGShow";
OKOrNGShow.Size = new Size(183, 179); OKOrNGShow.Size = new Size(183, 179);
OKOrNGShow.SizeMode = PictureBoxSizeMode.CenterImage; OKOrNGShow.SizeMode = PictureBoxSizeMode.CenterImage;
@ -1211,7 +1203,7 @@
// //
// OKDNum // OKDNum
// //
OKDNum.Location = new Point(125, 296); OKDNum.Location = new Point(132, 207);
OKDNum.Name = "OKDNum"; OKDNum.Name = "OKDNum";
OKDNum.ReadOnly = true; OKDNum.ReadOnly = true;
OKDNum.Size = new Size(100, 23); OKDNum.Size = new Size(100, 23);
@ -1220,7 +1212,7 @@
// label20 // label20
// //
label20.AutoSize = true; label20.AutoSize = true;
label20.Location = new Point(49, 300); label20.Location = new Point(56, 211);
label20.Name = "label20"; label20.Name = "label20";
label20.Size = new Size(50, 17); label20.Size = new Size(50, 17);
label20.TabIndex = 9; label20.TabIndex = 9;
@ -1228,7 +1220,7 @@
// //
// NGDNum // NGDNum
// //
NGDNum.Location = new Point(125, 249); NGDNum.Location = new Point(132, 160);
NGDNum.Name = "NGDNum"; NGDNum.Name = "NGDNum";
NGDNum.ReadOnly = true; NGDNum.ReadOnly = true;
NGDNum.Size = new Size(100, 23); NGDNum.Size = new Size(100, 23);
@ -1237,7 +1229,7 @@
// label19 // label19
// //
label19.AutoSize = true; label19.AutoSize = true;
label19.Location = new Point(49, 253); label19.Location = new Point(56, 164);
label19.Name = "label19"; label19.Name = "label19";
label19.Size = new Size(51, 17); label19.Size = new Size(51, 17);
label19.TabIndex = 7; label19.TabIndex = 7;
@ -1245,7 +1237,7 @@
// //
// AllDSum // AllDSum
// //
AllDSum.Location = new Point(125, 204); AllDSum.Location = new Point(132, 115);
AllDSum.Name = "AllDSum"; AllDSum.Name = "AllDSum";
AllDSum.ReadOnly = true; AllDSum.ReadOnly = true;
AllDSum.Size = new Size(100, 23); AllDSum.Size = new Size(100, 23);
@ -1254,26 +1246,15 @@
// label18 // label18
// //
label18.AutoSize = true; label18.AutoSize = true;
label18.Location = new Point(49, 208); label18.Location = new Point(56, 119);
label18.Name = "label18"; label18.Name = "label18";
label18.Size = new Size(44, 17); label18.Size = new Size(44, 17);
label18.TabIndex = 5; label18.TabIndex = 5;
label18.Text = "总个数"; label18.Text = "总个数";
// //
// InsertSqlBtn
//
InsertSqlBtn.Location = new Point(54, 56);
InsertSqlBtn.Name = "InsertSqlBtn";
InsertSqlBtn.Size = new Size(92, 48);
InsertSqlBtn.TabIndex = 4;
InsertSqlBtn.Text = "型号录入";
InsertSqlBtn.UseVisualStyleBackColor = true;
InsertSqlBtn.Visible = false;
InsertSqlBtn.Click += InsertSqlBtn_Click;
//
// StartDecBtn // StartDecBtn
// //
StartDecBtn.Location = new Point(160, 127); StartDecBtn.Location = new Point(131, 60);
StartDecBtn.Name = "StartDecBtn"; StartDecBtn.Name = "StartDecBtn";
StartDecBtn.Size = new Size(94, 43); StartDecBtn.Size = new Size(94, 43);
StartDecBtn.TabIndex = 3; StartDecBtn.TabIndex = 3;
@ -1283,7 +1264,7 @@
// //
// ScanDevList // ScanDevList
// //
ScanDevList.Location = new Point(272, 25); ScanDevList.Location = new Point(231, 23);
ScanDevList.Name = "ScanDevList"; ScanDevList.Name = "ScanDevList";
ScanDevList.Size = new Size(75, 23); ScanDevList.Size = new Size(75, 23);
ScanDevList.TabIndex = 2; ScanDevList.TabIndex = 2;
@ -1294,14 +1275,14 @@
// DevNameCombo // DevNameCombo
// //
DevNameCombo.FormattingEnabled = true; DevNameCombo.FormattingEnabled = true;
DevNameCombo.Location = new Point(54, 25); DevNameCombo.Location = new Point(25, 23);
DevNameCombo.Name = "DevNameCombo"; DevNameCombo.Name = "DevNameCombo";
DevNameCombo.Size = new Size(200, 25); DevNameCombo.Size = new Size(200, 25);
DevNameCombo.TabIndex = 1; DevNameCombo.TabIndex = 1;
// //
// InitMachine // InitMachine
// //
InitMachine.Location = new Point(54, 127); InitMachine.Location = new Point(24, 60);
InitMachine.Name = "InitMachine"; InitMachine.Name = "InitMachine";
InitMachine.Size = new Size(94, 43); InitMachine.Size = new Size(94, 43);
InitMachine.TabIndex = 0; InitMachine.TabIndex = 0;
@ -1320,9 +1301,9 @@
// groupBox2 // groupBox2
// //
groupBox2.AutoSize = true; groupBox2.AutoSize = true;
groupBox2.Controls.Add(DefetShow5);
groupBox2.Controls.Add(DefetShow4); groupBox2.Controls.Add(DefetShow4);
groupBox2.Controls.Add(DefetShow3); groupBox2.Controls.Add(DefetShow3);
groupBox2.Controls.Add(DefetShow2);
groupBox2.Controls.Add(originMat2Show); groupBox2.Controls.Add(originMat2Show);
groupBox2.Controls.Add(DefetShow1); groupBox2.Controls.Add(DefetShow1);
groupBox2.Controls.Add(ResultMatShow2); groupBox2.Controls.Add(ResultMatShow2);
@ -1342,15 +1323,15 @@
DefetShow4.AllowSelectDefect = true; DefetShow4.AllowSelectDefect = true;
DefetShow4.BrushColor = null; DefetShow4.BrushColor = null;
DefetShow4.ImagePath = ""; DefetShow4.ImagePath = "";
mat4.IsEnabledDispose = true; mat7.IsEnabledDispose = true;
DefetShow4.ImaMAt = mat4; DefetShow4.ImaMAt = mat7;
DefetShow4.ImgData = null; DefetShow4.ImgData = null;
DefetShow4.Location = new Point(574, 460); DefetShow4.Location = new Point(297, 460);
DefetShow4.MoveStep = 5F; DefetShow4.MoveStep = 5F;
DefetShow4.Name = "DefetShow4"; DefetShow4.Name = "DefetShow4";
DefetShow4.Route = 0D; DefetShow4.Route = 0D;
DefetShow4.Scale = 1D; DefetShow4.Scale = 1D;
DefetShow4.Size = new Size(265, 196); DefetShow4.Size = new Size(220, 196);
DefetShow4.TabIndex = 11; DefetShow4.TabIndex = 11;
DefetShow4.WholeScale = 0F; DefetShow4.WholeScale = 0F;
DefetShow4.XMove = 0F; DefetShow4.XMove = 0F;
@ -1363,15 +1344,15 @@
DefetShow3.AllowSelectDefect = true; DefetShow3.AllowSelectDefect = true;
DefetShow3.BrushColor = null; DefetShow3.BrushColor = null;
DefetShow3.ImagePath = ""; DefetShow3.ImagePath = "";
mat5.IsEnabledDispose = true; mat8.IsEnabledDispose = true;
DefetShow3.ImaMAt = mat5; DefetShow3.ImaMAt = mat8;
DefetShow3.ImgData = null; DefetShow3.ImgData = null;
DefetShow3.Location = new Point(303, 460); DefetShow3.Location = new Point(6, 460);
DefetShow3.MoveStep = 5F; DefetShow3.MoveStep = 5F;
DefetShow3.Name = "DefetShow3"; DefetShow3.Name = "DefetShow3";
DefetShow3.Route = 0D; DefetShow3.Route = 0D;
DefetShow3.Scale = 1D; DefetShow3.Scale = 1D;
DefetShow3.Size = new Size(265, 196); DefetShow3.Size = new Size(285, 196);
DefetShow3.TabIndex = 10; DefetShow3.TabIndex = 10;
DefetShow3.WholeScale = 0F; DefetShow3.WholeScale = 0F;
DefetShow3.XMove = 0F; DefetShow3.XMove = 0F;
@ -1384,10 +1365,10 @@
DefetShow2.AllowSelectDefect = true; DefetShow2.AllowSelectDefect = true;
DefetShow2.BrushColor = null; DefetShow2.BrushColor = null;
DefetShow2.ImagePath = ""; DefetShow2.ImagePath = "";
mat6.IsEnabledDispose = true; mat5.IsEnabledDispose = true;
DefetShow2.ImaMAt = mat6; DefetShow2.ImaMAt = mat5;
DefetShow2.ImgData = null; DefetShow2.ImgData = null;
DefetShow2.Location = new Point(6, 460); DefetShow2.Location = new Point(850, 249);
DefetShow2.MoveStep = 5F; DefetShow2.MoveStep = 5F;
DefetShow2.Name = "DefetShow2"; DefetShow2.Name = "DefetShow2";
DefetShow2.Route = 0D; DefetShow2.Route = 0D;
@ -1414,15 +1395,15 @@
DefetShow1.AllowSelectDefect = true; DefetShow1.AllowSelectDefect = true;
DefetShow1.BrushColor = null; DefetShow1.BrushColor = null;
DefetShow1.ImagePath = ""; DefetShow1.ImagePath = "";
mat7.IsEnabledDispose = true; mat9.IsEnabledDispose = true;
DefetShow1.ImaMAt = mat7; DefetShow1.ImaMAt = mat9;
DefetShow1.ImgData = null; DefetShow1.ImgData = null;
DefetShow1.Location = new Point(574, 245); DefetShow1.Location = new Point(574, 245);
DefetShow1.MoveStep = 5F; DefetShow1.MoveStep = 5F;
DefetShow1.Name = "DefetShow1"; DefetShow1.Name = "DefetShow1";
DefetShow1.Route = 0D; DefetShow1.Route = 0D;
DefetShow1.Scale = 1D; DefetShow1.Scale = 1D;
DefetShow1.Size = new Size(262, 209); DefetShow1.Size = new Size(254, 209);
DefetShow1.TabIndex = 7; DefetShow1.TabIndex = 7;
DefetShow1.WholeScale = 0F; DefetShow1.WholeScale = 0F;
DefetShow1.XMove = 0F; DefetShow1.XMove = 0F;
@ -1836,6 +1817,48 @@
contextMenuStrip1.Name = "contextMenuStrip1"; contextMenuStrip1.Name = "contextMenuStrip1";
contextMenuStrip1.Size = new Size(61, 4); contextMenuStrip1.Size = new Size(61, 4);
// //
// DefetShow6
//
DefetShow6.AllowSelectDefect = true;
DefetShow6.BrushColor = null;
DefetShow6.ImagePath = "";
mat4.IsEnabledDispose = true;
DefetShow6.ImaMAt = mat4;
DefetShow6.ImgData = null;
DefetShow6.Location = new Point(751, 464);
DefetShow6.MoveStep = 5F;
DefetShow6.Name = "DefetShow6";
DefetShow6.Route = 0D;
DefetShow6.Scale = 1D;
DefetShow6.Size = new Size(209, 196);
DefetShow6.TabIndex = 11;
DefetShow6.WholeScale = 0F;
DefetShow6.XMove = 0F;
DefetShow6.XScale = 0F;
DefetShow6.YMove = 0F;
DefetShow6.YScale = 0F;
//
// DefetShow7
//
DefetShow7.AllowSelectDefect = true;
DefetShow7.BrushColor = null;
DefetShow7.ImagePath = "";
mat3.IsEnabledDispose = true;
DefetShow7.ImaMAt = mat3;
DefetShow7.ImgData = null;
DefetShow7.Location = new Point(1021, 464);
DefetShow7.MoveStep = 5F;
DefetShow7.Name = "DefetShow7";
DefetShow7.Route = 0D;
DefetShow7.Scale = 1D;
DefetShow7.Size = new Size(209, 196);
DefetShow7.TabIndex = 12;
DefetShow7.WholeScale = 0F;
DefetShow7.XMove = 0F;
DefetShow7.XScale = 0F;
DefetShow7.YMove = 0F;
DefetShow7.YScale = 0F;
//
// MainForm // MainForm
// //
AutoScaleDimensions = new SizeF(7F, 17F); AutoScaleDimensions = new SizeF(7F, 17F);
@ -1957,7 +1980,6 @@
private Label label15; private Label label15;
private Button StartDecBtn; private Button StartDecBtn;
private ContextMenuStrip contextMenuStrip1; private ContextMenuStrip contextMenuStrip1;
private Button InsertSqlBtn;
private PictureBox ResultMatShow2; private PictureBox ResultMatShow2;
private PictureBox originMatShow2; private PictureBox originMatShow2;
private TextBox OKDNum; private TextBox OKDNum;
@ -1968,7 +1990,6 @@
private Label label18; private Label label18;
private Label ; private Label ;
private PictureBox OKOrNGShow; private PictureBox OKOrNGShow;
private Button RefeshData;
private GroupBox groupBox3; private GroupBox groupBox3;
private Button SnapshotCam2; private Button SnapshotCam2;
private Button button3; private Button button3;
@ -2046,5 +2067,7 @@
private XKRS.UI.Canvas DefetShow3; private XKRS.UI.Canvas DefetShow3;
private XKRS.UI.Canvas DefetShow2; private XKRS.UI.Canvas DefetShow2;
private PictureBox originMat2Show; private PictureBox originMat2Show;
private XKRS.UI.Canvas DefetShow7;
private XKRS.UI.Canvas DefetShow6;
} }
} }

View File

@ -5,6 +5,7 @@ using OpenCvSharp;
using OpenCvSharp.Dnn; using OpenCvSharp.Dnn;
using OpenCvSharp.Extensions; using OpenCvSharp.Extensions;
using OpenCvSharp.XFeatures2D; using OpenCvSharp.XFeatures2D;
using Sunny.UI;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@ -189,13 +190,13 @@ namespace HisenceYoloDetection
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
string s1 = "ECO4060##Coton20¡æ##Rapide15mns"; string s1 = "0##Ec04060##20℃##Rapide15mns";
string s2 = "Eco4060##Coton20¡æ##Rapide15mns"; string s2 = "ECO4060##20°C##Rapide15mns";
bool st = ManagerModelHelper.StrMatch2(s1, s2); bool st = ManagerModelHelper.StrMatch2(s1, s2);
//Rect rect = new Rect(0, 0, 0, 0); //Rect rect = new Rect(0, 0, 0, 0);
//string path2 = "D:\\Hisence\\SQLImages\\W80WXWJ060539V0WW80WX120293\\2\\W80WXWJ060539V0WW80WX120293result.jpg"; // string path2 = "D:\\Hisence\\SQLImages\\BatchW81XBModelWNHA62SASUA\\3\\BatchW81XBModelWNHA62SASUAresult.jpg";
//Mat cameraMat = Cv2.ImRead(path2); //Mat cameraMat = Cv2.ImRead(path2);
//bool ifg = CheckDiffSciHelper.CheckDiffSci(path2, cameraMat, rect, rect, false, "D://Hisence//Test"); //bool ifg = CheckDiffSciHelper.CheckDiffSci(path2, cameraMat, rect, rect, false, "D://Hisence//Test");
@ -549,6 +550,7 @@ namespace HisenceYoloDetection
Bitmap NGbitmap = new Bitmap("NG.jpg"); Bitmap NGbitmap = new Bitmap("NG.jpg");
Mat OKMat = Cv2.ImRead("OK.jpg"); Mat OKMat = Cv2.ImRead("OK.jpg");
Mat NGMat = Cv2.ImRead("OK.jpg"); Mat NGMat = Cv2.ImRead("OK.jpg");
Mat whiteMat = Cv2.ImRead("white.jpg");
/// <summary> /// <summary>
/// 主线程调用 /// 主线程调用
/// </summary> /// </summary>
@ -1257,7 +1259,7 @@ namespace HisenceYoloDetection
{ {
// Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\ÀàÐÍ\\1\\202461817464661.jpg"); ; //Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\类型\\1\\001.jpg"); ;
Cam1ImgOne = cameraMat; Cam1ImgOne = cameraMat;
IfCam1OneTriger = true; IfCam1OneTriger = true;
originMatShow.Image = cameraMat.ToBitmap(); originMatShow.Image = cameraMat.ToBitmap();
@ -1268,8 +1270,8 @@ namespace HisenceYoloDetection
//第二次拍照 //第二次拍照
if (SnapshotCount == 2) if (SnapshotCount == 2)
{ {
//Mat mat = Cv2.ImRead("D:\\Hisence\\ÀàÐÍ\\1\\002.jpg"); // Mat mat = Cv2.ImRead("D:\\Hisence\\类型\\1\\002.jpg");
//Cam1ImgTwo = mat; // Cam1ImgTwo = mat;
Cam1ImgTwo = cameraMat; Cam1ImgTwo = cameraMat;
IfCam1TwoTriger = true; IfCam1TwoTriger = true;
@ -1314,7 +1316,7 @@ namespace HisenceYoloDetection
/// </summary> /// </summary>
public void ReadyDetect() public void ReadyDetect()
{ {
Task.Run((Action)(() => _ = Task.Run((Action)(() =>
{ {
Thread.CurrentThread.Priority = ThreadPriority.Highest; Thread.CurrentThread.Priority = ThreadPriority.Highest;
while (true) while (true)
@ -1340,7 +1342,7 @@ namespace HisenceYoloDetection
sw.WriteLine(IOcrBAr + "\n"); sw.WriteLine(IOcrBAr + "\n");
sw.Flush(); sw.Flush();
} }
IOcrBAr = "BatchW825UModelWNHEI74SAS"; IOcrBAr = "W821PWMS27106WD2";
//根据条码数据库比对 //根据条码数据库比对
xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值 xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值
List<XK_HisenceWord> xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr); List<XK_HisenceWord> xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr);
@ -1387,6 +1389,16 @@ namespace HisenceYoloDetection
//相机1第二次拍照 //相机1第二次拍照
if (IfCam1TwoTriger && bBarTriger) if (IfCam1TwoTriger && bBarTriger)
{ {
//初始化板
Defet_OnDetectionDone(whiteMat, 1);
Defet_OnDetectionDone(whiteMat, 2);
Defet_OnDetectionDone(whiteMat, 3);
Defet_OnDetectionDone(whiteMat, 4);
Defet_OnDetectionDone(whiteMat, 5);
Defet_OnDetectionDone(whiteMat, 6);
Defet_OnDetectionDone(whiteMat, 7);
XK_HisenceWord xK_MatchDet = new XK_HisenceWord(); XK_HisenceWord xK_MatchDet = new XK_HisenceWord();
xK_MatchDet.TwoIFWhile = xK_HisenceSQLWord.TwoIFWhile; xK_MatchDet.TwoIFWhile = xK_HisenceSQLWord.TwoIFWhile;
AllDsums++; AllDsums++;
@ -1466,29 +1478,27 @@ namespace HisenceYoloDetection
detstr += RealLabels[i]; detstr += RealLabels[i];
} }
}
//排序比对块
HashSet<string> set1 = new HashSet<string>(listLabels);
HashSet<string> set2 = new HashSet<string>(RealLabels);
bool MatchStr = set1.SetEquals(set2);
if (MatchStr)
{
//判断块值是否有含有匹配false
bool containsFalseValue = keyValueResult.ContainsValue(false);
bool containsFalseValue2 = keyValueResult2.ContainsValue(false);
if (containsFalseValue || containsFalseValue2)
MatchStr = false;
} }
///执行比对 小图 ///执行比对 小图
//bool MatchStr = ManagerModelHelper.IsMatchSQLText(ref mCut, ref xK_HisenceSQLWord, ref xK_MatchDet); //bool MatchStr = ManagerModelHelper.IsMatchSQLText(ref mCut, ref xK_HisenceSQLWord, ref xK_MatchDet);
bool MatchStr = true;
keyValueResult.ForEach(x =>
{
if (x.Value == false)
{
MatchStr = false;
return;
}
});
keyValueResult2.ForEach(x =>
{
if (x.Value == false)
{
MatchStr = false;
return;
}
});
// int sqlblocksum=
IfCam1TwoTriger = false; IfCam1TwoTriger = false;
bBarTriger = false; bBarTriger = false;
@ -1791,11 +1801,6 @@ namespace HisenceYoloDetection
myLog("开启流程成功", DateTime.Now); myLog("开启流程成功", DateTime.Now);
} }
private void InsertSqlBtn_Click(object sender, EventArgs e)
{
}
private void RefeshData_Click(object sender, EventArgs e) private void RefeshData_Click(object sender, EventArgs e)
{ {
DataSet dataSet = SQLiteHelper.Query("select * from XK_HisenceDet"); DataSet dataSet = SQLiteHelper.Query("select * from XK_HisenceDet");
@ -2619,17 +2624,17 @@ namespace HisenceYoloDetection
break; break;
case 6: case 6:
{ {
// DefetShow6.ImaMAt = detectionImage; DefetShow6.ImaMAt = detectionImage;
} }
break; break;
case 7: case 7:
{ {
// DefetShow7.ImaMAt = detectionImage; DefetShow7.ImaMAt = detectionImage;
} }
break; break;
case 8: case 8:
{ {
// DefetShow8.ImaMAt = detectionImage; //DefetShow8.ImaMAt = detectionImage;
} }
break; break;
@ -2659,7 +2664,13 @@ namespace HisenceYoloDetection
#if true #if true
//try //try
//{ //{
string filename = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString();
string txtLog = "D://Hisence//" + filename + "logsMatch.log";
using (StreamWriter sw = new StreamWriter(txtLog, true))
{
sw.WriteLine(filename + "\n");
sw.Flush();
}
Mat mResultCut = currentMatC.Clone(); Mat mResultCut = currentMatC.Clone();
Rect areaBlack = new Rect(); Rect areaBlack = new Rect();
//旋钮的位置 //旋钮的位置
@ -2684,12 +2695,12 @@ namespace HisenceYoloDetection
int rectsHeight = cam1TwoML.ResultDetails[i].Rect.Height; int rectsHeight = cam1TwoML.ResultDetails[i].Rect.Height;
string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay; string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay;
if(keyValueResult.Keys.Contains(blockIndex)) if (keyValueResult.Keys.Contains(blockIndex))
{ {
int indexof = keyValueResult.Keys.ToList().IndexOf(blockIndex); int indexof = keyValueResult.Keys.ToList().IndexOf(blockIndex);
int rectsxof = cam1TwoML.ResultDetails[indexof].Rect.X; int rectsxof = cam1TwoML.ResultDetails[indexof].Rect.X;
if(rectsx> rectsxof) if (rectsx > rectsxof)
{ {
blockIndex = "3"; blockIndex = "3";
} }
@ -3050,10 +3061,12 @@ namespace HisenceYoloDetection
} }
break; break;
} }
using (StreamWriter sw = new StreamWriter("D://Hisence//logsMatch.log", true)) string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString();
string txtLog = "D://Hisence//" + filename + "logsMatch.log";
using (StreamWriter sw = new StreamWriter(txtLog, true))
{ {
string filename = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
sw.WriteLine(filename + "\n");
if (blockIndex == "2") if (blockIndex == "2")
{ {
sw.WriteLine("卷积匹配" + juanjiMatch); sw.WriteLine("卷积匹配" + juanjiMatch);

View File

@ -142,7 +142,7 @@
<value>733, 17</value> <value>733, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>31</value> <value>34</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">

View File

@ -227,10 +227,13 @@ namespace HisenceYoloDetection
} }
static bool AreMoreThanHalfEqual(string[] array1, string[] array2) static bool AreMoreThanHalfEqual(string[] array1, string[] array2)
{ {
string Sqltext = array1.Join("");
string Realtext = array2.Join("");
int io = 0; int io = 0;
foreach (string ch1 in array1)
foreach (char ch2 in Realtext)
{ {
foreach (string ch2 in array2) foreach (char ch1 in Sqltext)
{ {
if (ch1 == ch2) if (ch1 == ch2)
{ {
@ -249,7 +252,7 @@ namespace HisenceYoloDetection
//int intersectionCount = set1.Intersect(set2).Count(); //int intersectionCount = set1.Intersect(set2).Count();
// 判断交集数量是否超过一半 // 判断交集数量是否超过一半
return io > array1.Length / 2; return io >=Sqltext.Length / 2;
} }
public static bool StrMatch2(string SqlText, string DetText) public static bool StrMatch2(string SqlText, string DetText)
{ {
@ -277,7 +280,7 @@ namespace HisenceYoloDetection
Console.WriteLine("字符串中不包含数字"); Console.WriteLine("字符串中不包含数字");
} }
bool areEqual ; bool areEqual ;
if (numbers2.Length>2&& numbers.Length > 2) if (numbers2.Length>0&& numbers.Length > 0)
{ {
areEqual = AreMoreThanHalfEqual(numbers, numbers2); areEqual = AreMoreThanHalfEqual(numbers, numbers2);
} }