Compare commits
1 Commits
dev_featur
...
Dev
Author | SHA1 | Date | |
---|---|---|---|
0ed659e482 |
@ -1,12 +1,10 @@
|
|||||||
using OpenCvSharp;
|
using OpenCvSharp;
|
||||||
using Sunny.UI.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using static System.Net.Mime.MediaTypeNames;
|
|
||||||
using Point = OpenCvSharp.Point;
|
using Point = OpenCvSharp.Point;
|
||||||
using Size = OpenCvSharp.Size;
|
using Size = OpenCvSharp.Size;
|
||||||
|
|
||||||
@ -16,6 +14,7 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
public static class CheckDiffSciHelper
|
public static class CheckDiffSciHelper
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -25,7 +24,7 @@ namespace HisenceYoloDetection
|
|||||||
/// <param name="saveDir">存储路径</param>
|
/// <param name="saveDir">存储路径</param>
|
||||||
public static bool CheckDiffSci(string path1, Mat MatDet,Rect sqlrect,Rect detrect, bool IfWhiteWord, string saveDir)
|
public static bool CheckDiffSci(string path1, Mat MatDet,Rect sqlrect,Rect detrect, bool IfWhiteWord, string saveDir)
|
||||||
{
|
{
|
||||||
// 读取和处理第一张图片。。
|
// 读取和处理第一张图片
|
||||||
Mat img1 = Cv2.ImRead(path1, ImreadModes.Color);
|
Mat img1 = Cv2.ImRead(path1, ImreadModes.Color);
|
||||||
if (img1.Empty())
|
if (img1.Empty())
|
||||||
{
|
{
|
||||||
@ -69,13 +68,13 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
}
|
}
|
||||||
|
// Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Rect area2 = new Rect(148,30,229,222);
|
//Rect area2 = new Rect(148,30,229,222);
|
||||||
sqlrect.Width += 20;
|
sqlrect.Width += 20;
|
||||||
sqlrect.Height += 60;
|
|
||||||
detrect.Width += 20;
|
detrect.Width += 20;
|
||||||
detrect.Height += 60;
|
|
||||||
Mat matCutblack1 = new Mat(thr1, sqlrect);
|
Mat matCutblack1 = new Mat(thr1, sqlrect);
|
||||||
if (IfWhiteWord)
|
if (IfWhiteWord)
|
||||||
{
|
{
|
||||||
@ -99,14 +98,14 @@ namespace HisenceYoloDetection
|
|||||||
DateTime dt= DateTime.Now;
|
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 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);
|
Cv2.ImWrite(savePath4, thr1);
|
||||||
//string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr2.png");
|
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));
|
Mat filter1 = new Mat(15, 15, MatType.CV_32F, new Scalar(0));
|
||||||
@ -146,17 +145,10 @@ namespace HisenceYoloDetection
|
|||||||
Mat devIMG_ = new Mat();
|
Mat devIMG_ = new Mat();
|
||||||
Cv2.Subtract(final_result1, final_result2, devIMG);
|
Cv2.Subtract(final_result1, final_result2, devIMG);
|
||||||
Cv2.Subtract(final_result2, final_result1, 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_);
|
|
||||||
// 对差异图像应用阈值
|
// 对差异图像应用阈值
|
||||||
Cv2.Threshold(devIMG, devIMG, 20, 255, ThresholdTypes.Binary);
|
Cv2.Threshold(devIMG, devIMG, 50, 255, ThresholdTypes.Binary);
|
||||||
Cv2.Threshold(devIMG_, devIMG_, 20, 255, ThresholdTypes.Binary);
|
Cv2.Threshold(devIMG_, devIMG_, 50, 255, ThresholdTypes.Binary);
|
||||||
|
|
||||||
// 结合差异
|
// 结合差异
|
||||||
Mat sumIMG = new Mat();
|
Mat sumIMG = new Mat();
|
||||||
@ -167,240 +159,6 @@ namespace HisenceYoloDetection
|
|||||||
Mat blackhatImg = new Mat();
|
Mat blackhatImg = new Mat();
|
||||||
Cv2.Dilate(sumIMG, blackhatImg, kernelCL);
|
Cv2.Dilate(sumIMG, blackhatImg, kernelCL);
|
||||||
|
|
||||||
// 处理轮廓和保存结果
|
|
||||||
Point[][] contours = new Point[10000][];
|
|
||||||
Cv2.FindContours(blackhatImg, out contours, out _, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple);
|
|
||||||
bool isMatch = true;
|
|
||||||
foreach (var contour in contours)
|
|
||||||
{
|
|
||||||
if (Cv2.ContourArea(contour) <= 500)
|
|
||||||
{
|
|
||||||
Cv2.DrawContours(blackhatImg, new Point[][] { contour }, -1, Scalar.Black, thickness: Cv2.FILLED);
|
|
||||||
// 框选轮廓
|
|
||||||
string savePath2 = Path.Combine("D:\\Hisence\\Test\\2\\ng", Path.GetFileNameWithoutExtension(path1) + filename + "_Rect.png");
|
|
||||||
// 保存结果
|
|
||||||
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
Cv2.ImWrite(savePath2, img2);
|
|
||||||
string savePath = Path.Combine("D:\\Hisence\\Test\\2\\ng", Path.GetFileNameWithoutExtension(path1) + filename + "_diff.png");
|
|
||||||
// 保存结果
|
|
||||||
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
Cv2.ImWrite(savePath, blackhatImg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Rect boundingRect = Cv2.BoundingRect(contour);
|
|
||||||
Cv2.Rectangle(img2, boundingRect, Scalar.Red, thickness: 2);
|
|
||||||
isMatch = false;
|
|
||||||
string savePath2 = Path.Combine("D:\\Hisence\\Test\\2\\ok", Path.GetFileNameWithoutExtension(path1) + filename + "_Rect.png");
|
|
||||||
// 保存结果
|
|
||||||
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
Cv2.ImWrite(savePath2, img2);
|
|
||||||
string savePath = Path.Combine("D:\\Hisence\\Test\\2\\ok", Path.GetFileNameWithoutExtension(path1) + filename + "_diff.png");
|
|
||||||
// 保存结果
|
|
||||||
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
Cv2.ImWrite(savePath, blackhatImg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return isMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static Rect strChangeRect(string strrect)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(strrect))
|
|
||||||
{
|
|
||||||
string[] rectstr = strrect.Split(",");
|
|
||||||
int areaX = int.Parse(rectstr[0]);
|
|
||||||
int areaY = int.Parse(rectstr[1]);
|
|
||||||
int areaWidth = int.Parse(rectstr[2]);
|
|
||||||
int areaHeight = int.Parse(rectstr[3]);
|
|
||||||
|
|
||||||
Rect rect = new Rect(areaX, areaY, areaWidth, areaHeight);
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new Rect(0, 0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string rectChangeStr(Rect area)
|
|
||||||
{
|
|
||||||
string[] rectsql = new string[4];
|
|
||||||
rectsql[0] = Convert.ToString(area.X);
|
|
||||||
rectsql[1] = Convert.ToString(area.Y);
|
|
||||||
rectsql[2] = Convert.ToString(area.Width);
|
|
||||||
rectsql[3] = Convert.ToString(area.Height);
|
|
||||||
|
|
||||||
string strrect = rectsql.Join(",");
|
|
||||||
return strrect;
|
|
||||||
}
|
|
||||||
public static class CheckDiffSciHelper1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path1">标准图像</param>
|
|
||||||
/// <param name="path2">要对比的图像</param>
|
|
||||||
/// <param name="IfWhiteWord"> 白板黑字为true </param>
|
|
||||||
/// <param name="saveDir">存储路径</param>
|
|
||||||
public static bool CheckDiffSci(string path1, Mat MatDet, Rect sqlrect, Rect detrect, bool IfWhiteWord, string saveDir)
|
|
||||||
{
|
|
||||||
// 读取和处理第一张图片
|
|
||||||
Mat img1 = Cv2.ImRead(path1, ImreadModes.Color);
|
|
||||||
if (img1.Empty())
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Error loading image {path1}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Cv2.Resize(img1, img1, new Size(550, 270));
|
|
||||||
Mat gimg1 = new Mat();
|
|
||||||
Cv2.CvtColor(img1, gimg1, ColorConversionCodes.BGR2GRAY);
|
|
||||||
Mat thr1 = new Mat();
|
|
||||||
|
|
||||||
if (IfWhiteWord)
|
|
||||||
{
|
|
||||||
Cv2.Threshold(gimg1, thr1, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Cv2.Threshold(gimg1, thr1, 100, 255, ThresholdTypes.Binary );//| ThresholdTypes.Otsu
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 读取和处理第二张图片
|
|
||||||
Mat img2 = MatDet.Clone();
|
|
||||||
if (img2.Empty())
|
|
||||||
{
|
|
||||||
// Console.WriteLine($"Error loading image {path2}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Cv2.Resize(img2, img2, new Size(550, 270));
|
|
||||||
Mat gimg2 = new Mat();
|
|
||||||
Cv2.CvtColor(img2, gimg2, ColorConversionCodes.BGR2GRAY);
|
|
||||||
Mat thr2 = new Mat();
|
|
||||||
//Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
|
||||||
if (IfWhiteWord)
|
|
||||||
{
|
|
||||||
Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Cv2.Threshold(gimg2, thr2, 100, 255, ThresholdTypes.Binary );//| ThresholdTypes.Otsu
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Rect area2 = new Rect(148,30,229,222);
|
|
||||||
sqlrect.Width += 20;
|
|
||||||
sqlrect.Height += 20;
|
|
||||||
detrect.Width += 20;
|
|
||||||
detrect.Height += 20;
|
|
||||||
Mat matCutblack1 = new Mat(thr1, sqlrect);
|
|
||||||
if (IfWhiteWord)
|
|
||||||
{
|
|
||||||
matCutblack1.SetTo(Scalar.Black);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
matCutblack1.SetTo(Scalar.Black);
|
|
||||||
}
|
|
||||||
Mat matCutblack2 = new Mat(thr2, detrect);
|
|
||||||
if (IfWhiteWord)
|
|
||||||
{
|
|
||||||
matCutblack2.SetTo(Scalar.Black);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
matCutblack2.SetTo(Scalar.Black);
|
|
||||||
}
|
|
||||||
Cv2.Resize(thr1, thr1, new Size(845, 498));
|
|
||||||
Cv2.Resize(thr2, thr2, new Size(845, 498));
|
|
||||||
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");
|
|
||||||
//// 保存结果
|
|
||||||
|
|
||||||
//Cv2.ImWrite(savePath4, thr1);
|
|
||||||
//string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "_thr2.png");
|
|
||||||
//// 保存结果
|
|
||||||
|
|
||||||
//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 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);
|
|
||||||
//裁剪才行
|
|
||||||
|
|
||||||
|
|
||||||
//string savePath2 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_final_result1.png");
|
|
||||||
//// 保存结果
|
|
||||||
////string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
//Cv2.ImWrite(savePath2, final_result1);
|
|
||||||
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_final_result2.png");
|
|
||||||
//// 保存结果
|
|
||||||
////string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
|
||||||
//Cv2.ImWrite(savePath, final_result2);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 计算图像差异
|
|
||||||
Mat devIMG = new Mat();
|
|
||||||
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_);
|
|
||||||
// 对差异图像应用阈值
|
|
||||||
Cv2.Threshold(devIMG, devIMG, 45, 255, ThresholdTypes.Binary);
|
|
||||||
Cv2.Threshold(devIMG_, devIMG_, 45, 255, ThresholdTypes.Binary);
|
|
||||||
|
|
||||||
// 结合差异
|
|
||||||
Mat sumIMG = new Mat();
|
|
||||||
Cv2.Add(devIMG, devIMG_, sumIMG);
|
|
||||||
//string savePaths = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + filename + "sumIMG.png");
|
|
||||||
//// 保存结果
|
|
||||||
|
|
||||||
//Cv2.ImWrite(savePaths, sumIMG);
|
|
||||||
// 应用形态学操作
|
|
||||||
Mat kernelCL = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(3, 3));
|
|
||||||
Mat blackhatImg = new Mat();
|
|
||||||
Cv2.Dilate(sumIMG, blackhatImg, kernelCL);
|
|
||||||
|
|
||||||
// 处理轮廓和保存结果
|
// 处理轮廓和保存结果
|
||||||
Point[][] contours = new Point[10000][];
|
Point[][] contours = new Point[10000][];
|
||||||
Cv2.FindContours(blackhatImg, out contours, out _, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple);
|
Cv2.FindContours(blackhatImg, out contours, out _, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple);
|
||||||
@ -431,6 +189,154 @@ namespace HisenceYoloDetection
|
|||||||
Cv2.ImWrite(savePath, blackhatImg);
|
Cv2.ImWrite(savePath, blackhatImg);
|
||||||
return isMatch;
|
return isMatch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public static Rect strChangeRect(string strrect)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(strrect))
|
||||||
|
{
|
||||||
|
string[] rectstr = strrect.Split(",");
|
||||||
|
int areaX = int.Parse(rectstr[0]);
|
||||||
|
int areaY = int.Parse(rectstr[1]);
|
||||||
|
int areaWidth = int.Parse(rectstr[2]);
|
||||||
|
int areaHeight = int.Parse(rectstr[3]);
|
||||||
|
|
||||||
|
Rect rect = new Rect(areaX, areaY, areaWidth, areaHeight);
|
||||||
|
return rect;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
return new Rect(0,0,0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string rectChangeStr(Rect area)
|
||||||
|
{
|
||||||
|
string[] rectsql = new string[4];
|
||||||
|
rectsql[0] = Convert.ToString(area.X);
|
||||||
|
rectsql[1] = Convert.ToString(area.Y);
|
||||||
|
rectsql[2] = Convert.ToString(area.Width);
|
||||||
|
rectsql[3] = Convert.ToString(area.Height);
|
||||||
|
|
||||||
|
string strrect = rectsql.Join(",");
|
||||||
|
return strrect;
|
||||||
|
}
|
||||||
|
//public static void CheckDiffSci(string path1, string path2, bool IfWhiteWord, string saveDir)
|
||||||
|
//{
|
||||||
|
// // 读取和处理第一张图片
|
||||||
|
// Mat img1 = Cv2.ImRead(path1, ImreadModes.Color);
|
||||||
|
// if (img1.Empty())
|
||||||
|
// {
|
||||||
|
// Console.WriteLine($"Error loading image {path1}");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// Cv2.Resize(img1, img1, new Size(550, 270));
|
||||||
|
// Mat gimg1 = new Mat();
|
||||||
|
// Cv2.CvtColor(img1, gimg1, ColorConversionCodes.BGR2GRAY);
|
||||||
|
// Mat thr1 = new Mat();
|
||||||
|
|
||||||
|
// if (IfWhiteWord)
|
||||||
|
// {
|
||||||
|
// Cv2.Threshold(gimg1, thr1, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Cv2.Threshold(gimg1, thr1, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// string savePath4 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_thr1.png");
|
||||||
|
// // 保存结果
|
||||||
|
// //string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
// Cv2.ImWrite(savePath4, thr1);
|
||||||
|
|
||||||
|
// // 读取和处理第二张图片
|
||||||
|
// Mat img2 = Cv2.ImRead(path2, ImreadModes.Color);
|
||||||
|
// if (img2.Empty())
|
||||||
|
// {
|
||||||
|
// Console.WriteLine($"Error loading image {path2}");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// Cv2.Resize(img2, img2, new Size(550, 270));
|
||||||
|
// Mat gimg2 = new Mat();
|
||||||
|
// Cv2.CvtColor(img2, gimg2, ColorConversionCodes.BGR2GRAY);
|
||||||
|
// Mat thr2 = new Mat();
|
||||||
|
// //Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
||||||
|
// if (IfWhiteWord)
|
||||||
|
// {
|
||||||
|
// Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.BinaryInv | ThresholdTypes.Otsu);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
// }
|
||||||
|
// // Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
|
||||||
|
// string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_thr2.png");
|
||||||
|
// // 保存结果
|
||||||
|
// //string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
// Cv2.ImWrite(savePath3, thr2);
|
||||||
|
|
||||||
|
// // 创建卷积核
|
||||||
|
// Mat filter1 = new Mat(17, 17, MatType.CV_32F, new Scalar(0));
|
||||||
|
// filter1.Row(8).SetTo(new Scalar(0.025));
|
||||||
|
// filter1.Col(8).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);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// // 计算图像差异
|
||||||
|
// Mat devIMG = new Mat();
|
||||||
|
// Mat devIMG_ = new Mat();
|
||||||
|
// Cv2.Subtract(final_result1, final_result2, devIMG);
|
||||||
|
// Cv2.Subtract(final_result2, final_result1, devIMG_);
|
||||||
|
|
||||||
|
// // 对差异图像应用阈值
|
||||||
|
// Cv2.Threshold(devIMG, devIMG, 50, 255, ThresholdTypes.Binary);
|
||||||
|
// Cv2.Threshold(devIMG_, devIMG_, 50, 255, ThresholdTypes.Binary);
|
||||||
|
|
||||||
|
// // 结合差异
|
||||||
|
// Mat sumIMG = new Mat();
|
||||||
|
// Cv2.Add(devIMG, devIMG_, sumIMG);
|
||||||
|
|
||||||
|
// // 应用形态学操作
|
||||||
|
// Mat kernelCL = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(3, 3));
|
||||||
|
// Mat blackhatImg = new Mat();
|
||||||
|
// Cv2.Dilate(sumIMG, blackhatImg, kernelCL);
|
||||||
|
|
||||||
|
// // 处理轮廓和保存结果
|
||||||
|
// Point[][] contours = new Point[10000][];
|
||||||
|
// Cv2.FindContours(blackhatImg, out contours, out _, RetrievalModes.Tree, ContourApproximationModes.ApproxSimple);
|
||||||
|
|
||||||
|
// foreach (var contour in contours)
|
||||||
|
// {
|
||||||
|
// if (Cv2.ContourArea(contour) <= 100)
|
||||||
|
// {
|
||||||
|
// Cv2.DrawContours(blackhatImg, new Point[][] { contour }, -1, Scalar.Black, thickness: Cv2.FILLED);
|
||||||
|
// // 框选轮廓
|
||||||
|
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// Rect boundingRect = Cv2.BoundingRect(contour);
|
||||||
|
// Cv2.Rectangle(img2, boundingRect, Scalar.Red, thickness: 2);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// string savePath2 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_Rect.png");
|
||||||
|
// // 保存结果
|
||||||
|
// //string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
// Cv2.ImWrite(savePath2, img2);
|
||||||
|
// string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
// // 保存结果
|
||||||
|
// //string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
// Cv2.ImWrite(savePath, blackhatImg);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
</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>
|
||||||
|
1294
HisenceYoloDetection/MainForm.Designer.cs
generated
1294
HisenceYoloDetection/MainForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,6 @@ using OpenCvSharp.Dnn;
|
|||||||
using OpenCvSharp.Extensions;
|
using OpenCvSharp.Extensions;
|
||||||
using OpenCvSharp.XFeatures2D;
|
using OpenCvSharp.XFeatures2D;
|
||||||
using Sunny.UI;
|
using Sunny.UI;
|
||||||
using Sunny.UI.Win32;
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -22,11 +21,9 @@ 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;
|
||||||
using static HisenceYoloDetection.CheckDiffSciHelper;
|
|
||||||
using static HisenceYoloDetection.MainForm;
|
using static HisenceYoloDetection.MainForm;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
@ -65,9 +62,6 @@ 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;
|
||||||
@ -107,11 +101,7 @@ namespace HisenceYoloDetection
|
|||||||
string Cam1OnePath = "";
|
string Cam1OnePath = "";
|
||||||
string Cam1TwoPath = "";
|
string Cam1TwoPath = "";
|
||||||
string ModelChangePath = "";
|
string ModelChangePath = "";
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
||||||
string GreenLightingAdress = "";
|
|
||||||
string YellowLightingAdress = "";
|
|
||||||
string RedLightingAdress = "";
|
|
||||||
string WaringAdress = "";
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
/// <20>鿴<EFBFBD><E9BFB4><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -199,28 +189,14 @@ 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)
|
||||||
{
|
{
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
||||||
|
|
||||||
|
string s1 = "0##Ec04060##20<32><30>##Rapide15mns";
|
||||||
|
string s2 = "ECO4060##20<32><30>C##Rapide15mns";
|
||||||
|
|
||||||
|
bool st = ManagerModelHelper.StrMatch2(s1, s2);
|
||||||
if (_runHandleBefore == null)
|
|
||||||
{
|
|
||||||
_runHandleBefore = new AutoResetEvent(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_runHandleAfter == null)
|
|
||||||
{
|
|
||||||
_runHandleAfter = new ManualResetEvent(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
string s1 = "gorenjeSTEAMTECHSNOWFLAKEDRUM65kg";
|
|
||||||
string s2 = "STEAMTECHSNOWFLAKEDRUM65kg";
|
|
||||||
|
|
||||||
bool st = ManagerModelHelper.StrMatch(s1, s2);
|
|
||||||
bool st1 = 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");
|
||||||
|
|
||||||
@ -289,8 +265,6 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
OnSpeedShow();//<2F>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD>ʾ<EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>
|
OnSpeedShow();//<2F>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD>ʾ<EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
OnPostionShow();//<2F>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>
|
OnPostionShow();//<2F>߳̿<DFB3><CCBF><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ<EFBFBD>ڽ<EFBFBD><DABD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
melsecPLCTCPDriver.WriteInt(YellowLightingAdress, 1);//<2F>Ƶ<EFBFBD>
|
|
||||||
|
|
||||||
//t = new System.Timers.Timer(10000);//ʵ<><CAB5><EFBFBD><EFBFBD>Timer<65>࣬<EFBFBD><E0A3AC><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>ʱ<EFBFBD><CAB1>Ϊ10000<30><30><EFBFBD>룻
|
//t = new System.Timers.Timer(10000);//ʵ<><CAB5><EFBFBD><EFBFBD>Timer<65>࣬<EFBFBD><E0A3AC><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>ʱ<EFBFBD><CAB1>Ϊ10000<30><30><EFBFBD>룻
|
||||||
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ִ<EFBFBD><D6B4><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>
|
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>ִ<EFBFBD><D6B4><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>
|
||||||
//t.AutoReset = true;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD>Σ<EFBFBD>false<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һֱִ<D6B1><D6B4>(true)<29><>
|
//t.AutoReset = true;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>һ<EFBFBD>Σ<EFBFBD>false<73><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һֱִ<D6B1><D6B4>(true)<29><>
|
||||||
@ -300,7 +274,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
public void Execute(object source, System.Timers.ElapsedEventArgs e)
|
public void Execute(object source, System.Timers.ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
t.Stop(); //<2F>ȹرն<D8B1>ʱ<EFBFBD><CAB1>
|
t.Stop(); //<2F>ȹرն<D8B1>ʱ<EFBFBD><CAB1>
|
||||||
//melsecPLCTCPDriver.WriteInt("548", 1);
|
//melsecPLCTCPDriver.WriteInt("548", 1);
|
||||||
//Thread.Sleep(1000);
|
//Thread.Sleep(1000);
|
||||||
@ -548,7 +521,6 @@ namespace HisenceYoloDetection
|
|||||||
// tbFrameRate.Enabled = false;
|
// tbFrameRate.Enabled = false;
|
||||||
bnGetParam.Enabled = false;
|
bnGetParam.Enabled = false;
|
||||||
bnSetParam.Enabled = false;
|
bnSetParam.Enabled = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
private void button3_Click(object sender, EventArgs e)
|
private void button3_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -622,10 +594,10 @@ namespace HisenceYoloDetection
|
|||||||
melsecPLCTCPDriver.WriteInt("514", 0);//<2F><>λ<EFBFBD>ɿ<EFBFBD>
|
melsecPLCTCPDriver.WriteInt("514", 0);//<2F><>λ<EFBFBD>ɿ<EFBFBD>
|
||||||
melsecPLCTCPDriver.WriteInt("524", 0);//<2F><>λ<EFBFBD>ɿ<EFBFBD>
|
melsecPLCTCPDriver.WriteInt("524", 0);//<2F><>λ<EFBFBD>ɿ<EFBFBD>
|
||||||
melsecPLCTCPDriver.WriteInt("406", 60000); //д<><D0B4><EFBFBD>ֶ<EFBFBD><D6B6>ٶ<EFBFBD>
|
melsecPLCTCPDriver.WriteInt("406", 60000); //д<><D0B4><EFBFBD>ֶ<EFBFBD><D6B6>ٶ<EFBFBD>
|
||||||
melsecPLCTCPDriver.WriteInt("416", 10000);
|
melsecPLCTCPDriver.WriteInt("416", 8000);
|
||||||
melsecPLCTCPDriver.WriteInt("426", 10000);
|
melsecPLCTCPDriver.WriteInt("426", 10000);
|
||||||
melsecPLCTCPDriver.WriteInt("404", 100000); //д<>붨λ<EBB6A8>ٶ<EFBFBD>
|
melsecPLCTCPDriver.WriteInt("404", 100000); //д<>붨λ<EBB6A8>ٶ<EFBFBD>
|
||||||
melsecPLCTCPDriver.WriteInt("414", 10000);
|
melsecPLCTCPDriver.WriteInt("414", 8000);
|
||||||
melsecPLCTCPDriver.WriteInt("424", 10000);
|
melsecPLCTCPDriver.WriteInt("424", 10000);
|
||||||
|
|
||||||
|
|
||||||
@ -640,7 +612,6 @@ namespace HisenceYoloDetection
|
|||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
melsecPLCTCPDriver.WriteInt("580", 0);
|
melsecPLCTCPDriver.WriteInt("580", 0);
|
||||||
Thread.Sleep(200);
|
Thread.Sleep(200);
|
||||||
melsecPLCTCPDriver.WriteInt("550", 0);
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
int IfXZeros = melsecPLCTCPDriver.ReadInt("102");
|
int IfXZeros = melsecPLCTCPDriver.ReadInt("102");
|
||||||
@ -1006,12 +977,11 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
if (iNum1 >= 2)
|
if (iNum1 >= 2)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (bBar)
|
if (bBar)
|
||||||
{
|
{
|
||||||
_runHandleBefore.WaitOne();
|
|
||||||
bBarTriger = true;//<2F>ij<DEB8><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD>ȡ<EFBFBD>ͺ<EFBFBD>
|
bBarTriger = true;//<2F>ij<DEB8><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD>ȡ<EFBFBD>ͺ<EFBFBD>
|
||||||
|
Cam2.SnapshotCount = 0;
|
||||||
|
Cam2.Snapshot();
|
||||||
|
|
||||||
xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
//xKNow = GetModeFromBar(m_sKEYENCEBar);//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
//xKNow = GetModeFromBar(m_sKEYENCEBar);//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
@ -1069,7 +1039,6 @@ namespace HisenceYoloDetection
|
|||||||
#endregion
|
#endregion
|
||||||
int YPos = 8715;
|
int YPos = 8715;
|
||||||
int ZPos = 25000;
|
int ZPos = 25000;
|
||||||
bool StopM = false;//<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>źŵ<C5BA>
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <20><><EFBFBD><EFBFBD>ϴ<EFBFBD>»<EFBFBD>544<34>Ƿ<C7B7><F1B4A5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䴫<EFBFBD><E4B4AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
/// <20><><EFBFBD><EFBFBD>ϴ<EFBFBD>»<EFBFBD>544<34>Ƿ<C7B7><F1B4A5B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䴫<EFBFBD><E4B4AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1112,21 +1081,13 @@ namespace HisenceYoloDetection
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
iNum1 = 0;
|
iNum1 = 0;
|
||||||
melsecPLCTCPDriver.WriteInt("550", 1);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
}
|
}
|
||||||
if (iNum1 >= 2)
|
if (iNum1 >= 2)
|
||||||
{
|
{
|
||||||
//if (bBarTriger)
|
//if (bBarTriger)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if false
|
#if true
|
||||||
if (!StopM)
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt("550", 1);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
StopM = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
myLog("<22><>һ<EFBFBD>βɼ<CEB2>ͼ<EFBFBD><CDBC>", DateTime.Now);
|
myLog("<22><>һ<EFBFBD>βɼ<CEB2>ͼ<EFBFBD><CDBC>", DateTime.Now);
|
||||||
//<2F>ƶ<EFBFBD>ģ<EFBFBD><C4A3> <20><><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<EFBFBD>ƶ<EFBFBD>
|
//<2F>ƶ<EFBFBD>ģ<EFBFBD><C4A3> <20><><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><CEB2><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<EFBFBD>ƶ<EFBFBD>
|
||||||
MoveToP(5815, YPos, ZPos);
|
MoveToP(5815, YPos, ZPos);
|
||||||
@ -1147,7 +1108,7 @@ namespace HisenceYoloDetection
|
|||||||
double disreal = average * (-0.54054) + 1324.3232;
|
double disreal = average * (-0.54054) + 1324.3232;
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><D7BC><EFBFBD><EFBFBD>=Ҫ<>ƶ<EFBFBD><C6B6>ľ<EFBFBD><C4BE><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><D7BC><EFBFBD><EFBFBD>=Ҫ<>ƶ<EFBFBD><C6B6>ľ<EFBFBD><C4BE><EFBFBD>
|
||||||
double dismove = disreal - 876;
|
double dismove = disreal - 876;
|
||||||
if (dismove > -4000 && dismove < 4000)
|
if (dismove > 0 && dismove < 4000)
|
||||||
{
|
{
|
||||||
MoveToP(5815, YPos, ZPos + (int)(dismove));
|
MoveToP(5815, YPos, ZPos + (int)(dismove));
|
||||||
}
|
}
|
||||||
@ -1159,18 +1120,15 @@ namespace HisenceYoloDetection
|
|||||||
Cam2.SnapshotCount = 0;
|
Cam2.SnapshotCount = 0;
|
||||||
Cam2.Snapshot();
|
Cam2.Snapshot();
|
||||||
myLog("<22>ڶ<EFBFBD><DAB6>βɼ<CEB2>ͼ<EFBFBD><CDBC>", DateTime.Now);
|
myLog("<22>ڶ<EFBFBD><DAB6>βɼ<CEB2>ͼ<EFBFBD><CDBC>", 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);
|
||||||
melsecPLCTCPDriver.WriteInt("550", 0);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
//Thread.Sleep(300);//ϴ<>»<EFBFBD><C2BB><EFBFBD><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>ȥ
|
|
||||||
|
|
||||||
//if (xKNow != null)
|
//if (xKNow != null)
|
||||||
//{
|
//{
|
||||||
// MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);
|
// MoveToP(xKNow.MoveX, xKNow.MoveY, xKNow.MoveZ);
|
||||||
@ -1301,8 +1259,8 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\<5C><><EFBFBD><EFBFBD>\\1\\001.jpg"); ;
|
//Cam1ImgOne = Cv2.ImRead("D:\\Hisence\\<5C><><EFBFBD><EFBFBD>\\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();
|
||||||
@ -1312,13 +1270,13 @@ namespace HisenceYoloDetection
|
|||||||
//<2F>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
if (SnapshotCount == 2)
|
if (SnapshotCount == 2)
|
||||||
{
|
{
|
||||||
|
// Mat mat = Cv2.ImRead("D:\\Hisence\\<5C><><EFBFBD><EFBFBD>\\1\\002.jpg");
|
||||||
Cam1ImgTwo = Cv2.ImRead("D:\\Hisence\\<5C><><EFBFBD><EFBFBD>\\1\\002.jpg");
|
// Cam1ImgTwo = mat;
|
||||||
//Cam1ImgTwo = cameraMat;
|
Cam1ImgTwo = cameraMat;
|
||||||
|
|
||||||
IfCam1TwoTriger = true;
|
IfCam1TwoTriger = true;
|
||||||
originMatShow2.Image = cameraMat.ToBitmap();
|
originMatShow2.Image = cameraMat.ToBitmap();
|
||||||
_runHandleAfter.Set();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1344,9 +1302,8 @@ namespace HisenceYoloDetection
|
|||||||
// Mat mat = Cv2.ImRead("F:\\<5C><><EFBFBD><EFBFBD>ϴ<EFBFBD>»<EFBFBD>\\cam1\\2024517161641.jpg");
|
// Mat mat = Cv2.ImRead("F:\\<5C><><EFBFBD><EFBFBD>ϴ<EFBFBD>»<EFBFBD>\\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");
|
||||||
|
|
||||||
@ -1354,7 +1311,6 @@ 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>
|
||||||
/// <20><>ʼʶ<CABC><CAB6>
|
/// <20><>ʼʶ<CABC><CAB6>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -1367,8 +1323,6 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//<2F>ź<EFBFBD><C5BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ʹ<>䲻<EFBFBD><E4B2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD>˸
|
|
||||||
_runHandleAfter.WaitOne();
|
|
||||||
//<2F><><EFBFBD><EFBFBD>2<EFBFBD><32>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>2<EFBFBD><32>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
if (IfCam2Triger)
|
if (IfCam2Triger)
|
||||||
{
|
{
|
||||||
@ -1388,7 +1342,6 @@ namespace HisenceYoloDetection
|
|||||||
sw.WriteLine(IOcrBAr + "\n");
|
sw.WriteLine(IOcrBAr + "\n");
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
}
|
}
|
||||||
// IOcrBAr = "BatchW9659ModelWNHPI74SCPSDE";
|
|
||||||
IOcrBAr = "W821PWMS27106WD2";
|
IOcrBAr = "W821PWMS27106WD2";
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>ȶ<EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>ȶ<EFBFBD>
|
||||||
xKNow = GetModeFromBar(IOcrBAr);//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
xKNow = GetModeFromBar(IOcrBAr);//<2F><><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||||
@ -1434,11 +1387,8 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
}
|
}
|
||||||
//<2F><><EFBFBD><EFBFBD>1<EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>1<EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// if (IfCam1TwoTriger && bBarTriger)
|
if (IfCam1TwoTriger && bBarTriger)
|
||||||
{
|
{
|
||||||
IfCam1TwoTriger = false;
|
|
||||||
bBarTriger = false;
|
|
||||||
_runHandleAfter.Reset();
|
|
||||||
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||||
Defet_OnDetectionDone(whiteMat, 1);
|
Defet_OnDetectionDone(whiteMat, 1);
|
||||||
Defet_OnDetectionDone(whiteMat, 2);
|
Defet_OnDetectionDone(whiteMat, 2);
|
||||||
@ -1448,6 +1398,7 @@ 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++;
|
||||||
@ -1469,14 +1420,19 @@ 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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" + 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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
MLRequest req2 = new MLRequest();
|
MLRequest req2 = new MLRequest();
|
||||||
req2.currentMat = Cam1ImgTwo;
|
req2.currentMat = Cam1ImgTwo;
|
||||||
@ -1488,18 +1444,18 @@ namespace HisenceYoloDetection
|
|||||||
req2.iouThreshold = 0.4f;//<2F><><EFBFBD><EFBFBD>IOU
|
req2.iouThreshold = 0.4f;//<2F><><EFBFBD><EFBFBD>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 <EFBFBD><EFBFBD>ִ<EFBFBD>ж<EFBFBD>λ<EFBFBD>ȶ<EFBFBD>
|
|
||||||
//ִ<>ж<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//ִ<>ж<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
string[] listLabels = xKNow.Detect.Split(",");
|
string[] listLabels = xKNow.Detect.Split(",");
|
||||||
|
|
||||||
@ -1527,25 +1483,6 @@ 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
|
|
||||||
//<2F><><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>ȶ<EFBFBD>
|
|
||||||
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("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>" + sw.ElapsedMilliseconds, DateTime.Now);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (MatchStr)
|
if (MatchStr)
|
||||||
{
|
{
|
||||||
@ -1562,9 +1499,11 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
|
|
||||||
// int sqlblocksum=
|
// int sqlblocksum=
|
||||||
|
IfCam1TwoTriger = false;
|
||||||
|
bBarTriger = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
melsecPLCTCPDriver.WriteInt("550", 0);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
if (MatchStr)
|
if (MatchStr)
|
||||||
{
|
{
|
||||||
OKDsums++;
|
OKDsums++;
|
||||||
@ -1577,42 +1516,17 @@ namespace HisenceYoloDetection
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 1);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
melsecPLCTCPDriver.WriteInt(WaringAdress, 1);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
myLog("ƥ<><C6A5>ʧ<EFBFBD><CAA7>", DateTime.Now);
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>NGϴ<47>»<EFBFBD>
|
|
||||||
DialogResult dr = MessageBox.Show("<22>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>죿", "<22>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
||||||
if (dr == DialogResult.OK)
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//<2F><><EFBFBD><EFBFBD>
|
|
||||||
OKDsums++;
|
|
||||||
WUsums++;
|
|
||||||
this.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
double percent = (double)WUsums/ AllDsums;
|
|
||||||
string percentText = percent.ToString("0.0%");//<2F><><EFBFBD><EFBFBD>percentText<78><74>ֵΪ10.0%
|
|
||||||
textBox1.Text = percentText;
|
|
||||||
OKOrNGShow.Image = OKbitmap;
|
|
||||||
}));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NGDsums++;
|
NGDsums++;
|
||||||
melsecPLCTCPDriver.WriteInt(WaringAdress, 0);//<2F><><EFBFBD><EFBFBD>
|
myLog("ƥ<><C6A5>ʧ<EFBFBD><CAA7>", DateTime.Now);
|
||||||
melsecPLCTCPDriver.WriteInt(RedLightingAdress, 0);//<2F><><EFBFBD><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||||
|
// InsertXK_HisenceWordMatchData(xK_MatchDet, false);
|
||||||
this.Invoke(new Action(() =>
|
this.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
OKOrNGShow.Image = NGbitmap;
|
OKOrNGShow.Image = NGbitmap;
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1621,7 +1535,7 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw e;
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -1701,7 +1615,7 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data);
|
m_sKEYENCEBar = System.Text.Encoding.UTF8.GetString(data);
|
||||||
// myLog("<22>ͺ<EFBFBD>Ocr" + m_sKEYENCEBar, DateTime.Now);
|
// myLog("<22>ͺ<EFBFBD>Ocr" + m_sKEYENCEBar, DateTime.Now);
|
||||||
_runHandleBefore.Set();
|
|
||||||
bBar = true;
|
bBar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1881,26 +1795,7 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
private void StartDecBtn_Click(object sender, EventArgs e)
|
private void StartDecBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
string path22 = "D:\\Hisence\\Test2\\BatchW96c0ModelWNHB6X2SDSPresult2024628924614_Rect.png";
|
|
||||||
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();
|
//OnGetBar();
|
||||||
melsecPLCTCPDriver.WriteInt(GreenLightingAdress, 1);//<2F>Ƶ<EFBFBD>
|
|
||||||
TriggerCameral2();
|
TriggerCameral2();
|
||||||
ReadyDetect();
|
ReadyDetect();
|
||||||
myLog("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳ɹ<CCB3>", DateTime.Now);
|
myLog("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳ɹ<CCB3>", DateTime.Now);
|
||||||
@ -2298,9 +2193,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 mResultCut, mL3, mLButton, ref xK_HisenceSQLWord, ref xkWord, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
|
InsertSqlRunDataButton(ref keyValueResult, true, ref mCut, ref mResultCut, mL3, mLButton, ref xK_HisenceSQLWord, ref xkWord, ref strMatListOne, ref strMatFuzzyListOne, ref paddleOcrModel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2704,37 +2599,37 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
canvas1.ImaMAt = detectionImage;
|
DefetShow1.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
canvas2.ImaMAt = detectionImage;
|
DefetShow2.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
canvas3.ImaMAt = detectionImage;
|
DefetShow3.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
canvas4.ImaMAt = detectionImage;
|
DefetShow4.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
canvas5.ImaMAt = detectionImage;
|
DefetShow5.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
{
|
{
|
||||||
canvas6.ImaMAt = detectionImage;
|
DefetShow6.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
{
|
{
|
||||||
// canvas7.ImaMAt = detectionImage;
|
DefetShow7.ImaMAt = detectionImage;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
@ -2764,7 +2659,7 @@ namespace HisenceYoloDetection
|
|||||||
/// <param name="strMatList"><3E><><EFBFBD>صĶ<D8B5>λ<EFBFBD><CEBB><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD></param>
|
/// <param name="strMatList"><3E><><EFBFBD>صĶ<D8B5>λ<EFBFBD><CEBB><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD></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 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 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)
|
||||||
{
|
{
|
||||||
#if true
|
#if true
|
||||||
//try
|
//try
|
||||||
@ -2882,7 +2777,6 @@ namespace HisenceYoloDetection
|
|||||||
string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay;
|
string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay;
|
||||||
Rect area = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
Rect area = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
||||||
Mat matCut = new Mat(mResultCuti, area);
|
Mat matCut = new Mat(mResultCuti, area);
|
||||||
|
|
||||||
Stopwatch sw = new Stopwatch();
|
Stopwatch sw = new Stopwatch();
|
||||||
sw.Start();
|
sw.Start();
|
||||||
//OCRʶ<52><CAB6><EFBFBD>ü<EFBFBD>ͼƬ
|
//OCRʶ<52><CAB6><EFBFBD>ü<EFBFBD>ͼƬ
|
||||||
@ -2964,7 +2858,6 @@ namespace HisenceYoloDetection
|
|||||||
string TextWoidStr = OcrFuzzyTextInsert.Join("##"); //ʵ<>ʵļ<CAB5><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
string TextWoidStr = OcrFuzzyTextInsert.Join("##"); //ʵ<>ʵļ<CAB5><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||||
string SQLStr = "";//<2F><>־<EFBFBD><D6BE>ʾ<EFBFBD><CABE><EFBFBD>ݿ<EFBFBD><DDBF>Ĺؼ<C4B9><D8BC><EFBFBD>
|
string SQLStr = "";//<2F><>־<EFBFBD><D6BE>ʾ<EFBFBD><CABE><EFBFBD>ݿ<EFBFBD><DDBF>Ĺؼ<C4B9><D8BC><EFBFBD>
|
||||||
bool juanjiMatch = false;
|
bool juanjiMatch = false;
|
||||||
string filenameone = dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString();
|
|
||||||
switch (blockIndex)
|
switch (blockIndex)
|
||||||
{
|
{
|
||||||
case "1"://<2F><>ȫƥ<C8AB><C6A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
case "1"://<2F><>ȫƥ<C8AB><C6A5> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||||
@ -2972,31 +2865,19 @@ namespace HisenceYoloDetection
|
|||||||
xK_HisenceWord.OneblockPath = CutSavePath;
|
xK_HisenceWord.OneblockPath = CutSavePath;
|
||||||
xK_HisenceWord.OneblockMainWord = MainWoidStr;
|
xK_HisenceWord.OneblockMainWord = MainWoidStr;
|
||||||
xK_HisenceWord.OneblockText = TextWoidStr;
|
xK_HisenceWord.OneblockText = TextWoidStr;
|
||||||
SQLStr = SQlxK_HisenceWord.OneblockText;
|
SQLStr = SQlxK_HisenceWord.OneblockMainWord;
|
||||||
string SQLStr2 = SQlxK_HisenceWord.OneblockMainWord;
|
|
||||||
|
|
||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
bool ssD = ManagerModelHelper.StrMatch(SQLStr, xK_HisenceWord.OneblockText);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.OneblockMainWord, SQLStr);
|
||||||
Console.Write(SQLStr);
|
if (!OneIF)
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.OneblockMainWord, SQLStr2);
|
|
||||||
if (!OneIF1 || !ssD)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
DisplayResult(mLcut);
|
DisplayResult(mLcut);
|
||||||
Defet_OnDetectionDone(mLcut.ResultMap.ToMat(), 1);
|
Defet_OnDetectionDone(mLcut.ResultMap.ToMat(), 1);
|
||||||
|
|
||||||
string Path_1 = Path.Combine("D:\\Hisence\\Test\\1\\ng", filenameone + "_res.png");
|
|
||||||
Cv2.ImWrite(Path_1, mLcut.ResultMap.ToMat());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 1);
|
Defet_OnDetectionDone(OKMat, 1);
|
||||||
string Path_2 = Path.Combine("D:\\Hisence\\Test\\1\\ok", filenameone + "_res.png");
|
|
||||||
Cv2.ImWrite(Path_2, OKMat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3046,26 +2927,16 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.ThreeblockMainWord;
|
SQLStr = SQlxK_HisenceWord.ThreeblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.ThreeblockMainWord, SQlxK_HisenceWord.ThreeblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.ThreeblockMainWord, SQlxK_HisenceWord.ThreeblockMainWord);
|
||||||
|
if (!OneIF)
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
|
||||||
string PathSql = SQlxK_HisenceWord.ThreeblockPath;
|
|
||||||
|
|
||||||
juanjiMatch = CheckDiffSciHelper1.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test1");
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = true;//<2F><><EFBFBD><EFBFBD>6.28
|
|
||||||
/*
|
|
||||||
DisplayResult(mLcut);
|
DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
Defet_OnDetectionDone(mLcut.ResultMap.ToMat(), 3);
|
Defet_OnDetectionDone(mLcut.ResultMap.ToMat(), 3);
|
||||||
*/
|
|
||||||
Defet_OnDetectionDone(OKMat, 3);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 3);
|
Defet_OnDetectionDone(OKMat, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3080,15 +2951,9 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.FourblockMainWord;
|
SQLStr = SQlxK_HisenceWord.FourblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.FourblockMainWord, SQlxK_HisenceWord.FourblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.FourblockMainWord, SQlxK_HisenceWord.FourblockMainWord);
|
||||||
|
if (!OneIF)
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
|
||||||
string PathSql = SQlxK_HisenceWord.FourblockPath;
|
|
||||||
|
|
||||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
DisplayResult(mLcut);
|
DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
@ -3096,7 +2961,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 4);
|
Defet_OnDetectionDone(OKMat, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3111,14 +2975,9 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.FiveblockMainWord;
|
SQLStr = SQlxK_HisenceWord.FiveblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.FiveblockMainWord, SQlxK_HisenceWord.FiveblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.FiveblockMainWord, SQlxK_HisenceWord.FiveblockMainWord);
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
if (!OneIF)
|
||||||
string PathSql = SQlxK_HisenceWord.FiveblockMainWord;
|
|
||||||
|
|
||||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
DisplayResult(mLcut);
|
DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
@ -3126,7 +2985,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 5);
|
Defet_OnDetectionDone(OKMat, 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3140,16 +2998,9 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.SixblockMainWord;
|
SQLStr = SQlxK_HisenceWord.SixblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SixblockMainWord, SQlxK_HisenceWord.SixblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.SixblockMainWord, SQlxK_HisenceWord.SixblockMainWord);
|
||||||
|
if (!OneIF)
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
|
||||||
string PathSql = SQlxK_HisenceWord.SixblockPath;
|
|
||||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һֱΪtrue
|
|
||||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
|
||||||
juanjiMatch = true;
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
// DisplayResult(mLcut);
|
// DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
@ -3157,7 +3008,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 6);
|
Defet_OnDetectionDone(OKMat, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3172,14 +3022,9 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.SevenblockMainWord;
|
SQLStr = SQlxK_HisenceWord.SevenblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.SevenblockMainWord, SQlxK_HisenceWord.SevenblockMainWord);
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
if (!OneIF)
|
||||||
string PathSql = SQlxK_HisenceWord.SevenblockPath;
|
|
||||||
|
|
||||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
//DisplayResult(mLcut);
|
//DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
@ -3187,7 +3032,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 7);
|
Defet_OnDetectionDone(OKMat, 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3201,14 +3045,9 @@ namespace HisenceYoloDetection
|
|||||||
if (!saveimage)
|
if (!saveimage)
|
||||||
{
|
{
|
||||||
SQLStr = SQlxK_HisenceWord.EightblockMainWord;
|
SQLStr = SQlxK_HisenceWord.EightblockMainWord;
|
||||||
bool OneIF1 = ManagerModelHelper.StrMatch2(xK_HisenceWord.EightblockMainWord, SQlxK_HisenceWord.EightblockMainWord);
|
OneIF = ManagerModelHelper.StrMatch2(xK_HisenceWord.EightblockMainWord, SQlxK_HisenceWord.EightblockMainWord);
|
||||||
Rect rect = new Rect(0, 0, 0, 0);
|
if (!OneIF)
|
||||||
string PathSql = SQlxK_HisenceWord.EightblockPath;
|
|
||||||
|
|
||||||
juanjiMatch = CheckDiffSciHelper.CheckDiffSci(PathSql, CutBlockMat, rect, rect, false, "D://Hisence//Test");
|
|
||||||
if (!OneIF1 || !juanjiMatch)
|
|
||||||
{
|
{
|
||||||
OneIF = false;
|
|
||||||
// DisplayResult(mLcut);
|
// DisplayResult(mLcut);
|
||||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>
|
||||||
// mLcut.ResultMap;
|
// mLcut.ResultMap;
|
||||||
@ -3216,7 +3055,6 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OneIF = true;
|
|
||||||
Defet_OnDetectionDone(OKMat, 8);
|
Defet_OnDetectionDone(OKMat, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3229,7 +3067,10 @@ namespace HisenceYoloDetection
|
|||||||
using (StreamWriter sw = new StreamWriter(txtLog, true))
|
using (StreamWriter sw = new StreamWriter(txtLog, true))
|
||||||
{
|
{
|
||||||
|
|
||||||
sw.WriteLine("<22><>" + blockIndex + "<22><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>" + juanjiMatch);
|
if (blockIndex == "2")
|
||||||
|
{
|
||||||
|
sw.WriteLine("<22><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>" + juanjiMatch);
|
||||||
|
}
|
||||||
sw.WriteLine("<22><>" + blockIndex + "<22><><EFBFBD>ݿ<EFBFBD>" + SQLStr + "<22>ؼ<EFBFBD><D8BC><EFBFBD>" + MainWoidStr + "<22><><EFBFBD><EFBFBD>" + OneIF + "\n");
|
sw.WriteLine("<22><>" + blockIndex + "<22><><EFBFBD>ݿ<EFBFBD>" + SQLStr + "<22>ؼ<EFBFBD><D8BC><EFBFBD>" + MainWoidStr + "<22><><EFBFBD><EFBFBD>" + OneIF + "\n");
|
||||||
sw.WriteLine("<22><>" + blockIndex + " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + TextWoidStr + "\n");
|
sw.WriteLine("<22><>" + blockIndex + " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + TextWoidStr + "\n");
|
||||||
|
|
||||||
@ -3281,20 +3122,5 @@ namespace HisenceYoloDetection
|
|||||||
myLog("X<><58>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>", DateTime.Now);
|
myLog("X<><58>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>", DateTime.Now);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handStopBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt("550", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void HandRuningBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt("550", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
||||||
{
|
|
||||||
melsecPLCTCPDriver.WriteInt("550", 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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>25</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">
|
||||||
|
@ -189,7 +189,7 @@ namespace HisenceYoloDetection
|
|||||||
// 计算相似度(相似度等于1减去标准化的Levenshtein距离)
|
// 计算相似度(相似度等于1减去标准化的Levenshtein距离)
|
||||||
double similarity = 1 - ((double)distance / Math.Max(SqlText.Length, DetText.Length));
|
double similarity = 1 - ((double)distance / Math.Max(SqlText.Length, DetText.Length));
|
||||||
bool areEqual = false;
|
bool areEqual = false;
|
||||||
if (similarity < 0.9)
|
if (similarity < 0.5)
|
||||||
{
|
{
|
||||||
areEqual = false;
|
areEqual = false;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,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();
|
||||||
|
@ -12,7 +12,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();
|
||||||
|
@ -399,7 +399,6 @@ namespace XKRS.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 画矩形
|
#region 画矩形
|
||||||
GPathList.ForEach(path =>
|
GPathList.ForEach(path =>
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user