修改图片闪烁,yolo先定位在识别,误检率和报警灯

This commit is contained in:
xhm\HP 2024-07-05 11:22:41 +08:00
parent a018a8f54d
commit eb55c5b784
6 changed files with 848 additions and 651 deletions

View File

@ -12,6 +12,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="MainForm.resx~RF4efdcc4.TMP" />
<None Remove="ManagerModelHelper.cs~RF97ff9f.TMP" /> <None Remove="ManagerModelHelper.cs~RF97ff9f.TMP" />
<None Remove="MelsecPLCTCPDriver.cs~RFacf25a.TMP" /> <None Remove="MelsecPLCTCPDriver.cs~RFacf25a.TMP" />
</ItemGroup> </ItemGroup>

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@ using System.Net;
using System.Numerics; using System.Numerics;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using XKRS.Device.SimboVision.SimboHelper; using XKRS.Device.SimboVision.SimboHelper;
using XKRS.UI; using XKRS.UI;
@ -64,6 +65,9 @@ namespace HisenceYoloDetection
List<XKHisence> xKHisences = new List<XKHisence>(); List<XKHisence> xKHisences = new List<XKHisence>();
static AutoResetEvent myResetEvent = new AutoResetEvent(false); static AutoResetEvent myResetEvent = new AutoResetEvent(false);
AutoResetEvent _runHandleBefore = new AutoResetEvent(false);
ManualResetEvent _runHandleAfter = new ManualResetEvent(false);
bool PLC545 = false; bool PLC545 = false;
bool PLC548 = false; bool PLC548 = false;
@ -103,7 +107,11 @@ namespace HisenceYoloDetection
string Cam1OnePath = ""; string Cam1OnePath = "";
string Cam1TwoPath = ""; string Cam1TwoPath = "";
string ModelChangePath = ""; string ModelChangePath = "";
//报警灯
string GreenLightingAdress = "";
string YellowLightingAdress = "";
string RedLightingAdress = "";
string WaringAdress = "";
/// <summary> /// <summary>
/// 查看相机列表 /// 查看相机列表
/// </summary> /// </summary>
@ -191,6 +199,19 @@ namespace HisenceYoloDetection
/// <param name="e"></param> /// <param name="e"></param>
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
{ {
//报警地址
if (_runHandleBefore == null)
{
_runHandleBefore = new AutoResetEvent(false);
}
if (_runHandleAfter == null)
{
_runHandleAfter = new ManualResetEvent(false);
}
string s1 = "gorenjeSTEAMTECHSNOWFLAKEDRUM65kg"; string s1 = "gorenjeSTEAMTECHSNOWFLAKEDRUM65kg";
string s2 = "STEAMTECHSNOWFLAKEDRUM65kg"; string s2 = "STEAMTECHSNOWFLAKEDRUM65kg";
@ -268,6 +289,8 @@ namespace HisenceYoloDetection
OnSpeedShow();//线程开启将速度显示在界面上 OnSpeedShow();//线程开启将速度显示在界面上
OnPostionShow();//线程开启将位置显示在界面上 OnPostionShow();//线程开启将位置显示在界面上
melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//黄灯
//t = new System.Timers.Timer(10000);//实例化Timer类设置间隔时间为10000毫秒 //t = new System.Timers.Timer(10000);//实例化Timer类设置间隔时间为10000毫秒
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//到达时间的时候执行事件; //t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//到达时间的时候执行事件;
//t.AutoReset = true;//设置是执行一次false还是一直执行(true) //t.AutoReset = true;//设置是执行一次false还是一直执行(true)
@ -983,11 +1006,12 @@ namespace HisenceYoloDetection
} }
if (iNum1 >= 2) if (iNum1 >= 2)
{ {
if (bBar) if (bBar)
{ {
_runHandleBefore.WaitOne();
bBarTriger = true;//修改成相机拍照获取型号 bBarTriger = true;//修改成相机拍照获取型号
Cam2.SnapshotCount = 0;
Cam2.Snapshot();
xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//从数据库中查询到这个条码的四轴的值 xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//从数据库中查询到这个条码的四轴的值
//xKNow = GetModeFromBar(m_sKEYENCEBar);//从数据库中查询到这个条码的四轴的值 //xKNow = GetModeFromBar(m_sKEYENCEBar);//从数据库中查询到这个条码的四轴的值
@ -1095,8 +1119,8 @@ namespace HisenceYoloDetection
//if (bBarTriger) //if (bBarTriger)
{ {
#if true #if false
if(!StopM) if (!StopM)
{ {
melsecPLCTCPDriver.WriteInt("550", 1);//阻塞 melsecPLCTCPDriver.WriteInt("550", 1);//阻塞
StopM = true; StopM = true;
@ -1123,7 +1147,7 @@ namespace HisenceYoloDetection
double disreal = average * (-0.54054) + 1324.3232; double disreal = average * (-0.54054) + 1324.3232;
//测距距离-标准距离=要移动的距离 //测距距离-标准距离=要移动的距离
double dismove = disreal - 876; double dismove = disreal - 876;
if (dismove > 0 && dismove < 4000) if (dismove > -4000 && dismove < 4000)
{ {
MoveToP(5815, YPos, ZPos + (int)(dismove)); MoveToP(5815, YPos, ZPos + (int)(dismove));
} }
@ -1135,12 +1159,12 @@ namespace HisenceYoloDetection
Cam2.SnapshotCount = 0; Cam2.SnapshotCount = 0;
Cam2.Snapshot(); Cam2.Snapshot();
myLog("第二次采集图像", DateTime.Now); myLog("第二次采集图像", DateTime.Now);
//if (xKNow != null) //if (xKNow != null)
//{ //{
// MoveToP(xKNow.MoveTwoX, xKNow.MoveTwoY, xKNow.MoveTwoZ); // MoveToP(xKNow.MoveTwoX, xKNow.MoveTwoY, xKNow.MoveTwoZ);
//} //}
//currentXP = 54964;
//Thread.Sleep(2000);//删
MoveToP(51043, YPos, ZPos + (int)(dismove)); MoveToP(51043, YPos, ZPos + (int)(dismove));
Cam1.Snapshot(); Cam1.Snapshot();
MoveToP(5815, YPos, ZPos); MoveToP(5815, YPos, ZPos);
@ -1277,8 +1301,8 @@ namespace HisenceYoloDetection
{ {
//Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\类型\\1\\001.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();
//pictureBox1.Image = cameraMat.ToBitmap(); //pictureBox1.Image = cameraMat.ToBitmap();
@ -1288,13 +1312,13 @@ namespace HisenceYoloDetection
//第二次拍照 //第二次拍照
if (SnapshotCount == 2) if (SnapshotCount == 2)
{ {
// Mat mat = Cv2.ImRead("D:\\Hisence\\类型\\1\\002.jpg");
// Cam1ImgTwo = mat; Cam1ImgTwo = Cv2.ImRead("D:\\Hisence\\类型\\1\\002.jpg");
Cam1ImgTwo = cameraMat; //Cam1ImgTwo = cameraMat;
IfCam1TwoTriger = true; IfCam1TwoTriger = true;
originMatShow2.Image = cameraMat.ToBitmap(); originMatShow2.Image = cameraMat.ToBitmap();
_runHandleAfter.Set();
} }
@ -1320,8 +1344,9 @@ namespace HisenceYoloDetection
// Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg"); // Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg");
Cam2ImgShowBar = cameraMat; Cam2ImgShowBar = cameraMat;
IfCam2Triger = true; IfCam2Triger = true;
originMat2Show.Image = cameraMat.ToBitmap();
originMat2Show.Image = cameraMat.ToBitmap();
//_runHandleAfter.Set();
// CamShow2.ImaMAt = cameraMat; // CamShow2.ImaMAt = cameraMat;
cameraMat.ImWrite(fitImageFolder + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "1.jpg"); cameraMat.ImWrite(fitImageFolder + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "1.jpg");
@ -1329,6 +1354,7 @@ namespace HisenceYoloDetection
public volatile int AllDsums = 0; public volatile int AllDsums = 0;
public volatile int NGDsums = 0; public volatile int NGDsums = 0;
public volatile int OKDsums = 0; public volatile int OKDsums = 0;
public volatile int WUsums = 0;
/// <summary> /// <summary>
/// 开始识别 /// 开始识别
/// </summary> /// </summary>
@ -1341,6 +1367,8 @@ namespace HisenceYoloDetection
{ {
try try
{ {
//信号量阻塞 使其不在总数增加和闪烁
_runHandleAfter.WaitOne();
//相机2第一次拍照 //相机2第一次拍照
if (IfCam2Triger) if (IfCam2Triger)
{ {
@ -1360,7 +1388,8 @@ namespace HisenceYoloDetection
sw.WriteLine(IOcrBAr + "\n"); sw.WriteLine(IOcrBAr + "\n");
sw.Flush(); sw.Flush();
} }
IOcrBAr = "BatchW96DHModelWF3S7021BWPl"; // IOcrBAr = "BatchW9659ModelWNHPI74SCPSDE";
IOcrBAr = "W821PWMS27106WD2";
//根据条码数据库比对 //根据条码数据库比对
xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值 xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值
List<XK_HisenceWord> xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr); List<XK_HisenceWord> xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr);
@ -1405,8 +1434,11 @@ namespace HisenceYoloDetection
} }
//相机1第二次拍照 //相机1第二次拍照
if (IfCam1TwoTriger && bBarTriger) // if (IfCam1TwoTriger && bBarTriger)
{ {
IfCam1TwoTriger = false;
bBarTriger = false;
_runHandleAfter.Reset();
//初始化板 //初始化板
Defet_OnDetectionDone(whiteMat, 1); Defet_OnDetectionDone(whiteMat, 1);
Defet_OnDetectionDone(whiteMat, 2); Defet_OnDetectionDone(whiteMat, 2);
@ -1416,7 +1448,6 @@ namespace HisenceYoloDetection
Defet_OnDetectionDone(whiteMat, 6); Defet_OnDetectionDone(whiteMat, 6);
Defet_OnDetectionDone(whiteMat, 7); 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++;
@ -1438,25 +1469,14 @@ namespace HisenceYoloDetection
List<string> strMatListOne = new List<string>(); List<string> strMatListOne = new List<string>();
List<string> strMatFuzzyListOne = new List<string>(); List<string> strMatFuzzyListOne = new List<string>();
Mat mResultCut = req.currentMat.Clone(); Mat mResultCut = req.currentMat.Clone();
Mat mCut = new Mat();
Stopwatch sw = new Stopwatch();
sw.Start();
Dictionary<string, bool> keyValueResult = new Dictionary<string, bool>();
InsertSqlRunDataButton(ref keyValueResult, false, ref mCut, ref mResultCut, mL, mLButton, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
sw.Stop();
myLog("插入面板时间" + sw.ElapsedMilliseconds, DateTime.Now);
if (mL.ResultMap != null) 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"); 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; ResultMatShow.Image = mL.ResultMap;
} }
else
{
Mat res_yolo = Cv2.ImRead("ng.jpg");
ResultMatShow.Image = res_yolo.ToBitmap();
}//无法框定导致图片闪烁加else无法解决
//进行推理 //进行推理
MLRequest req2 = new MLRequest(); MLRequest req2 = new MLRequest();
req2.currentMat = Cam1ImgTwo; req2.currentMat = Cam1ImgTwo;
@ -1468,18 +1488,18 @@ namespace HisenceYoloDetection
req2.iouThreshold = 0.4f;//检测IOU req2.iouThreshold = 0.4f;//检测IOU
req2.out_node_name = "output"; req2.out_node_name = "output";
MLResult mL2 = simboObjectDetection.RunInferenceFixed(req2); MLResult mL2 = simboObjectDetection.RunInferenceFixed(req2);
List<string> strMatListTwo = new List<string>();
List<string> strMatFuzzyListTwo = new List<string>();
Mat mResultCut2 = req2.currentMat.Clone();
Dictionary<string, bool> keyValueResult2 = new Dictionary<string, bool>();
InsertSqlRunData(ref keyValueResult2, false, ref mResultCut2, mL2, ref xK_HisenceSQLWord, ref xK_MatchDet, ref strMatListTwo, ref strMatFuzzyListTwo, ref paddleOcrModel);
if (mL2.ResultMap != null) if (mL2.ResultMap != null)
{ {
mL2.ResultMap.Save("D://cam1//" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg"); mL2.ResultMap.Save("D://cam1//" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
ResultMatShow2.Image = mL2.ResultMap; ResultMatShow2.Image = mL2.ResultMap;
} }
List<string> strMatListTwo = new List<string>();
List<string> strMatFuzzyListTwo = new List<string>();
Mat mResultCut2 = req2.currentMat.Clone();
Dictionary<string, bool> keyValueResult = new Dictionary<string, bool>();
Dictionary<string, bool> keyValueResult2 = new Dictionary<string, bool>();
#region
//执行定位数组块 //执行定位数组块
string[] listLabels = xKNow.Detect.Split(","); string[] listLabels = xKNow.Detect.Split(",");
@ -1507,6 +1527,25 @@ namespace HisenceYoloDetection
HashSet<string> set1 = new HashSet<string>(listLabels); HashSet<string> set1 = new HashSet<string>(listLabels);
HashSet<string> set2 = new HashSet<string>(RealLabels); HashSet<string> set2 = new HashSet<string>(RealLabels);
bool MatchStr = set1.SetEquals(set2); bool MatchStr = set1.SetEquals(set2);
#endregion
//块比对完了 进行详细比对
if (MatchStr)
{
//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);
sw.Stop();
myLog("插入面板时间" + sw.ElapsedMilliseconds, DateTime.Now);
}
if (MatchStr) if (MatchStr)
{ {
@ -1523,8 +1562,6 @@ namespace HisenceYoloDetection
// int sqlblocksum= // int sqlblocksum=
IfCam1TwoTriger = false;
bBarTriger = false;
melsecPLCTCPDriver.WriteInt("550", 0);//方行 melsecPLCTCPDriver.WriteInt("550", 0);//方行
@ -1543,14 +1580,39 @@ namespace HisenceYoloDetection
} }
else else
{ {
NGDsums++; melsecPLCTCPDriver.WriteInt(RedLightingAdress, 1);//红灯
melsecPLCTCPDriver.WriteInt(WaringAdress, 1);//报警
myLog("匹配失败", DateTime.Now); myLog("匹配失败", DateTime.Now);
//界面显示 //加上人为判断是否是NG洗衣机
// InsertXK_HisenceWordMatchData(xK_MatchDet, false); DialogResult dr = MessageBox.Show("是否误检?", "是否误检", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//红灯
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//报警
OKDsums++;
WUsums++;
this.Invoke(new Action(() =>
{
double percent = (double)WUsums/ AllDsums;
string percentText = percent.ToString("0.0%");//最后percentText的值为10.0%
textBox1.Text = percentText;
OKOrNGShow.Image = OKbitmap;
}));
}
else
{
NGDsums++;
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//报警
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//红灯
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
OKOrNGShow.Image = NGbitmap; OKOrNGShow.Image = NGbitmap;
})); }));
}
} }
@ -1559,7 +1621,7 @@ namespace HisenceYoloDetection
} }
catch (Exception e) catch (Exception e)
{ {
throw e;
} }
finally finally
{ {
@ -1639,7 +1701,7 @@ namespace HisenceYoloDetection
{ {
m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data); m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data);
// myLog("型号Ocr" + m_sKEYENCEBar, DateTime.Now); // myLog("型号Ocr" + m_sKEYENCEBar, DateTime.Now);
_runHandleBefore.Set();
bBar = true; bBar = true;
} }
@ -1838,6 +1900,7 @@ namespace HisenceYoloDetection
*/ */
//OnGetBar(); //OnGetBar();
melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 1);//黄灯
TriggerCameral2(); TriggerCameral2();
ReadyDetect(); ReadyDetect();
myLog("开启流程成功", DateTime.Now); myLog("开启流程成功", DateTime.Now);
@ -2235,9 +2298,9 @@ namespace HisenceYoloDetection
List<string> strMatListOne = new List<string>(); List<string> strMatListOne = new List<string>();
List<string> strMatFuzzyListOne = new List<string>(); List<string> strMatFuzzyListOne = new List<string>();
Mat mResultCut = CamOneI.currentMat.Clone(); Mat mResultCut = CamOneI.currentMat.Clone();
Mat mCut = new Mat(); //Mat mCut = new Mat();
Dictionary<string, bool> keyValueResult = new Dictionary<string, bool>(); Dictionary<string, bool> keyValueResult = new Dictionary<string, bool>();
InsertSqlRunDataButton(ref keyValueResult, true, ref mCut, 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);
@ -2641,37 +2704,37 @@ namespace HisenceYoloDetection
{ {
case 1: case 1:
{ {
DefetShow1.ImaMAt = detectionImage; canvas1.ImaMAt = detectionImage;
} }
break; break;
case 2: case 2:
{ {
DefetShow2.ImaMAt = detectionImage; canvas2.ImaMAt = detectionImage;
} }
break; break;
case 3: case 3:
{ {
DefetShow3.ImaMAt = detectionImage; canvas3.ImaMAt = detectionImage;
} }
break; break;
case 4: case 4:
{ {
DefetShow4.ImaMAt = detectionImage; canvas4.ImaMAt = detectionImage;
} }
break; break;
case 5: case 5:
{ {
DefetShow5.ImaMAt = detectionImage; canvas5.ImaMAt = detectionImage;
} }
break; break;
case 6: case 6:
{ {
DefetShow6.ImaMAt = detectionImage; canvas6.ImaMAt = detectionImage;
} }
break; break;
case 7: case 7:
{ {
DefetShow7.ImaMAt = detectionImage; // canvas7.ImaMAt = detectionImage;
} }
break; break;
case 8: case 8:
@ -2701,7 +2764,7 @@ namespace HisenceYoloDetection
/// <param name="strMatList">返回的定位框的结果</param> /// <param name="strMatList">返回的定位框的结果</param>
/// <param name="strMatRefList"></param> /// <param name="strMatRefList"></param>
/// <param name="IOcrModel"></param> /// <param name="IOcrModel"></param>
public void InsertSqlRunDataButton(ref Dictionary<string, bool> keyValueResult, bool saveimage, ref Mat CutMat, ref Mat currentMatC, MLResult cam1TwoML, MLResult cam1Button, ref XK_HisenceWord SQlxK_HisenceWord, ref XK_HisenceWord xK_HisenceWord, ref List<string> strMatList, ref List<string> strMatRefList, ref PaddleOcrModel IOcrModel) public void InsertSqlRunDataButton(ref Dictionary<string, bool> keyValueResult, bool saveimage, ref Mat currentMatC, MLResult cam1TwoML, MLResult cam1Button, ref XK_HisenceWord SQlxK_HisenceWord, ref XK_HisenceWord xK_HisenceWord, ref List<string> strMatList, ref List<string> strMatRefList, ref PaddleOcrModel IOcrModel)
{ {
#if true #if true
//try //try
@ -3081,10 +3144,10 @@ namespace HisenceYoloDetection
Rect rect = new Rect(0, 0, 0, 0); Rect rect = new Rect(0, 0, 0, 0);
string PathSql = SQlxK_HisenceWord.SixblockPath; string PathSql = SQlxK_HisenceWord.SixblockPath;
//第六块卷积设置一直为true
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test"); juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
juanjiMatch = true;
if (!OneIF1 || !juanjiMatch) if (!OneIF1 || !juanjiMatch)
if (!OneIF)
{ {
OneIF = false; OneIF = false;
// DisplayResult(mLcut); // DisplayResult(mLcut);
@ -3228,5 +3291,10 @@ namespace HisenceYoloDetection
{ {
melsecPLCTCPDriver.WriteInt("550", 0); melsecPLCTCPDriver.WriteInt("550", 0);
} }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
melsecPLCTCPDriver.WriteInt("550", 0);
}
} }
} }

View File

@ -11,7 +11,7 @@ using static OpenCvSharp.FileStorage;
public class MelsecPLCTCPDriver public class MelsecPLCTCPDriver1
{ {
private MelsecMcNet melsecMc = new MelsecMcNet(); private MelsecMcNet melsecMc = new MelsecMcNet();
// private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet(); // private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet();

View File

@ -12,7 +12,7 @@ using static OpenCvSharp.FileStorage;
public class MelsecPLCTCPDriver1 public class MelsecPLCTCPDriver
{ {
// private MelsecMcNet melsecMc = new MelsecMcNet(); // private MelsecMcNet melsecMc = new MelsecMcNet();
// private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet(); // private HslCommunication.ModBus.ModbusTcpNet melsecMc = new HslCommunication.ModBus.ModbusTcpNet();

View File

@ -399,6 +399,7 @@ namespace XKRS.UI
} }
#endregion #endregion
#region #region
GPathList.ForEach(path => GPathList.ForEach(path =>
{ {