修改卷积
This commit is contained in:
parent
85ba963a93
commit
c1c0e0697c
331
HisenceYoloDetection/CheckDiffSciHelper.cs
Normal file
331
HisenceYoloDetection/CheckDiffSciHelper.cs
Normal file
@ -0,0 +1,331 @@
|
|||||||
|
using OpenCvSharp;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Point = OpenCvSharp.Point;
|
||||||
|
using Size = OpenCvSharp.Size;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
namespace HisenceYoloDetection
|
||||||
|
{
|
||||||
|
public static class CheckDiffSciHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <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, 0, 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, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
}
|
||||||
|
// Cv2.Threshold(gimg2, thr2, 0, 255, ThresholdTypes.Binary | ThresholdTypes.Otsu);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Rect area2 = new Rect(148,30,229,222);
|
||||||
|
sqlrect.Width += 20;
|
||||||
|
detrect.Width += 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
string savePath4 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_thr1.png");
|
||||||
|
// 保存结果
|
||||||
|
|
||||||
|
Cv2.ImWrite(savePath4, thr1);
|
||||||
|
string savePath3 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_thr2.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);
|
||||||
|
//裁剪才行
|
||||||
|
|
||||||
|
|
||||||
|
//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_);
|
||||||
|
|
||||||
|
// 对差异图像应用阈值
|
||||||
|
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);
|
||||||
|
bool isMatch = true;
|
||||||
|
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);
|
||||||
|
isMatch= false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string savePath2 = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_Rect.png");
|
||||||
|
// 保存结果
|
||||||
|
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
Cv2.ImWrite(savePath2, img2);
|
||||||
|
string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path1) + "_diff.png");
|
||||||
|
// 保存结果
|
||||||
|
//string savePath = Path.Combine(saveDir, Path.GetFileNameWithoutExtension(path2) + "_diff.png");
|
||||||
|
Cv2.ImWrite(savePath, blackhatImg);
|
||||||
|
return isMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Rect strChangeRect(string 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
763
HisenceYoloDetection/Form1.Designer.cs
generated
Normal file
763
HisenceYoloDetection/Form1.Designer.cs
generated
Normal file
@ -0,0 +1,763 @@
|
|||||||
|
namespace HisenceYoloDetection
|
||||||
|
{
|
||||||
|
partial class Form1
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
tableLayoutPanel1 = new TableLayoutPanel();
|
||||||
|
panel1 = new Panel();
|
||||||
|
groupBox5 = new GroupBox();
|
||||||
|
DistanceShow = new TextBox();
|
||||||
|
label21 = new Label();
|
||||||
|
txtSetValue = new TextBox();
|
||||||
|
groupBox4 = new GroupBox();
|
||||||
|
SetAutoSpeed = new Button();
|
||||||
|
SetHandleSpeed = new Button();
|
||||||
|
SetlnEditmiZOP = new TextBox();
|
||||||
|
SetlnEditmiYOP = new TextBox();
|
||||||
|
SetlnEditmiXOP = new TextBox();
|
||||||
|
SetlnEditmiZH = new TextBox();
|
||||||
|
SetlnEditmiYH = new TextBox();
|
||||||
|
SetlnEditmiXH = new TextBox();
|
||||||
|
lnEditmiZOP = new TextBox();
|
||||||
|
lnEditmiYOP = new TextBox();
|
||||||
|
lnEditmiXOP = new TextBox();
|
||||||
|
label17 = new Label();
|
||||||
|
lnEditmiZS = new TextBox();
|
||||||
|
lnEditmiYS = new TextBox();
|
||||||
|
lnEditmiXS = new TextBox();
|
||||||
|
label16 = new Label();
|
||||||
|
lnEditmiZHS = new TextBox();
|
||||||
|
lnEditmiYHS = new TextBox();
|
||||||
|
lnEditmiXHS = new TextBox();
|
||||||
|
label15 = new Label();
|
||||||
|
ZPostion = new Label();
|
||||||
|
YPostion = new Label();
|
||||||
|
XPostion = new Label();
|
||||||
|
XCurrentPostion = new Label();
|
||||||
|
label14 = new Label();
|
||||||
|
label13 = new Label();
|
||||||
|
label12 = new Label();
|
||||||
|
label11 = new Label();
|
||||||
|
ModeleShow = new GroupBox();
|
||||||
|
ZBackwardrbx = new RadioButton();
|
||||||
|
YBackwardrbx = new RadioButton();
|
||||||
|
XBackwardrbx = new RadioButton();
|
||||||
|
ZForwardrbx = new RadioButton();
|
||||||
|
YForwardrbx = new RadioButton();
|
||||||
|
XForwardrbx = new RadioButton();
|
||||||
|
ZZerorbx = new RadioButton();
|
||||||
|
YZerorbx = new RadioButton();
|
||||||
|
XZerorbx = new RadioButton();
|
||||||
|
PLCPostion = new Button();
|
||||||
|
PLCDiskZero = new Button();
|
||||||
|
PLCPowerON = new Button();
|
||||||
|
writePLCValue = new TextBox();
|
||||||
|
label9 = new Label();
|
||||||
|
label10 = new Label();
|
||||||
|
wirteAdressBtn = new Button();
|
||||||
|
PLCValue = new TextBox();
|
||||||
|
WriteAdress = new TextBox();
|
||||||
|
label6 = new Label();
|
||||||
|
label3 = new Label();
|
||||||
|
ConnectPLC = new Button();
|
||||||
|
readAdress = new Button();
|
||||||
|
showPLC = new TextBox();
|
||||||
|
readPLc = new TextBox();
|
||||||
|
tableLayoutPanel1.SuspendLayout();
|
||||||
|
panel1.SuspendLayout();
|
||||||
|
groupBox5.SuspendLayout();
|
||||||
|
groupBox4.SuspendLayout();
|
||||||
|
ModeleShow.SuspendLayout();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// tableLayoutPanel1
|
||||||
|
//
|
||||||
|
tableLayoutPanel1.ColumnCount = 1;
|
||||||
|
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.Controls.Add(panel1, 0, 0);
|
||||||
|
tableLayoutPanel1.Dock = DockStyle.Fill;
|
||||||
|
tableLayoutPanel1.Location = new Point(0, 0);
|
||||||
|
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||||
|
tableLayoutPanel1.RowCount = 1;
|
||||||
|
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
|
||||||
|
tableLayoutPanel1.Size = new Size(1057, 450);
|
||||||
|
tableLayoutPanel1.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// panel1
|
||||||
|
//
|
||||||
|
panel1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
|
panel1.AutoSize = true;
|
||||||
|
panel1.Controls.Add(groupBox5);
|
||||||
|
panel1.Controls.Add(txtSetValue);
|
||||||
|
panel1.Controls.Add(groupBox4);
|
||||||
|
panel1.Controls.Add(ModeleShow);
|
||||||
|
panel1.Controls.Add(writePLCValue);
|
||||||
|
panel1.Controls.Add(label9);
|
||||||
|
panel1.Controls.Add(label10);
|
||||||
|
panel1.Controls.Add(wirteAdressBtn);
|
||||||
|
panel1.Controls.Add(PLCValue);
|
||||||
|
panel1.Controls.Add(WriteAdress);
|
||||||
|
panel1.Controls.Add(label6);
|
||||||
|
panel1.Controls.Add(label3);
|
||||||
|
panel1.Controls.Add(ConnectPLC);
|
||||||
|
panel1.Controls.Add(readAdress);
|
||||||
|
panel1.Controls.Add(showPLC);
|
||||||
|
panel1.Controls.Add(readPLc);
|
||||||
|
panel1.Location = new Point(3, 3);
|
||||||
|
panel1.Name = "panel1";
|
||||||
|
panel1.Size = new Size(1051, 444);
|
||||||
|
panel1.TabIndex = 5;
|
||||||
|
//
|
||||||
|
// groupBox5
|
||||||
|
//
|
||||||
|
groupBox5.Controls.Add(DistanceShow);
|
||||||
|
groupBox5.Controls.Add(label21);
|
||||||
|
groupBox5.Location = new Point(806, 10);
|
||||||
|
groupBox5.Name = "groupBox5";
|
||||||
|
groupBox5.Size = new Size(356, 100);
|
||||||
|
groupBox5.TabIndex = 15;
|
||||||
|
groupBox5.TabStop = false;
|
||||||
|
groupBox5.Text = "实时显示";
|
||||||
|
//
|
||||||
|
// DistanceShow
|
||||||
|
//
|
||||||
|
DistanceShow.Location = new Point(86, 30);
|
||||||
|
DistanceShow.Name = "DistanceShow";
|
||||||
|
DistanceShow.ReadOnly = true;
|
||||||
|
DistanceShow.Size = new Size(100, 23);
|
||||||
|
DistanceShow.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// label21
|
||||||
|
//
|
||||||
|
label21.AutoSize = true;
|
||||||
|
label21.Location = new Point(28, 33);
|
||||||
|
label21.Name = "label21";
|
||||||
|
label21.Size = new Size(32, 17);
|
||||||
|
label21.TabIndex = 0;
|
||||||
|
label21.Text = "测距";
|
||||||
|
//
|
||||||
|
// txtSetValue
|
||||||
|
//
|
||||||
|
txtSetValue.Location = new Point(670, 78);
|
||||||
|
txtSetValue.Name = "txtSetValue";
|
||||||
|
txtSetValue.Size = new Size(100, 23);
|
||||||
|
txtSetValue.TabIndex = 14;
|
||||||
|
//
|
||||||
|
// groupBox4
|
||||||
|
//
|
||||||
|
groupBox4.Controls.Add(SetAutoSpeed);
|
||||||
|
groupBox4.Controls.Add(SetHandleSpeed);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiZOP);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiYOP);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiXOP);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiZH);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiYH);
|
||||||
|
groupBox4.Controls.Add(SetlnEditmiXH);
|
||||||
|
groupBox4.Controls.Add(lnEditmiZOP);
|
||||||
|
groupBox4.Controls.Add(lnEditmiYOP);
|
||||||
|
groupBox4.Controls.Add(lnEditmiXOP);
|
||||||
|
groupBox4.Controls.Add(label17);
|
||||||
|
groupBox4.Controls.Add(lnEditmiZS);
|
||||||
|
groupBox4.Controls.Add(lnEditmiYS);
|
||||||
|
groupBox4.Controls.Add(lnEditmiXS);
|
||||||
|
groupBox4.Controls.Add(label16);
|
||||||
|
groupBox4.Controls.Add(lnEditmiZHS);
|
||||||
|
groupBox4.Controls.Add(lnEditmiYHS);
|
||||||
|
groupBox4.Controls.Add(lnEditmiXHS);
|
||||||
|
groupBox4.Controls.Add(label15);
|
||||||
|
groupBox4.Controls.Add(ZPostion);
|
||||||
|
groupBox4.Controls.Add(YPostion);
|
||||||
|
groupBox4.Controls.Add(XPostion);
|
||||||
|
groupBox4.Controls.Add(XCurrentPostion);
|
||||||
|
groupBox4.Controls.Add(label14);
|
||||||
|
groupBox4.Controls.Add(label13);
|
||||||
|
groupBox4.Controls.Add(label12);
|
||||||
|
groupBox4.Controls.Add(label11);
|
||||||
|
groupBox4.Location = new Point(611, 107);
|
||||||
|
groupBox4.Name = "groupBox4";
|
||||||
|
groupBox4.Size = new Size(557, 373);
|
||||||
|
groupBox4.TabIndex = 13;
|
||||||
|
groupBox4.TabStop = false;
|
||||||
|
groupBox4.Text = "位置显示";
|
||||||
|
//
|
||||||
|
// SetAutoSpeed
|
||||||
|
//
|
||||||
|
SetAutoSpeed.Location = new Point(8, 315);
|
||||||
|
SetAutoSpeed.Name = "SetAutoSpeed";
|
||||||
|
SetAutoSpeed.Size = new Size(88, 23);
|
||||||
|
SetAutoSpeed.TabIndex = 29;
|
||||||
|
SetAutoSpeed.Text = "设置自动速度";
|
||||||
|
SetAutoSpeed.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// SetHandleSpeed
|
||||||
|
//
|
||||||
|
SetHandleSpeed.Location = new Point(8, 258);
|
||||||
|
SetHandleSpeed.Name = "SetHandleSpeed";
|
||||||
|
SetHandleSpeed.Size = new Size(88, 23);
|
||||||
|
SetHandleSpeed.TabIndex = 28;
|
||||||
|
SetHandleSpeed.Text = "设置手动速度";
|
||||||
|
SetHandleSpeed.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// SetlnEditmiZOP
|
||||||
|
//
|
||||||
|
SetlnEditmiZOP.Location = new Point(409, 315);
|
||||||
|
SetlnEditmiZOP.Name = "SetlnEditmiZOP";
|
||||||
|
SetlnEditmiZOP.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiZOP.TabIndex = 27;
|
||||||
|
//
|
||||||
|
// SetlnEditmiYOP
|
||||||
|
//
|
||||||
|
SetlnEditmiYOP.Location = new Point(256, 315);
|
||||||
|
SetlnEditmiYOP.Name = "SetlnEditmiYOP";
|
||||||
|
SetlnEditmiYOP.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiYOP.TabIndex = 26;
|
||||||
|
//
|
||||||
|
// SetlnEditmiXOP
|
||||||
|
//
|
||||||
|
SetlnEditmiXOP.Location = new Point(107, 315);
|
||||||
|
SetlnEditmiXOP.Name = "SetlnEditmiXOP";
|
||||||
|
SetlnEditmiXOP.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiXOP.TabIndex = 25;
|
||||||
|
//
|
||||||
|
// SetlnEditmiZH
|
||||||
|
//
|
||||||
|
SetlnEditmiZH.Location = new Point(409, 258);
|
||||||
|
SetlnEditmiZH.Name = "SetlnEditmiZH";
|
||||||
|
SetlnEditmiZH.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiZH.TabIndex = 23;
|
||||||
|
//
|
||||||
|
// SetlnEditmiYH
|
||||||
|
//
|
||||||
|
SetlnEditmiYH.Location = new Point(256, 258);
|
||||||
|
SetlnEditmiYH.Name = "SetlnEditmiYH";
|
||||||
|
SetlnEditmiYH.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiYH.TabIndex = 22;
|
||||||
|
//
|
||||||
|
// SetlnEditmiXH
|
||||||
|
//
|
||||||
|
SetlnEditmiXH.Location = new Point(107, 258);
|
||||||
|
SetlnEditmiXH.Name = "SetlnEditmiXH";
|
||||||
|
SetlnEditmiXH.Size = new Size(100, 23);
|
||||||
|
SetlnEditmiXH.TabIndex = 21;
|
||||||
|
//
|
||||||
|
// lnEditmiZOP
|
||||||
|
//
|
||||||
|
lnEditmiZOP.Location = new Point(409, 200);
|
||||||
|
lnEditmiZOP.Name = "lnEditmiZOP";
|
||||||
|
lnEditmiZOP.Size = new Size(100, 23);
|
||||||
|
lnEditmiZOP.TabIndex = 19;
|
||||||
|
//
|
||||||
|
// lnEditmiYOP
|
||||||
|
//
|
||||||
|
lnEditmiYOP.Location = new Point(256, 200);
|
||||||
|
lnEditmiYOP.Name = "lnEditmiYOP";
|
||||||
|
lnEditmiYOP.Size = new Size(100, 23);
|
||||||
|
lnEditmiYOP.TabIndex = 18;
|
||||||
|
//
|
||||||
|
// lnEditmiXOP
|
||||||
|
//
|
||||||
|
lnEditmiXOP.Location = new Point(107, 200);
|
||||||
|
lnEditmiXOP.Name = "lnEditmiXOP";
|
||||||
|
lnEditmiXOP.Size = new Size(100, 23);
|
||||||
|
lnEditmiXOP.TabIndex = 17;
|
||||||
|
//
|
||||||
|
// label17
|
||||||
|
//
|
||||||
|
label17.AutoSize = true;
|
||||||
|
label17.Location = new Point(32, 203);
|
||||||
|
label17.Name = "label17";
|
||||||
|
label17.Size = new Size(56, 17);
|
||||||
|
label17.TabIndex = 16;
|
||||||
|
label17.Text = "定位位置";
|
||||||
|
//
|
||||||
|
// lnEditmiZS
|
||||||
|
//
|
||||||
|
lnEditmiZS.Location = new Point(409, 144);
|
||||||
|
lnEditmiZS.Name = "lnEditmiZS";
|
||||||
|
lnEditmiZS.ReadOnly = true;
|
||||||
|
lnEditmiZS.Size = new Size(100, 23);
|
||||||
|
lnEditmiZS.TabIndex = 15;
|
||||||
|
//
|
||||||
|
// lnEditmiYS
|
||||||
|
//
|
||||||
|
lnEditmiYS.Location = new Point(256, 144);
|
||||||
|
lnEditmiYS.Name = "lnEditmiYS";
|
||||||
|
lnEditmiYS.ReadOnly = true;
|
||||||
|
lnEditmiYS.Size = new Size(100, 23);
|
||||||
|
lnEditmiYS.TabIndex = 14;
|
||||||
|
//
|
||||||
|
// lnEditmiXS
|
||||||
|
//
|
||||||
|
lnEditmiXS.Location = new Point(107, 144);
|
||||||
|
lnEditmiXS.Name = "lnEditmiXS";
|
||||||
|
lnEditmiXS.ReadOnly = true;
|
||||||
|
lnEditmiXS.Size = new Size(100, 23);
|
||||||
|
lnEditmiXS.TabIndex = 13;
|
||||||
|
//
|
||||||
|
// label16
|
||||||
|
//
|
||||||
|
label16.AutoSize = true;
|
||||||
|
label16.Location = new Point(8, 147);
|
||||||
|
label16.Name = "label16";
|
||||||
|
label16.Size = new Size(80, 17);
|
||||||
|
label16.TabIndex = 12;
|
||||||
|
label16.Text = "当前定位速度";
|
||||||
|
//
|
||||||
|
// lnEditmiZHS
|
||||||
|
//
|
||||||
|
lnEditmiZHS.Location = new Point(409, 87);
|
||||||
|
lnEditmiZHS.Name = "lnEditmiZHS";
|
||||||
|
lnEditmiZHS.ReadOnly = true;
|
||||||
|
lnEditmiZHS.Size = new Size(100, 23);
|
||||||
|
lnEditmiZHS.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// lnEditmiYHS
|
||||||
|
//
|
||||||
|
lnEditmiYHS.Location = new Point(256, 87);
|
||||||
|
lnEditmiYHS.Name = "lnEditmiYHS";
|
||||||
|
lnEditmiYHS.ReadOnly = true;
|
||||||
|
lnEditmiYHS.Size = new Size(100, 23);
|
||||||
|
lnEditmiYHS.TabIndex = 10;
|
||||||
|
//
|
||||||
|
// lnEditmiXHS
|
||||||
|
//
|
||||||
|
lnEditmiXHS.Location = new Point(107, 87);
|
||||||
|
lnEditmiXHS.Name = "lnEditmiXHS";
|
||||||
|
lnEditmiXHS.ReadOnly = true;
|
||||||
|
lnEditmiXHS.Size = new Size(100, 23);
|
||||||
|
lnEditmiXHS.TabIndex = 9;
|
||||||
|
//
|
||||||
|
// label15
|
||||||
|
//
|
||||||
|
label15.AutoSize = true;
|
||||||
|
label15.Location = new Point(8, 90);
|
||||||
|
label15.Name = "label15";
|
||||||
|
label15.Size = new Size(80, 17);
|
||||||
|
label15.TabIndex = 8;
|
||||||
|
label15.Text = "当前手动速度";
|
||||||
|
//
|
||||||
|
// ZPostion
|
||||||
|
//
|
||||||
|
ZPostion.AutoSize = true;
|
||||||
|
ZPostion.Location = new Point(451, 45);
|
||||||
|
ZPostion.Name = "ZPostion";
|
||||||
|
ZPostion.Size = new Size(15, 17);
|
||||||
|
ZPostion.TabIndex = 7;
|
||||||
|
ZPostion.Text = "0";
|
||||||
|
//
|
||||||
|
// YPostion
|
||||||
|
//
|
||||||
|
YPostion.AutoSize = true;
|
||||||
|
YPostion.Location = new Point(300, 45);
|
||||||
|
YPostion.Name = "YPostion";
|
||||||
|
YPostion.Size = new Size(15, 17);
|
||||||
|
YPostion.TabIndex = 6;
|
||||||
|
YPostion.Text = "0";
|
||||||
|
//
|
||||||
|
// XPostion
|
||||||
|
//
|
||||||
|
XPostion.AutoSize = true;
|
||||||
|
XPostion.Location = new Point(144, 45);
|
||||||
|
XPostion.Name = "XPostion";
|
||||||
|
XPostion.Size = new Size(15, 17);
|
||||||
|
XPostion.TabIndex = 5;
|
||||||
|
XPostion.Text = "0";
|
||||||
|
//
|
||||||
|
// XCurrentPostion
|
||||||
|
//
|
||||||
|
XCurrentPostion.AutoSize = true;
|
||||||
|
XCurrentPostion.Location = new Point(132, 45);
|
||||||
|
XCurrentPostion.Name = "XCurrentPostion";
|
||||||
|
XCurrentPostion.Size = new Size(0, 17);
|
||||||
|
XCurrentPostion.TabIndex = 4;
|
||||||
|
//
|
||||||
|
// label14
|
||||||
|
//
|
||||||
|
label14.AutoSize = true;
|
||||||
|
label14.Location = new Point(451, 22);
|
||||||
|
label14.Name = "label14";
|
||||||
|
label14.Size = new Size(15, 17);
|
||||||
|
label14.TabIndex = 3;
|
||||||
|
label14.Text = "Z";
|
||||||
|
//
|
||||||
|
// label13
|
||||||
|
//
|
||||||
|
label13.AutoSize = true;
|
||||||
|
label13.Location = new Point(300, 19);
|
||||||
|
label13.Name = "label13";
|
||||||
|
label13.Size = new Size(15, 17);
|
||||||
|
label13.TabIndex = 2;
|
||||||
|
label13.Text = "Y";
|
||||||
|
//
|
||||||
|
// label12
|
||||||
|
//
|
||||||
|
label12.AutoSize = true;
|
||||||
|
label12.Location = new Point(143, 19);
|
||||||
|
label12.Name = "label12";
|
||||||
|
label12.Size = new Size(16, 17);
|
||||||
|
label12.TabIndex = 1;
|
||||||
|
label12.Text = "X";
|
||||||
|
//
|
||||||
|
// label11
|
||||||
|
//
|
||||||
|
label11.AutoSize = true;
|
||||||
|
label11.Location = new Point(32, 45);
|
||||||
|
label11.Name = "label11";
|
||||||
|
label11.Size = new Size(56, 17);
|
||||||
|
label11.TabIndex = 0;
|
||||||
|
label11.Text = "当前位置";
|
||||||
|
//
|
||||||
|
// ModeleShow
|
||||||
|
//
|
||||||
|
ModeleShow.Controls.Add(ZBackwardrbx);
|
||||||
|
ModeleShow.Controls.Add(YBackwardrbx);
|
||||||
|
ModeleShow.Controls.Add(XBackwardrbx);
|
||||||
|
ModeleShow.Controls.Add(ZForwardrbx);
|
||||||
|
ModeleShow.Controls.Add(YForwardrbx);
|
||||||
|
ModeleShow.Controls.Add(XForwardrbx);
|
||||||
|
ModeleShow.Controls.Add(ZZerorbx);
|
||||||
|
ModeleShow.Controls.Add(YZerorbx);
|
||||||
|
ModeleShow.Controls.Add(XZerorbx);
|
||||||
|
ModeleShow.Controls.Add(PLCPostion);
|
||||||
|
ModeleShow.Controls.Add(PLCDiskZero);
|
||||||
|
ModeleShow.Controls.Add(PLCPowerON);
|
||||||
|
ModeleShow.Location = new Point(14, 107);
|
||||||
|
ModeleShow.Name = "ModeleShow";
|
||||||
|
ModeleShow.Size = new Size(579, 373);
|
||||||
|
ModeleShow.TabIndex = 12;
|
||||||
|
ModeleShow.TabStop = false;
|
||||||
|
ModeleShow.Text = "模组显示";
|
||||||
|
//
|
||||||
|
// ZBackwardrbx
|
||||||
|
//
|
||||||
|
ZBackwardrbx.Appearance = Appearance.Button;
|
||||||
|
ZBackwardrbx.Location = new Point(410, 180);
|
||||||
|
ZBackwardrbx.Name = "ZBackwardrbx";
|
||||||
|
ZBackwardrbx.Size = new Size(125, 62);
|
||||||
|
ZBackwardrbx.TabIndex = 21;
|
||||||
|
ZBackwardrbx.Text = "Z反向";
|
||||||
|
ZBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
ZBackwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// YBackwardrbx
|
||||||
|
//
|
||||||
|
YBackwardrbx.Appearance = Appearance.Button;
|
||||||
|
YBackwardrbx.Location = new Point(266, 180);
|
||||||
|
YBackwardrbx.Name = "YBackwardrbx";
|
||||||
|
YBackwardrbx.Size = new Size(125, 62);
|
||||||
|
YBackwardrbx.TabIndex = 20;
|
||||||
|
YBackwardrbx.Text = "Y反向";
|
||||||
|
YBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
YBackwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// XBackwardrbx
|
||||||
|
//
|
||||||
|
XBackwardrbx.Appearance = Appearance.Button;
|
||||||
|
XBackwardrbx.Location = new Point(126, 180);
|
||||||
|
XBackwardrbx.Name = "XBackwardrbx";
|
||||||
|
XBackwardrbx.Size = new Size(125, 62);
|
||||||
|
XBackwardrbx.TabIndex = 19;
|
||||||
|
XBackwardrbx.Text = "X反向";
|
||||||
|
XBackwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
XBackwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// ZForwardrbx
|
||||||
|
//
|
||||||
|
ZForwardrbx.Appearance = Appearance.Button;
|
||||||
|
ZForwardrbx.Location = new Point(410, 105);
|
||||||
|
ZForwardrbx.Name = "ZForwardrbx";
|
||||||
|
ZForwardrbx.Size = new Size(125, 62);
|
||||||
|
ZForwardrbx.TabIndex = 18;
|
||||||
|
ZForwardrbx.Text = "Z正向";
|
||||||
|
ZForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
ZForwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// YForwardrbx
|
||||||
|
//
|
||||||
|
YForwardrbx.Appearance = Appearance.Button;
|
||||||
|
YForwardrbx.Location = new Point(266, 102);
|
||||||
|
YForwardrbx.Name = "YForwardrbx";
|
||||||
|
YForwardrbx.Size = new Size(125, 62);
|
||||||
|
YForwardrbx.TabIndex = 17;
|
||||||
|
YForwardrbx.Text = "Y正向";
|
||||||
|
YForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
YForwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// XForwardrbx
|
||||||
|
//
|
||||||
|
XForwardrbx.Appearance = Appearance.Button;
|
||||||
|
XForwardrbx.Location = new Point(126, 105);
|
||||||
|
XForwardrbx.Name = "XForwardrbx";
|
||||||
|
XForwardrbx.Size = new Size(125, 62);
|
||||||
|
XForwardrbx.TabIndex = 16;
|
||||||
|
XForwardrbx.Text = "X正向";
|
||||||
|
XForwardrbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
XForwardrbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// ZZerorbx
|
||||||
|
//
|
||||||
|
ZZerorbx.Appearance = Appearance.Button;
|
||||||
|
ZZerorbx.Location = new Point(410, 22);
|
||||||
|
ZZerorbx.Name = "ZZerorbx";
|
||||||
|
ZZerorbx.Size = new Size(125, 62);
|
||||||
|
ZZerorbx.TabIndex = 15;
|
||||||
|
ZZerorbx.Text = "Z归零";
|
||||||
|
ZZerorbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
ZZerorbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// YZerorbx
|
||||||
|
//
|
||||||
|
YZerorbx.Appearance = Appearance.Button;
|
||||||
|
YZerorbx.Location = new Point(266, 22);
|
||||||
|
YZerorbx.Name = "YZerorbx";
|
||||||
|
YZerorbx.Size = new Size(125, 62);
|
||||||
|
YZerorbx.TabIndex = 14;
|
||||||
|
YZerorbx.Text = "Y归零";
|
||||||
|
YZerorbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
YZerorbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// XZerorbx
|
||||||
|
//
|
||||||
|
XZerorbx.Appearance = Appearance.Button;
|
||||||
|
XZerorbx.Location = new Point(126, 22);
|
||||||
|
XZerorbx.Name = "XZerorbx";
|
||||||
|
XZerorbx.Size = new Size(125, 62);
|
||||||
|
XZerorbx.TabIndex = 13;
|
||||||
|
XZerorbx.Text = "X归零";
|
||||||
|
XZerorbx.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
|
XZerorbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// PLCPostion
|
||||||
|
//
|
||||||
|
PLCPostion.Location = new Point(6, 258);
|
||||||
|
PLCPostion.Name = "PLCPostion";
|
||||||
|
PLCPostion.Size = new Size(97, 101);
|
||||||
|
PLCPostion.TabIndex = 2;
|
||||||
|
PLCPostion.Text = "定位";
|
||||||
|
PLCPostion.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// PLCDiskZero
|
||||||
|
//
|
||||||
|
PLCDiskZero.Location = new Point(6, 141);
|
||||||
|
PLCDiskZero.Name = "PLCDiskZero";
|
||||||
|
PLCDiskZero.Size = new Size(97, 101);
|
||||||
|
PLCDiskZero.TabIndex = 1;
|
||||||
|
PLCDiskZero.Text = "归零";
|
||||||
|
PLCDiskZero.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// PLCPowerON
|
||||||
|
//
|
||||||
|
PLCPowerON.Location = new Point(6, 22);
|
||||||
|
PLCPowerON.Name = "PLCPowerON";
|
||||||
|
PLCPowerON.Size = new Size(97, 101);
|
||||||
|
PLCPowerON.TabIndex = 0;
|
||||||
|
PLCPowerON.Text = "使能ON";
|
||||||
|
PLCPowerON.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// writePLCValue
|
||||||
|
//
|
||||||
|
writePLCValue.Location = new Point(670, 10);
|
||||||
|
writePLCValue.Name = "writePLCValue";
|
||||||
|
writePLCValue.Size = new Size(100, 23);
|
||||||
|
writePLCValue.TabIndex = 11;
|
||||||
|
//
|
||||||
|
// label9
|
||||||
|
//
|
||||||
|
label9.AutoSize = true;
|
||||||
|
label9.Location = new Point(400, 52);
|
||||||
|
label9.Name = "label9";
|
||||||
|
label9.Size = new Size(20, 17);
|
||||||
|
label9.TabIndex = 10;
|
||||||
|
label9.Text = "值";
|
||||||
|
//
|
||||||
|
// label10
|
||||||
|
//
|
||||||
|
label10.AutoSize = true;
|
||||||
|
label10.Location = new Point(400, 16);
|
||||||
|
label10.Name = "label10";
|
||||||
|
label10.Size = new Size(32, 17);
|
||||||
|
label10.TabIndex = 9;
|
||||||
|
label10.Text = "地址";
|
||||||
|
//
|
||||||
|
// wirteAdressBtn
|
||||||
|
//
|
||||||
|
wirteAdressBtn.Location = new Point(574, 13);
|
||||||
|
wirteAdressBtn.Name = "wirteAdressBtn";
|
||||||
|
wirteAdressBtn.Size = new Size(75, 23);
|
||||||
|
wirteAdressBtn.TabIndex = 7;
|
||||||
|
wirteAdressBtn.Text = "写地址INT";
|
||||||
|
wirteAdressBtn.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// PLCValue
|
||||||
|
//
|
||||||
|
PLCValue.Location = new Point(449, 46);
|
||||||
|
PLCValue.Name = "PLCValue";
|
||||||
|
PLCValue.Size = new Size(100, 23);
|
||||||
|
PLCValue.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// WriteAdress
|
||||||
|
//
|
||||||
|
WriteAdress.Location = new Point(449, 13);
|
||||||
|
WriteAdress.Name = "WriteAdress";
|
||||||
|
WriteAdress.Size = new Size(100, 23);
|
||||||
|
WriteAdress.TabIndex = 6;
|
||||||
|
//
|
||||||
|
// label6
|
||||||
|
//
|
||||||
|
label6.AutoSize = true;
|
||||||
|
label6.Location = new Point(126, 55);
|
||||||
|
label6.Name = "label6";
|
||||||
|
label6.Size = new Size(20, 17);
|
||||||
|
label6.TabIndex = 5;
|
||||||
|
label6.Text = "值";
|
||||||
|
//
|
||||||
|
// label3
|
||||||
|
//
|
||||||
|
label3.AutoSize = true;
|
||||||
|
label3.Location = new Point(126, 19);
|
||||||
|
label3.Name = "label3";
|
||||||
|
label3.Size = new Size(32, 17);
|
||||||
|
label3.TabIndex = 4;
|
||||||
|
label3.Text = "地址";
|
||||||
|
//
|
||||||
|
// ConnectPLC
|
||||||
|
//
|
||||||
|
ConnectPLC.Location = new Point(14, 16);
|
||||||
|
ConnectPLC.Name = "ConnectPLC";
|
||||||
|
ConnectPLC.Size = new Size(99, 56);
|
||||||
|
ConnectPLC.TabIndex = 0;
|
||||||
|
ConnectPLC.Text = "链接PLC";
|
||||||
|
ConnectPLC.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// readAdress
|
||||||
|
//
|
||||||
|
readAdress.Location = new Point(300, 16);
|
||||||
|
readAdress.Name = "readAdress";
|
||||||
|
readAdress.Size = new Size(75, 23);
|
||||||
|
readAdress.TabIndex = 2;
|
||||||
|
readAdress.Text = "读地址INT";
|
||||||
|
readAdress.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// showPLC
|
||||||
|
//
|
||||||
|
showPLC.Location = new Point(175, 49);
|
||||||
|
showPLC.Name = "showPLC";
|
||||||
|
showPLC.Size = new Size(100, 23);
|
||||||
|
showPLC.TabIndex = 3;
|
||||||
|
//
|
||||||
|
// readPLc
|
||||||
|
//
|
||||||
|
readPLc.Location = new Point(175, 16);
|
||||||
|
readPLc.Name = "readPLc";
|
||||||
|
readPLc.Size = new Size(100, 23);
|
||||||
|
readPLc.TabIndex = 1;
|
||||||
|
//
|
||||||
|
// Form1
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(7F, 17F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1057, 450);
|
||||||
|
Controls.Add(tableLayoutPanel1);
|
||||||
|
Name = "Form1";
|
||||||
|
Text = "Form1";
|
||||||
|
tableLayoutPanel1.ResumeLayout(false);
|
||||||
|
tableLayoutPanel1.PerformLayout();
|
||||||
|
panel1.ResumeLayout(false);
|
||||||
|
panel1.PerformLayout();
|
||||||
|
groupBox5.ResumeLayout(false);
|
||||||
|
groupBox5.PerformLayout();
|
||||||
|
groupBox4.ResumeLayout(false);
|
||||||
|
groupBox4.PerformLayout();
|
||||||
|
ModeleShow.ResumeLayout(false);
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private TableLayoutPanel tableLayoutPanel1;
|
||||||
|
private Panel panel1;
|
||||||
|
private GroupBox groupBox5;
|
||||||
|
private TextBox DistanceShow;
|
||||||
|
private Label label21;
|
||||||
|
private TextBox txtSetValue;
|
||||||
|
private GroupBox groupBox4;
|
||||||
|
private Button SetAutoSpeed;
|
||||||
|
private Button SetHandleSpeed;
|
||||||
|
private TextBox SetlnEditmiZOP;
|
||||||
|
private TextBox SetlnEditmiYOP;
|
||||||
|
private TextBox SetlnEditmiXOP;
|
||||||
|
private TextBox SetlnEditmiZH;
|
||||||
|
private TextBox SetlnEditmiYH;
|
||||||
|
private TextBox SetlnEditmiXH;
|
||||||
|
private TextBox lnEditmiZOP;
|
||||||
|
private TextBox lnEditmiYOP;
|
||||||
|
private TextBox lnEditmiXOP;
|
||||||
|
private Label label17;
|
||||||
|
private TextBox lnEditmiZS;
|
||||||
|
private TextBox lnEditmiYS;
|
||||||
|
private TextBox lnEditmiXS;
|
||||||
|
private Label label16;
|
||||||
|
private TextBox lnEditmiZHS;
|
||||||
|
private TextBox lnEditmiYHS;
|
||||||
|
private TextBox lnEditmiXHS;
|
||||||
|
private Label label15;
|
||||||
|
private Label ZPostion;
|
||||||
|
private Label YPostion;
|
||||||
|
private Label XPostion;
|
||||||
|
private Label XCurrentPostion;
|
||||||
|
private Label label14;
|
||||||
|
private Label label13;
|
||||||
|
private Label label12;
|
||||||
|
private Label label11;
|
||||||
|
private GroupBox ModeleShow;
|
||||||
|
private RadioButton ZBackwardrbx;
|
||||||
|
private RadioButton YBackwardrbx;
|
||||||
|
private RadioButton XBackwardrbx;
|
||||||
|
private RadioButton ZForwardrbx;
|
||||||
|
private RadioButton YForwardrbx;
|
||||||
|
private RadioButton XForwardrbx;
|
||||||
|
private RadioButton ZZerorbx;
|
||||||
|
private RadioButton YZerorbx;
|
||||||
|
private RadioButton XZerorbx;
|
||||||
|
private Button PLCPostion;
|
||||||
|
private Button PLCDiskZero;
|
||||||
|
private Button PLCPowerON;
|
||||||
|
private TextBox writePLCValue;
|
||||||
|
private Label label9;
|
||||||
|
private Label label10;
|
||||||
|
private Button wirteAdressBtn;
|
||||||
|
private TextBox PLCValue;
|
||||||
|
private TextBox WriteAdress;
|
||||||
|
private Label label6;
|
||||||
|
private Label label3;
|
||||||
|
private Button ConnectPLC;
|
||||||
|
private Button readAdress;
|
||||||
|
private TextBox showPLC;
|
||||||
|
private TextBox readPLc;
|
||||||
|
}
|
||||||
|
}
|
20
HisenceYoloDetection/Form1.cs
Normal file
20
HisenceYoloDetection/Form1.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace HisenceYoloDetection
|
||||||
|
{
|
||||||
|
public partial class Form1 : Form
|
||||||
|
{
|
||||||
|
public Form1()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
394
HisenceYoloDetection/InsertSqlFrm.Designer.cs
generated
394
HisenceYoloDetection/InsertSqlFrm.Designer.cs
generated
@ -1,394 +0,0 @@
|
|||||||
namespace HisenceYoloDetection
|
|
||||||
{
|
|
||||||
partial class InsertSqlFrm
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
panel1 = new Panel();
|
|
||||||
button1 = new Button();
|
|
||||||
OpenTwoDirBtn = new Button();
|
|
||||||
OpenDirBtn = new Button();
|
|
||||||
Cam2MatCbx = new TextBox();
|
|
||||||
label3 = new Label();
|
|
||||||
Cam1MatCbx = new TextBox();
|
|
||||||
label4 = new Label();
|
|
||||||
QueryoneBtn = new Button();
|
|
||||||
DetectBArMatbox = new TextBox();
|
|
||||||
label11 = new Label();
|
|
||||||
InsertBtn = new Button();
|
|
||||||
moveTwoZbox = new TextBox();
|
|
||||||
label5 = new Label();
|
|
||||||
moveTwoYbox = new TextBox();
|
|
||||||
label9 = new Label();
|
|
||||||
moveTwoXbox = new TextBox();
|
|
||||||
label10 = new Label();
|
|
||||||
moveZbox = new TextBox();
|
|
||||||
label6 = new Label();
|
|
||||||
moveYbox = new TextBox();
|
|
||||||
label7 = new Label();
|
|
||||||
moveXbox = new TextBox();
|
|
||||||
label8 = new Label();
|
|
||||||
OcrBarBox = new TextBox();
|
|
||||||
label2 = new Label();
|
|
||||||
TypeBox = new TextBox();
|
|
||||||
queryALLBtn = new Button();
|
|
||||||
label1 = new Label();
|
|
||||||
InsertDataDgv = new DataGridView();
|
|
||||||
panel1.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)InsertDataDgv).BeginInit();
|
|
||||||
SuspendLayout();
|
|
||||||
//
|
|
||||||
// panel1
|
|
||||||
//
|
|
||||||
panel1.Controls.Add(button1);
|
|
||||||
panel1.Controls.Add(OpenTwoDirBtn);
|
|
||||||
panel1.Controls.Add(OpenDirBtn);
|
|
||||||
panel1.Controls.Add(Cam2MatCbx);
|
|
||||||
panel1.Controls.Add(label3);
|
|
||||||
panel1.Controls.Add(Cam1MatCbx);
|
|
||||||
panel1.Controls.Add(label4);
|
|
||||||
panel1.Controls.Add(QueryoneBtn);
|
|
||||||
panel1.Controls.Add(DetectBArMatbox);
|
|
||||||
panel1.Controls.Add(label11);
|
|
||||||
panel1.Controls.Add(InsertBtn);
|
|
||||||
panel1.Controls.Add(moveTwoZbox);
|
|
||||||
panel1.Controls.Add(label5);
|
|
||||||
panel1.Controls.Add(moveTwoYbox);
|
|
||||||
panel1.Controls.Add(label9);
|
|
||||||
panel1.Controls.Add(moveTwoXbox);
|
|
||||||
panel1.Controls.Add(label10);
|
|
||||||
panel1.Controls.Add(moveZbox);
|
|
||||||
panel1.Controls.Add(label6);
|
|
||||||
panel1.Controls.Add(moveYbox);
|
|
||||||
panel1.Controls.Add(label7);
|
|
||||||
panel1.Controls.Add(moveXbox);
|
|
||||||
panel1.Controls.Add(label8);
|
|
||||||
panel1.Controls.Add(OcrBarBox);
|
|
||||||
panel1.Controls.Add(label2);
|
|
||||||
panel1.Controls.Add(TypeBox);
|
|
||||||
panel1.Controls.Add(queryALLBtn);
|
|
||||||
panel1.Controls.Add(label1);
|
|
||||||
panel1.Controls.Add(InsertDataDgv);
|
|
||||||
panel1.Location = new Point(0, -3);
|
|
||||||
panel1.Name = "panel1";
|
|
||||||
panel1.Size = new Size(934, 533);
|
|
||||||
panel1.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// button1
|
|
||||||
//
|
|
||||||
button1.Location = new Point(696, 152);
|
|
||||||
button1.Name = "button1";
|
|
||||||
button1.Size = new Size(75, 23);
|
|
||||||
button1.TabIndex = 32;
|
|
||||||
button1.Text = "打开文件";
|
|
||||||
button1.UseVisualStyleBackColor = true;
|
|
||||||
button1.Click += button1_Click;
|
|
||||||
//
|
|
||||||
// OpenTwoDirBtn
|
|
||||||
//
|
|
||||||
OpenTwoDirBtn.Location = new Point(696, 241);
|
|
||||||
OpenTwoDirBtn.Name = "OpenTwoDirBtn";
|
|
||||||
OpenTwoDirBtn.Size = new Size(75, 23);
|
|
||||||
OpenTwoDirBtn.TabIndex = 31;
|
|
||||||
OpenTwoDirBtn.Text = "打开文件";
|
|
||||||
OpenTwoDirBtn.UseVisualStyleBackColor = true;
|
|
||||||
OpenTwoDirBtn.Click += OpenTwoDirBtn_Click;
|
|
||||||
//
|
|
||||||
// OpenDirBtn
|
|
||||||
//
|
|
||||||
OpenDirBtn.Location = new Point(696, 193);
|
|
||||||
OpenDirBtn.Name = "OpenDirBtn";
|
|
||||||
OpenDirBtn.Size = new Size(75, 23);
|
|
||||||
OpenDirBtn.TabIndex = 30;
|
|
||||||
OpenDirBtn.Text = "打开文件";
|
|
||||||
OpenDirBtn.UseVisualStyleBackColor = true;
|
|
||||||
OpenDirBtn.Click += OpenDirBtn_Click;
|
|
||||||
//
|
|
||||||
// Cam2MatCbx
|
|
||||||
//
|
|
||||||
Cam2MatCbx.Location = new Point(478, 244);
|
|
||||||
Cam2MatCbx.Name = "Cam2MatCbx";
|
|
||||||
Cam2MatCbx.Size = new Size(188, 23);
|
|
||||||
Cam2MatCbx.TabIndex = 29;
|
|
||||||
//
|
|
||||||
// label3
|
|
||||||
//
|
|
||||||
label3.AutoSize = true;
|
|
||||||
label3.Location = new Point(371, 244);
|
|
||||||
label3.Name = "label3";
|
|
||||||
label3.Size = new Size(80, 17);
|
|
||||||
label3.TabIndex = 28;
|
|
||||||
label3.Text = "面板第二张图";
|
|
||||||
//
|
|
||||||
// Cam1MatCbx
|
|
||||||
//
|
|
||||||
Cam1MatCbx.Location = new Point(478, 193);
|
|
||||||
Cam1MatCbx.Name = "Cam1MatCbx";
|
|
||||||
Cam1MatCbx.Size = new Size(188, 23);
|
|
||||||
Cam1MatCbx.TabIndex = 27;
|
|
||||||
//
|
|
||||||
// label4
|
|
||||||
//
|
|
||||||
label4.AutoSize = true;
|
|
||||||
label4.Location = new Point(372, 199);
|
|
||||||
label4.Name = "label4";
|
|
||||||
label4.Size = new Size(80, 17);
|
|
||||||
label4.TabIndex = 26;
|
|
||||||
label4.Text = "面板第一张图";
|
|
||||||
//
|
|
||||||
// QueryoneBtn
|
|
||||||
//
|
|
||||||
QueryoneBtn.Location = new Point(827, 108);
|
|
||||||
QueryoneBtn.Name = "QueryoneBtn";
|
|
||||||
QueryoneBtn.Size = new Size(93, 23);
|
|
||||||
QueryoneBtn.TabIndex = 25;
|
|
||||||
QueryoneBtn.Text = "条件查询";
|
|
||||||
QueryoneBtn.UseVisualStyleBackColor = true;
|
|
||||||
QueryoneBtn.Click += QueryoneBtn_Click;
|
|
||||||
//
|
|
||||||
// DetectBArMatbox
|
|
||||||
//
|
|
||||||
DetectBArMatbox.Location = new Point(477, 152);
|
|
||||||
DetectBArMatbox.Name = "DetectBArMatbox";
|
|
||||||
DetectBArMatbox.Size = new Size(188, 23);
|
|
||||||
DetectBArMatbox.TabIndex = 24;
|
|
||||||
//
|
|
||||||
// label11
|
|
||||||
//
|
|
||||||
label11.AutoSize = true;
|
|
||||||
label11.Location = new Point(402, 158);
|
|
||||||
label11.Name = "label11";
|
|
||||||
label11.Size = new Size(56, 17);
|
|
||||||
label11.TabIndex = 23;
|
|
||||||
label11.Text = "条码录入";
|
|
||||||
//
|
|
||||||
// InsertBtn
|
|
||||||
//
|
|
||||||
InsertBtn.Location = new Point(827, 18);
|
|
||||||
InsertBtn.Name = "InsertBtn";
|
|
||||||
InsertBtn.Size = new Size(93, 23);
|
|
||||||
InsertBtn.TabIndex = 22;
|
|
||||||
InsertBtn.Text = "插入";
|
|
||||||
InsertBtn.UseVisualStyleBackColor = true;
|
|
||||||
InsertBtn.Click += InsertBtn_Click;
|
|
||||||
//
|
|
||||||
// moveTwoZbox
|
|
||||||
//
|
|
||||||
moveTwoZbox.Location = new Point(477, 101);
|
|
||||||
moveTwoZbox.Name = "moveTwoZbox";
|
|
||||||
moveTwoZbox.Size = new Size(188, 23);
|
|
||||||
moveTwoZbox.TabIndex = 21;
|
|
||||||
//
|
|
||||||
// label5
|
|
||||||
//
|
|
||||||
label5.AutoSize = true;
|
|
||||||
label5.Location = new Point(371, 107);
|
|
||||||
label5.Name = "label5";
|
|
||||||
label5.Size = new Size(87, 17);
|
|
||||||
label5.TabIndex = 20;
|
|
||||||
label5.Text = "第二次拍照Z轴";
|
|
||||||
//
|
|
||||||
// moveTwoYbox
|
|
||||||
//
|
|
||||||
moveTwoYbox.Location = new Point(477, 54);
|
|
||||||
moveTwoYbox.Name = "moveTwoYbox";
|
|
||||||
moveTwoYbox.Size = new Size(188, 23);
|
|
||||||
moveTwoYbox.TabIndex = 19;
|
|
||||||
//
|
|
||||||
// label9
|
|
||||||
//
|
|
||||||
label9.AutoSize = true;
|
|
||||||
label9.Location = new Point(371, 60);
|
|
||||||
label9.Name = "label9";
|
|
||||||
label9.Size = new Size(87, 17);
|
|
||||||
label9.TabIndex = 18;
|
|
||||||
label9.Text = "第二次拍照Y轴";
|
|
||||||
//
|
|
||||||
// moveTwoXbox
|
|
||||||
//
|
|
||||||
moveTwoXbox.Location = new Point(477, 12);
|
|
||||||
moveTwoXbox.Name = "moveTwoXbox";
|
|
||||||
moveTwoXbox.Size = new Size(188, 23);
|
|
||||||
moveTwoXbox.TabIndex = 17;
|
|
||||||
//
|
|
||||||
// label10
|
|
||||||
//
|
|
||||||
label10.AutoSize = true;
|
|
||||||
label10.Location = new Point(371, 18);
|
|
||||||
label10.Name = "label10";
|
|
||||||
label10.Size = new Size(88, 17);
|
|
||||||
label10.TabIndex = 16;
|
|
||||||
label10.Text = "第二次拍照X轴";
|
|
||||||
//
|
|
||||||
// moveZbox
|
|
||||||
//
|
|
||||||
moveZbox.Location = new Point(111, 193);
|
|
||||||
moveZbox.Name = "moveZbox";
|
|
||||||
moveZbox.Size = new Size(188, 23);
|
|
||||||
moveZbox.TabIndex = 15;
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
label6.AutoSize = true;
|
|
||||||
label6.Location = new Point(17, 199);
|
|
||||||
label6.Name = "label6";
|
|
||||||
label6.Size = new Size(87, 17);
|
|
||||||
label6.TabIndex = 14;
|
|
||||||
label6.Text = "第一次拍照Z轴";
|
|
||||||
//
|
|
||||||
// moveYbox
|
|
||||||
//
|
|
||||||
moveYbox.Location = new Point(111, 146);
|
|
||||||
moveYbox.Name = "moveYbox";
|
|
||||||
moveYbox.Size = new Size(188, 23);
|
|
||||||
moveYbox.TabIndex = 13;
|
|
||||||
//
|
|
||||||
// label7
|
|
||||||
//
|
|
||||||
label7.AutoSize = true;
|
|
||||||
label7.Location = new Point(17, 152);
|
|
||||||
label7.Name = "label7";
|
|
||||||
label7.Size = new Size(87, 17);
|
|
||||||
label7.TabIndex = 12;
|
|
||||||
label7.Text = "第一次拍照Y轴";
|
|
||||||
//
|
|
||||||
// moveXbox
|
|
||||||
//
|
|
||||||
moveXbox.Location = new Point(111, 104);
|
|
||||||
moveXbox.Name = "moveXbox";
|
|
||||||
moveXbox.Size = new Size(188, 23);
|
|
||||||
moveXbox.TabIndex = 11;
|
|
||||||
//
|
|
||||||
// label8
|
|
||||||
//
|
|
||||||
label8.AutoSize = true;
|
|
||||||
label8.Location = new Point(17, 110);
|
|
||||||
label8.Name = "label8";
|
|
||||||
label8.Size = new Size(88, 17);
|
|
||||||
label8.TabIndex = 10;
|
|
||||||
label8.Text = "第一次拍照X轴";
|
|
||||||
//
|
|
||||||
// OcrBarBox
|
|
||||||
//
|
|
||||||
OcrBarBox.Location = new Point(111, 54);
|
|
||||||
OcrBarBox.Name = "OcrBarBox";
|
|
||||||
OcrBarBox.Size = new Size(188, 23);
|
|
||||||
OcrBarBox.TabIndex = 5;
|
|
||||||
//
|
|
||||||
// label2
|
|
||||||
//
|
|
||||||
label2.AutoSize = true;
|
|
||||||
label2.Location = new Point(14, 60);
|
|
||||||
label2.Name = "label2";
|
|
||||||
label2.Size = new Size(32, 17);
|
|
||||||
label2.TabIndex = 4;
|
|
||||||
label2.Text = "条码";
|
|
||||||
//
|
|
||||||
// TypeBox
|
|
||||||
//
|
|
||||||
TypeBox.Location = new Point(111, 12);
|
|
||||||
TypeBox.Name = "TypeBox";
|
|
||||||
TypeBox.Size = new Size(188, 23);
|
|
||||||
TypeBox.TabIndex = 3;
|
|
||||||
TypeBox.TextChanged += TypeBox_TextChanged;
|
|
||||||
//
|
|
||||||
// queryALLBtn
|
|
||||||
//
|
|
||||||
queryALLBtn.Location = new Point(827, 59);
|
|
||||||
queryALLBtn.Name = "queryALLBtn";
|
|
||||||
queryALLBtn.Size = new Size(93, 23);
|
|
||||||
queryALLBtn.TabIndex = 2;
|
|
||||||
queryALLBtn.Text = "查询全部";
|
|
||||||
queryALLBtn.UseVisualStyleBackColor = true;
|
|
||||||
queryALLBtn.Click += queryALLBtn_Click;
|
|
||||||
//
|
|
||||||
// label1
|
|
||||||
//
|
|
||||||
label1.AutoSize = true;
|
|
||||||
label1.Location = new Point(14, 18);
|
|
||||||
label1.Name = "label1";
|
|
||||||
label1.Size = new Size(32, 17);
|
|
||||||
label1.TabIndex = 1;
|
|
||||||
label1.Text = "类型";
|
|
||||||
//
|
|
||||||
// InsertDataDgv
|
|
||||||
//
|
|
||||||
InsertDataDgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
||||||
InsertDataDgv.Location = new Point(12, 281);
|
|
||||||
InsertDataDgv.Name = "InsertDataDgv";
|
|
||||||
InsertDataDgv.RowTemplate.Height = 25;
|
|
||||||
InsertDataDgv.Size = new Size(919, 235);
|
|
||||||
InsertDataDgv.TabIndex = 0;
|
|
||||||
//
|
|
||||||
// InsertSqlFrm
|
|
||||||
//
|
|
||||||
AutoScaleDimensions = new SizeF(7F, 17F);
|
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
|
||||||
ClientSize = new Size(946, 525);
|
|
||||||
Controls.Add(panel1);
|
|
||||||
Name = "InsertSqlFrm";
|
|
||||||
Text = "InsertSqlFrm";
|
|
||||||
panel1.ResumeLayout(false);
|
|
||||||
panel1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)InsertDataDgv).EndInit();
|
|
||||||
ResumeLayout(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private Panel panel1;
|
|
||||||
private Button queryALLBtn;
|
|
||||||
private Label label1;
|
|
||||||
private DataGridView InsertDataDgv;
|
|
||||||
private TextBox moveZbox;
|
|
||||||
private Label label6;
|
|
||||||
private TextBox moveYbox;
|
|
||||||
private Label label7;
|
|
||||||
private TextBox moveXbox;
|
|
||||||
private Label label8;
|
|
||||||
private TextBox OcrBarBox;
|
|
||||||
private Label label2;
|
|
||||||
private TextBox TypeBox;
|
|
||||||
private TextBox DetectBArMatbox;
|
|
||||||
private Label label11;
|
|
||||||
private Button InsertBtn;
|
|
||||||
private TextBox moveTwoZbox;
|
|
||||||
private Label label5;
|
|
||||||
private TextBox moveTwoYbox;
|
|
||||||
private Label label9;
|
|
||||||
private TextBox moveTwoXbox;
|
|
||||||
private Label label10;
|
|
||||||
private Button QueryoneBtn;
|
|
||||||
private TextBox Cam2MatCbx;
|
|
||||||
private Label label3;
|
|
||||||
private TextBox Cam1MatCbx;
|
|
||||||
private Label label4;
|
|
||||||
private Button button1;
|
|
||||||
private Button OpenTwoDirBtn;
|
|
||||||
private Button OpenDirBtn;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,198 +0,0 @@
|
|||||||
using OpenCvSharp;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using XKRS.Device.SimboVision.SimboHelper;
|
|
||||||
|
|
||||||
namespace HisenceYoloDetection
|
|
||||||
{
|
|
||||||
public partial class InsertSqlFrm : Form
|
|
||||||
{
|
|
||||||
public InsertSqlFrm()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
public SimboObjectDetection simboObjectDetection;
|
|
||||||
public PaddleOcrModel paddleOcrModel ;
|
|
||||||
public PaddleOcrModelCountry paddleOcrModelCountry ;
|
|
||||||
private void TypeBox_TextChanged(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
string BarPath = "";
|
|
||||||
string Cam1OnePath = "";
|
|
||||||
string Cam1TwoPath = "";
|
|
||||||
|
|
||||||
|
|
||||||
private void InsertBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string type = TypeBox.Text;
|
|
||||||
string OcrBar = OcrBarBox.Text;
|
|
||||||
string moveX = moveXbox.Text;
|
|
||||||
string moveY = moveYbox.Text;
|
|
||||||
string moveZ = moveZbox.Text;
|
|
||||||
string Detect = DetectBArMatbox.Text;
|
|
||||||
string movetwoX = moveTwoXbox.Text;
|
|
||||||
string movetwoY = moveTwoYbox.Text;
|
|
||||||
string movetwoZ = moveTwoZbox.Text;
|
|
||||||
|
|
||||||
if (!Regex.IsMatch(moveX, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第一次拍照移动的X只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(moveY, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第一次拍照移动的Y只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(moveZ, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第一次拍照移动的Z只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(movetwoX, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第二次拍照移动的X只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(movetwoY, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第二次拍照移动的Y只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!Regex.IsMatch(movetwoZ, @"^[0-9]+$"))
|
|
||||||
{
|
|
||||||
MessageBox.Show("第二次拍照移动的Z只能是数字");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OcrBar != "" && Detect != "")
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
string sql = "insert into XK_Hisence VALUES('" + type + "','" + OcrBar + "',null,null," + moveX + "," + moveY + "," + moveZ + ",'" + Detect + "',null," + movetwoX + "," + movetwoY + "," + movetwoZ + ")";
|
|
||||||
SQLiteHelper.ExecuteSql(sql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("插入的数据不能为NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception es)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void queryALLBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
DataSet dataSet = SQLiteHelper.Query("select * from XK_Hisence");
|
|
||||||
InsertDataDgv.DataSource = dataSet.Tables[0];
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception es)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void QueryoneBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string type = TypeBox.Text;
|
|
||||||
string OcrBar = OcrBarBox.Text;
|
|
||||||
string moveX = moveXbox.Text;
|
|
||||||
string moveY = moveYbox.Text;
|
|
||||||
string moveZ = moveZbox.Text;
|
|
||||||
string Detect = DetectBArMatbox.Text;
|
|
||||||
string movetwoX = moveTwoXbox.Text;
|
|
||||||
string movetwoY = moveTwoYbox.Text;
|
|
||||||
string movetwoZ = moveTwoZbox.Text;
|
|
||||||
|
|
||||||
|
|
||||||
string sql = "select * from XK_Hisence where type='" + type + "' or OcrBar='" + OcrBar + "'";
|
|
||||||
DataSet dataSet = SQLiteHelper.Query(sql);
|
|
||||||
InsertDataDgv.DataSource = dataSet.Tables[0];
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception es)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 打开条码的图片
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sender"></param>
|
|
||||||
/// <param name="e"></param>
|
|
||||||
private void button1_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.Title = "请打开图片";
|
|
||||||
|
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
string fName = openFileDialog.FileName;
|
|
||||||
//File fileOpen = new File(fName);
|
|
||||||
//isFileHaveName = true;
|
|
||||||
//richTextBox1.Text = fileOpen.ReadFile();
|
|
||||||
//richTextBox1.AppendText("");
|
|
||||||
DetectBArMatbox.Text = fName;
|
|
||||||
BarPath = fName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenDirBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.Title = "请打开图片";
|
|
||||||
|
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
string fName = openFileDialog.FileName;
|
|
||||||
//File fileOpen = new File(fName);
|
|
||||||
//isFileHaveName = true;
|
|
||||||
//richTextBox1.Text = fileOpen.ReadFile();
|
|
||||||
//richTextBox1.AppendText("");
|
|
||||||
Cam1MatCbx.Text = fName;
|
|
||||||
Cam1OnePath = fName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenTwoDirBtn_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
||||||
openFileDialog.Title = "请打开图片";
|
|
||||||
|
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
string fName = openFileDialog.FileName;
|
|
||||||
//File fileOpen = new File(fName);
|
|
||||||
//isFileHaveName = true;
|
|
||||||
//richTextBox1.Text = fileOpen.ReadFile();
|
|
||||||
//richTextBox1.AppendText("");
|
|
||||||
Cam2MatCbx.Text = fName;
|
|
||||||
Cam1TwoPath = fName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
108
HisenceYoloDetection/MainForm.Designer.cs
generated
108
HisenceYoloDetection/MainForm.Designer.cs
generated
@ -143,6 +143,10 @@
|
|||||||
ResultMatShow = new PictureBox();
|
ResultMatShow = new PictureBox();
|
||||||
tabPage3 = new TabPage();
|
tabPage3 = new TabPage();
|
||||||
panel2 = new Panel();
|
panel2 = new Panel();
|
||||||
|
WhiteBanCbx = new CheckBox();
|
||||||
|
label33 = new Label();
|
||||||
|
label28 = new Label();
|
||||||
|
button1 = new Button();
|
||||||
openModelBtn = new Button();
|
openModelBtn = new Button();
|
||||||
modelChangeCbx = new TextBox();
|
modelChangeCbx = new TextBox();
|
||||||
label34 = new Label();
|
label34 = new Label();
|
||||||
@ -164,7 +168,6 @@
|
|||||||
moveTwoXbox = new TextBox();
|
moveTwoXbox = new TextBox();
|
||||||
label27 = new Label();
|
label27 = new Label();
|
||||||
moveZbox = new TextBox();
|
moveZbox = new TextBox();
|
||||||
label28 = new Label();
|
|
||||||
moveYbox = new TextBox();
|
moveYbox = new TextBox();
|
||||||
label29 = new Label();
|
label29 = new Label();
|
||||||
moveXbox = new TextBox();
|
moveXbox = new TextBox();
|
||||||
@ -1343,6 +1346,10 @@
|
|||||||
//
|
//
|
||||||
// panel2
|
// panel2
|
||||||
//
|
//
|
||||||
|
panel2.Controls.Add(WhiteBanCbx);
|
||||||
|
panel2.Controls.Add(label33);
|
||||||
|
panel2.Controls.Add(label28);
|
||||||
|
panel2.Controls.Add(button1);
|
||||||
panel2.Controls.Add(openModelBtn);
|
panel2.Controls.Add(openModelBtn);
|
||||||
panel2.Controls.Add(modelChangeCbx);
|
panel2.Controls.Add(modelChangeCbx);
|
||||||
panel2.Controls.Add(label34);
|
panel2.Controls.Add(label34);
|
||||||
@ -1364,7 +1371,6 @@
|
|||||||
panel2.Controls.Add(moveTwoXbox);
|
panel2.Controls.Add(moveTwoXbox);
|
||||||
panel2.Controls.Add(label27);
|
panel2.Controls.Add(label27);
|
||||||
panel2.Controls.Add(moveZbox);
|
panel2.Controls.Add(moveZbox);
|
||||||
panel2.Controls.Add(label28);
|
|
||||||
panel2.Controls.Add(moveYbox);
|
panel2.Controls.Add(moveYbox);
|
||||||
panel2.Controls.Add(label29);
|
panel2.Controls.Add(label29);
|
||||||
panel2.Controls.Add(moveXbox);
|
panel2.Controls.Add(moveXbox);
|
||||||
@ -1379,6 +1385,46 @@
|
|||||||
panel2.Name = "panel2";
|
panel2.Name = "panel2";
|
||||||
panel2.Size = new Size(1260, 533);
|
panel2.Size = new Size(1260, 533);
|
||||||
panel2.TabIndex = 1;
|
panel2.TabIndex = 1;
|
||||||
|
panel2.Paint += panel2_Paint;
|
||||||
|
//
|
||||||
|
// WhiteBanCbx
|
||||||
|
//
|
||||||
|
WhiteBanCbx.AutoSize = true;
|
||||||
|
WhiteBanCbx.Checked = true;
|
||||||
|
WhiteBanCbx.CheckState = CheckState.Checked;
|
||||||
|
WhiteBanCbx.Location = new Point(577, 245);
|
||||||
|
WhiteBanCbx.Name = "WhiteBanCbx";
|
||||||
|
WhiteBanCbx.Size = new Size(39, 21);
|
||||||
|
WhiteBanCbx.TabIndex = 40;
|
||||||
|
WhiteBanCbx.Text = "是";
|
||||||
|
WhiteBanCbx.UseVisualStyleBackColor = true;
|
||||||
|
//
|
||||||
|
// label33
|
||||||
|
//
|
||||||
|
label33.AutoSize = true;
|
||||||
|
label33.Location = new Point(373, 245);
|
||||||
|
label33.Name = "label33";
|
||||||
|
label33.Size = new Size(140, 17);
|
||||||
|
label33.TabIndex = 39;
|
||||||
|
label33.Text = "面板第二块区域是白板吗";
|
||||||
|
//
|
||||||
|
// label28
|
||||||
|
//
|
||||||
|
label28.AutoSize = true;
|
||||||
|
label28.Location = new Point(18, 199);
|
||||||
|
label28.Name = "label28";
|
||||||
|
label28.Size = new Size(87, 17);
|
||||||
|
label28.TabIndex = 14;
|
||||||
|
label28.Text = "第一次拍照Z轴";
|
||||||
|
//
|
||||||
|
// button1
|
||||||
|
//
|
||||||
|
button1.Location = new Point(896, 110);
|
||||||
|
button1.Name = "button1";
|
||||||
|
button1.Size = new Size(93, 23);
|
||||||
|
button1.TabIndex = 38;
|
||||||
|
button1.Text = "识别到log";
|
||||||
|
button1.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
// openModelBtn
|
// openModelBtn
|
||||||
//
|
//
|
||||||
@ -1409,7 +1455,7 @@
|
|||||||
//
|
//
|
||||||
// button4
|
// button4
|
||||||
//
|
//
|
||||||
button4.Location = new Point(696, 152);
|
button4.Location = new Point(691, 110);
|
||||||
button4.Name = "button4";
|
button4.Name = "button4";
|
||||||
button4.Size = new Size(75, 23);
|
button4.Size = new Size(75, 23);
|
||||||
button4.TabIndex = 32;
|
button4.TabIndex = 32;
|
||||||
@ -1419,7 +1465,7 @@
|
|||||||
//
|
//
|
||||||
// OpenTwoDirBtn
|
// OpenTwoDirBtn
|
||||||
//
|
//
|
||||||
OpenTwoDirBtn.Location = new Point(696, 241);
|
OpenTwoDirBtn.Location = new Point(691, 199);
|
||||||
OpenTwoDirBtn.Name = "OpenTwoDirBtn";
|
OpenTwoDirBtn.Name = "OpenTwoDirBtn";
|
||||||
OpenTwoDirBtn.Size = new Size(75, 23);
|
OpenTwoDirBtn.Size = new Size(75, 23);
|
||||||
OpenTwoDirBtn.TabIndex = 31;
|
OpenTwoDirBtn.TabIndex = 31;
|
||||||
@ -1429,7 +1475,7 @@
|
|||||||
//
|
//
|
||||||
// OpenDirBtn
|
// OpenDirBtn
|
||||||
//
|
//
|
||||||
OpenDirBtn.Location = new Point(696, 193);
|
OpenDirBtn.Location = new Point(691, 151);
|
||||||
OpenDirBtn.Name = "OpenDirBtn";
|
OpenDirBtn.Name = "OpenDirBtn";
|
||||||
OpenDirBtn.Size = new Size(75, 23);
|
OpenDirBtn.Size = new Size(75, 23);
|
||||||
OpenDirBtn.TabIndex = 30;
|
OpenDirBtn.TabIndex = 30;
|
||||||
@ -1439,16 +1485,16 @@
|
|||||||
//
|
//
|
||||||
// Cam2MatCbx
|
// Cam2MatCbx
|
||||||
//
|
//
|
||||||
Cam2MatCbx.Location = new Point(478, 244);
|
Cam2MatCbx.Location = new Point(473, 202);
|
||||||
Cam2MatCbx.Name = "Cam2MatCbx";
|
Cam2MatCbx.Name = "Cam2MatCbx";
|
||||||
Cam2MatCbx.Size = new Size(218, 23);
|
Cam2MatCbx.Size = new Size(218, 23);
|
||||||
Cam2MatCbx.TabIndex = 29;
|
Cam2MatCbx.TabIndex = 29;
|
||||||
Cam2MatCbx.Text = "D:\\Hisence\\4\\202452915599711.jpg";
|
Cam2MatCbx.Text = "D:\\Hisence\\类型\\Lp\\002jpg";
|
||||||
//
|
//
|
||||||
// label22
|
// label22
|
||||||
//
|
//
|
||||||
label22.AutoSize = true;
|
label22.AutoSize = true;
|
||||||
label22.Location = new Point(371, 244);
|
label22.Location = new Point(366, 202);
|
||||||
label22.Name = "label22";
|
label22.Name = "label22";
|
||||||
label22.Size = new Size(80, 17);
|
label22.Size = new Size(80, 17);
|
||||||
label22.TabIndex = 28;
|
label22.TabIndex = 28;
|
||||||
@ -1456,16 +1502,16 @@
|
|||||||
//
|
//
|
||||||
// Cam1MatCbx
|
// Cam1MatCbx
|
||||||
//
|
//
|
||||||
Cam1MatCbx.Location = new Point(478, 193);
|
Cam1MatCbx.Location = new Point(473, 151);
|
||||||
Cam1MatCbx.Name = "Cam1MatCbx";
|
Cam1MatCbx.Name = "Cam1MatCbx";
|
||||||
Cam1MatCbx.Size = new Size(218, 23);
|
Cam1MatCbx.Size = new Size(218, 23);
|
||||||
Cam1MatCbx.TabIndex = 27;
|
Cam1MatCbx.TabIndex = 27;
|
||||||
Cam1MatCbx.Text = "D:\\Hisence\\4\\202452915596701.jpg";
|
Cam1MatCbx.Text = "D:\\Hisence\\类型\\Lp\\001.jpg";
|
||||||
//
|
//
|
||||||
// label23
|
// label23
|
||||||
//
|
//
|
||||||
label23.AutoSize = true;
|
label23.AutoSize = true;
|
||||||
label23.Location = new Point(372, 199);
|
label23.Location = new Point(367, 157);
|
||||||
label23.Name = "label23";
|
label23.Name = "label23";
|
||||||
label23.Size = new Size(80, 17);
|
label23.Size = new Size(80, 17);
|
||||||
label23.TabIndex = 26;
|
label23.TabIndex = 26;
|
||||||
@ -1483,16 +1529,16 @@
|
|||||||
//
|
//
|
||||||
// DetectBArMatbox
|
// DetectBArMatbox
|
||||||
//
|
//
|
||||||
DetectBArMatbox.Location = new Point(477, 152);
|
DetectBArMatbox.Location = new Point(472, 110);
|
||||||
DetectBArMatbox.Name = "DetectBArMatbox";
|
DetectBArMatbox.Name = "DetectBArMatbox";
|
||||||
DetectBArMatbox.Size = new Size(219, 23);
|
DetectBArMatbox.Size = new Size(219, 23);
|
||||||
DetectBArMatbox.TabIndex = 24;
|
DetectBArMatbox.TabIndex = 24;
|
||||||
DetectBArMatbox.Text = "D:\\Hisence\\202452414231.jpg";
|
DetectBArMatbox.Text = "D:\\Hisence\\类型\\Lp202452414231.jpg";
|
||||||
//
|
//
|
||||||
// label24
|
// label24
|
||||||
//
|
//
|
||||||
label24.AutoSize = true;
|
label24.AutoSize = true;
|
||||||
label24.Location = new Point(402, 158);
|
label24.Location = new Point(397, 116);
|
||||||
label24.Name = "label24";
|
label24.Name = "label24";
|
||||||
label24.Size = new Size(56, 17);
|
label24.Size = new Size(56, 17);
|
||||||
label24.TabIndex = 23;
|
label24.TabIndex = 23;
|
||||||
@ -1510,7 +1556,7 @@
|
|||||||
//
|
//
|
||||||
// moveTwoZbox
|
// moveTwoZbox
|
||||||
//
|
//
|
||||||
moveTwoZbox.Location = new Point(477, 101);
|
moveTwoZbox.Location = new Point(472, 59);
|
||||||
moveTwoZbox.Name = "moveTwoZbox";
|
moveTwoZbox.Name = "moveTwoZbox";
|
||||||
moveTwoZbox.Size = new Size(219, 23);
|
moveTwoZbox.Size = new Size(219, 23);
|
||||||
moveTwoZbox.TabIndex = 21;
|
moveTwoZbox.TabIndex = 21;
|
||||||
@ -1519,7 +1565,7 @@
|
|||||||
// label25
|
// label25
|
||||||
//
|
//
|
||||||
label25.AutoSize = true;
|
label25.AutoSize = true;
|
||||||
label25.Location = new Point(371, 107);
|
label25.Location = new Point(366, 65);
|
||||||
label25.Name = "label25";
|
label25.Name = "label25";
|
||||||
label25.Size = new Size(87, 17);
|
label25.Size = new Size(87, 17);
|
||||||
label25.TabIndex = 20;
|
label25.TabIndex = 20;
|
||||||
@ -1527,7 +1573,7 @@
|
|||||||
//
|
//
|
||||||
// moveTwoYbox
|
// moveTwoYbox
|
||||||
//
|
//
|
||||||
moveTwoYbox.Location = new Point(477, 54);
|
moveTwoYbox.Location = new Point(472, 12);
|
||||||
moveTwoYbox.Name = "moveTwoYbox";
|
moveTwoYbox.Name = "moveTwoYbox";
|
||||||
moveTwoYbox.Size = new Size(213, 23);
|
moveTwoYbox.Size = new Size(213, 23);
|
||||||
moveTwoYbox.TabIndex = 19;
|
moveTwoYbox.TabIndex = 19;
|
||||||
@ -1536,7 +1582,7 @@
|
|||||||
// label26
|
// label26
|
||||||
//
|
//
|
||||||
label26.AutoSize = true;
|
label26.AutoSize = true;
|
||||||
label26.Location = new Point(371, 60);
|
label26.Location = new Point(366, 18);
|
||||||
label26.Name = "label26";
|
label26.Name = "label26";
|
||||||
label26.Size = new Size(87, 17);
|
label26.Size = new Size(87, 17);
|
||||||
label26.TabIndex = 18;
|
label26.TabIndex = 18;
|
||||||
@ -1544,7 +1590,7 @@
|
|||||||
//
|
//
|
||||||
// moveTwoXbox
|
// moveTwoXbox
|
||||||
//
|
//
|
||||||
moveTwoXbox.Location = new Point(477, 12);
|
moveTwoXbox.Location = new Point(122, 242);
|
||||||
moveTwoXbox.Name = "moveTwoXbox";
|
moveTwoXbox.Name = "moveTwoXbox";
|
||||||
moveTwoXbox.Size = new Size(213, 23);
|
moveTwoXbox.Size = new Size(213, 23);
|
||||||
moveTwoXbox.TabIndex = 17;
|
moveTwoXbox.TabIndex = 17;
|
||||||
@ -1553,7 +1599,7 @@
|
|||||||
// label27
|
// label27
|
||||||
//
|
//
|
||||||
label27.AutoSize = true;
|
label27.AutoSize = true;
|
||||||
label27.Location = new Point(371, 18);
|
label27.Location = new Point(16, 248);
|
||||||
label27.Name = "label27";
|
label27.Name = "label27";
|
||||||
label27.Size = new Size(88, 17);
|
label27.Size = new Size(88, 17);
|
||||||
label27.TabIndex = 16;
|
label27.TabIndex = 16;
|
||||||
@ -1563,24 +1609,15 @@
|
|||||||
//
|
//
|
||||||
moveZbox.Location = new Point(111, 193);
|
moveZbox.Location = new Point(111, 193);
|
||||||
moveZbox.Name = "moveZbox";
|
moveZbox.Name = "moveZbox";
|
||||||
moveZbox.Size = new Size(188, 23);
|
moveZbox.Size = new Size(224, 23);
|
||||||
moveZbox.TabIndex = 15;
|
moveZbox.TabIndex = 15;
|
||||||
moveZbox.Text = "0";
|
moveZbox.Text = "0";
|
||||||
//
|
//
|
||||||
// label28
|
|
||||||
//
|
|
||||||
label28.AutoSize = true;
|
|
||||||
label28.Location = new Point(12, 199);
|
|
||||||
label28.Name = "label28";
|
|
||||||
label28.Size = new Size(87, 17);
|
|
||||||
label28.TabIndex = 14;
|
|
||||||
label28.Text = "第一次拍照Z轴";
|
|
||||||
//
|
|
||||||
// moveYbox
|
// moveYbox
|
||||||
//
|
//
|
||||||
moveYbox.Location = new Point(111, 146);
|
moveYbox.Location = new Point(111, 146);
|
||||||
moveYbox.Name = "moveYbox";
|
moveYbox.Name = "moveYbox";
|
||||||
moveYbox.Size = new Size(188, 23);
|
moveYbox.Size = new Size(224, 23);
|
||||||
moveYbox.TabIndex = 13;
|
moveYbox.TabIndex = 13;
|
||||||
moveYbox.Text = "0";
|
moveYbox.Text = "0";
|
||||||
//
|
//
|
||||||
@ -1597,7 +1634,7 @@
|
|||||||
//
|
//
|
||||||
moveXbox.Location = new Point(111, 104);
|
moveXbox.Location = new Point(111, 104);
|
||||||
moveXbox.Name = "moveXbox";
|
moveXbox.Name = "moveXbox";
|
||||||
moveXbox.Size = new Size(188, 23);
|
moveXbox.Size = new Size(224, 23);
|
||||||
moveXbox.TabIndex = 11;
|
moveXbox.TabIndex = 11;
|
||||||
moveXbox.Text = "8974";
|
moveXbox.Text = "8974";
|
||||||
//
|
//
|
||||||
@ -1614,7 +1651,7 @@
|
|||||||
//
|
//
|
||||||
OcrBarBox.Location = new Point(111, 54);
|
OcrBarBox.Location = new Point(111, 54);
|
||||||
OcrBarBox.Name = "OcrBarBox";
|
OcrBarBox.Name = "OcrBarBox";
|
||||||
OcrBarBox.Size = new Size(188, 23);
|
OcrBarBox.Size = new Size(224, 23);
|
||||||
OcrBarBox.TabIndex = 5;
|
OcrBarBox.TabIndex = 5;
|
||||||
OcrBarBox.Text = "1234567890";
|
OcrBarBox.Text = "1234567890";
|
||||||
//
|
//
|
||||||
@ -1631,7 +1668,7 @@
|
|||||||
//
|
//
|
||||||
TypeBox.Location = new Point(111, 12);
|
TypeBox.Location = new Point(111, 12);
|
||||||
TypeBox.Name = "TypeBox";
|
TypeBox.Name = "TypeBox";
|
||||||
TypeBox.Size = new Size(188, 23);
|
TypeBox.Size = new Size(224, 23);
|
||||||
TypeBox.TabIndex = 3;
|
TypeBox.TabIndex = 3;
|
||||||
TypeBox.Text = "1";
|
TypeBox.Text = "1";
|
||||||
//
|
//
|
||||||
@ -1895,5 +1932,8 @@
|
|||||||
private Button openModelBtn;
|
private Button openModelBtn;
|
||||||
private TextBox modelChangeCbx;
|
private TextBox modelChangeCbx;
|
||||||
private Label label34;
|
private Label label34;
|
||||||
|
private Button button1;
|
||||||
|
private Label label33;
|
||||||
|
private CheckBox WhiteBanCbx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,18 +4,24 @@ using OpenCvSharp;
|
|||||||
using OpenCvSharp.Dnn;
|
using OpenCvSharp.Dnn;
|
||||||
using OpenCvSharp.Extensions;
|
using OpenCvSharp.Extensions;
|
||||||
using OpenCvSharp.XFeatures2D;
|
using OpenCvSharp.XFeatures2D;
|
||||||
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder;
|
||||||
|
using System.Data.SQLite;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.Eventing.Reader;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using XKRS.Device.SimboVision.SimboHelper;
|
using XKRS.Device.SimboVision.SimboHelper;
|
||||||
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;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView;
|
||||||
|
|
||||||
|
|
||||||
namespace HisenceYoloDetection
|
namespace HisenceYoloDetection
|
||||||
@ -32,6 +38,10 @@ namespace HisenceYoloDetection
|
|||||||
TCPClienDriver Scanner = new TCPClienDriver();
|
TCPClienDriver Scanner = new TCPClienDriver();
|
||||||
MelsecPLCTCPDriver melsecPLCTCPDriver = new MelsecPLCTCPDriver();
|
MelsecPLCTCPDriver melsecPLCTCPDriver = new MelsecPLCTCPDriver();
|
||||||
SimboObjectDetection simboObjectDetection = new SimboObjectDetection();
|
SimboObjectDetection simboObjectDetection = new SimboObjectDetection();
|
||||||
|
SimboObjectDetection simboObjectDetButton = new SimboObjectDetection();
|
||||||
|
// CheckDiffSciHelper checkDiffSciHelper = new CheckDiffSciHelper();
|
||||||
|
// ManagerModelHelper managerModelHelper = new ManagerModelHelper();
|
||||||
|
|
||||||
PaddleOcrModel paddleOcrModel = new PaddleOcrModel();
|
PaddleOcrModel paddleOcrModel = new PaddleOcrModel();
|
||||||
PaddleOcrModelCountry paddleOcrModelCountry = new PaddleOcrModelCountry();
|
PaddleOcrModelCountry paddleOcrModelCountry = new PaddleOcrModelCountry();
|
||||||
List<XKHisence> xKHisences = new List<XKHisence>();
|
List<XKHisence> xKHisences = new List<XKHisence>();
|
||||||
@ -53,6 +63,7 @@ namespace HisenceYoloDetection
|
|||||||
Mat Cam2ImgShowBar = new Mat();//实时相机2的照片 用来识别条码
|
Mat Cam2ImgShowBar = new Mat();//实时相机2的照片 用来识别条码
|
||||||
|
|
||||||
XKHisence xKNow;//数据库中的洗衣机数据
|
XKHisence xKNow;//数据库中的洗衣机数据
|
||||||
|
XK_HisenceWord xK_HisenceSQLWord = new XK_HisenceWord();
|
||||||
bool bOn = false;
|
bool bOn = false;
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
public static int m_CamCount = 0;
|
public static int m_CamCount = 0;
|
||||||
@ -69,6 +80,7 @@ namespace HisenceYoloDetection
|
|||||||
bool ifXBackward = false;
|
bool ifXBackward = false;
|
||||||
bool ifYBackward = false;
|
bool ifYBackward = false;
|
||||||
bool ifZBackward = false;
|
bool ifZBackward = false;
|
||||||
|
string LablePath = "";
|
||||||
//录入数据库
|
//录入数据库
|
||||||
string BarPath = "";
|
string BarPath = "";
|
||||||
string Cam1OnePath = "";
|
string Cam1OnePath = "";
|
||||||
@ -160,12 +172,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)
|
||||||
{
|
{
|
||||||
string vBarPath = "D:\\Hisence\\202452915589671.jpg";
|
|
||||||
string vCam1OnePath = "D:\\Hisence\\4\\202452915596701.jpg";
|
|
||||||
string vCam1TwoPath = "D:\\Hisence\\4\\202452915599711.jpg";
|
|
||||||
|
|
||||||
|
string vBarPath = "D:\\Hisence\\类型\\Lp\\202452414231.jpg";
|
||||||
|
string vCam1OnePath = "D:\\Hisence\\类型\\Lp\\001.jpg";
|
||||||
|
string vCam1TwoPath = "D:\\Hisence\\类型\\Lp\\002.jpg";
|
||||||
string vModelChangePath = "D:\\Hisence\\config\\chinese.json";
|
string vModelChangePath = "D:\\Hisence\\config\\chinese.json";
|
||||||
if (File.Exists(vBarPath) && File.Exists(vCam1OnePath) && File.Exists(vCam1TwoPath) && File.Exists(vModelChangePath))
|
string LablePathstr = "D:\\Hisence\\ClassName.txt";//标签路径
|
||||||
|
string LablePathButtonstr = "D:\\Hisence\\ClassNameButton.txt";//标签路径
|
||||||
|
if (File.Exists(LablePathButtonstr) && File.Exists(vBarPath) && File.Exists(vCam1OnePath) && File.Exists(vCam1TwoPath) && File.Exists(vModelChangePath))
|
||||||
{
|
{
|
||||||
|
|
||||||
BarPath = vBarPath;
|
BarPath = vBarPath;
|
||||||
Cam1OnePath = vCam1OnePath;
|
Cam1OnePath = vCam1OnePath;
|
||||||
Cam1TwoPath = vCam1TwoPath;
|
Cam1TwoPath = vCam1TwoPath;
|
||||||
@ -177,17 +196,20 @@ namespace HisenceYoloDetection
|
|||||||
this.WindowState = FormWindowState.Maximized;
|
this.WindowState = FormWindowState.Maximized;
|
||||||
|
|
||||||
string Dectionstr = "D:\\Hisence\\best.onnx";
|
string Dectionstr = "D:\\Hisence\\best.onnx";
|
||||||
|
string DectionButtonstr = "D:\\Hisence\\HisenceButton.onnx";
|
||||||
string CountryStr = "D:\\Hisence\\config\\chinese.json";
|
string CountryStr = "D:\\Hisence\\config\\chinese.json";
|
||||||
if (File.Exists(Dectionstr) && File.Exists(CountryStr))
|
if (File.Exists(LablePathstr) && File.Exists(Dectionstr) && File.Exists(CountryStr) && File.Exists(DectionButtonstr))
|
||||||
{
|
{
|
||||||
|
LablePath = LablePathstr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("检测" + Dectionstr + " " + CountryStr + "模型有无");
|
MessageBox.Show("检测" + Dectionstr + " " + CountryStr + " " + LablePathstr + "模型有无");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//初始化检测驱动
|
//初始化检测驱动
|
||||||
simboObjectDetection.Load(Dectionstr, "CPU", "images", 640, 640);
|
simboObjectDetection.Load(Dectionstr, "CPU", "images", 640, 640);
|
||||||
|
simboObjectDetButton.Load(DectionButtonstr, "CPU", "images", 640, 640);
|
||||||
paddleOcrModelCountry.Load(CountryStr, "CPU");
|
paddleOcrModelCountry.Load(CountryStr, "CPU");
|
||||||
paddleOcrModel.Load(CountryStr, "CPU");
|
paddleOcrModel.Load(CountryStr, "CPU");
|
||||||
IfChangeLanguage = CountryStr;
|
IfChangeLanguage = CountryStr;
|
||||||
@ -195,7 +217,6 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
StartDecBtn.Enabled = false;
|
StartDecBtn.Enabled = false;
|
||||||
|
|
||||||
//myThread = new Thread(doWork);
|
|
||||||
myDelegateUI = new MyDelegateUI(initAll);//绑定委托
|
myDelegateUI = new MyDelegateUI(initAll);//绑定委托
|
||||||
|
|
||||||
|
|
||||||
@ -206,12 +227,6 @@ namespace HisenceYoloDetection
|
|||||||
//初始化PLC
|
//初始化PLC
|
||||||
melsecPLCTCPDriver.Start();
|
melsecPLCTCPDriver.Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//bool ismatch = IsMatchOcrText("WF3S7021BB", strMatListListOne);
|
|
||||||
//相机回调
|
|
||||||
|
|
||||||
melsecPLCTCPDriver.Heartbeat -= PLcHeratAdress;
|
melsecPLCTCPDriver.Heartbeat -= PLcHeratAdress;
|
||||||
melsecPLCTCPDriver.Heartbeat += PLcHeratAdress;
|
melsecPLCTCPDriver.Heartbeat += PLcHeratAdress;
|
||||||
|
|
||||||
@ -441,10 +456,6 @@ namespace HisenceYoloDetection
|
|||||||
DataSet dataSet = SQLiteHelper.Query("select * from XK_HisenceDet");
|
DataSet dataSet = SQLiteHelper.Query("select * from XK_HisenceDet");
|
||||||
dataGridView1.DataSource = dataSet.Tables[0];
|
dataGridView1.DataSource = dataSet.Tables[0];
|
||||||
|
|
||||||
// xKNow = GetModeFromBar("VWJ070633V0WW80F0120356");//从数据库中查询到这个条码的四轴的值
|
|
||||||
//string sql = "insert into XK_HisenceDet VALUES('" + xKNow.Type + "','" + xKNow.OcrBar + "'," + xKNow.MoveX + "," + xKNow.MoveY + "," +
|
|
||||||
// xKNow.MoveZ + ",'" + "123" + "',null," + xKNow.MoveTwoZ + "," + xKNow.MoveTwoY + "," + xKNow.MoveTwoZ + ", '" + DateTime.Now + "'," + 1 + ")";
|
|
||||||
//SQLiteHelper.ExecuteSql(sql);
|
|
||||||
Cam1.Start("Cam1");
|
Cam1.Start("Cam1");
|
||||||
if (Cam1.IfSuccess)
|
if (Cam1.IfSuccess)
|
||||||
{
|
{
|
||||||
@ -516,13 +527,14 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 全图洗衣机 裁剪之后 OCR识别的结果
|
/// 全图洗衣机 裁剪之后 OCR识别的结果
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="currentMatC">全图图片</param>
|
/// <param name="currentMatC">全图图片</param>
|
||||||
/// <param name="cam1TwoML">全局图片上的目标定位结果(包括定位矩形框)</param>
|
/// <param name="cam1TwoML">全局图片上的目标定位结果(包括定位矩形框)</param>
|
||||||
/// <param name="strMatListList">返回的定位框的结果</param>
|
/// <param name="strMatListList">返回的定位框的结果</param>
|
||||||
private void InsertSqlRunData(ref Mat currentMatC, MLResult cam1TwoML, ref List<string> strMatListList, ref PaddleOcrModel IOcrModel)
|
private void InsertSqlRunData2(ref Mat currentMatC, MLResult cam1TwoML, ref List<string> strMatListList, ref PaddleOcrModel IOcrModel)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
@ -547,14 +559,17 @@ namespace HisenceYoloDetection
|
|||||||
//OCR识别裁剪图片
|
//OCR识别裁剪图片
|
||||||
MLRequest reqcut = new MLRequest();
|
MLRequest reqcut = new MLRequest();
|
||||||
reqcut.currentMat = matroi.Clone();
|
reqcut.currentMat = matroi.Clone();
|
||||||
MLResultModel mLcut = IOcrModel.RunInferenceFixed(reqcut);
|
MLResult mLcut = IOcrModel.RunInferenceFixed(reqcut);
|
||||||
|
|
||||||
|
|
||||||
for (int j = 0; j < mLcut.ResultDetails.Count; j++)
|
for (int j = 0; j < mLcut.ResultDetails.Count; j++)
|
||||||
{
|
{
|
||||||
string jdetial = mLcut.ResultDetails[j].LabelDisplay;
|
string jdetial = mLcut.ResultDetails[j].LabelDisplay;
|
||||||
strMatListList.Add(jdetial);
|
string result = Regex.Replace(jdetial, "[ \\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::?`·、。,;,.;/\"‘’“”-]", "");
|
||||||
OcrTextinsert += jdetial + "##";
|
|
||||||
|
|
||||||
|
strMatListList.Add(result);
|
||||||
|
OcrTextinsert += result + "##";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -570,7 +585,6 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库中条码所对应的OCR文本是否与识别出来的文本相似
|
/// 数据库中条码所对应的OCR文本是否与识别出来的文本相似
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -581,12 +595,12 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
xKNow = GetModeFromBar(WashBar);//从数据库中查询到这个条码的四轴的值
|
|
||||||
List<string> strMatListListB = new List<string>();
|
List<string> strMatListListB = new List<string>();
|
||||||
if (xKNow.OcrText.Contains("##"))
|
if (WashBar.Contains("##"))
|
||||||
{
|
{
|
||||||
|
|
||||||
string[] sArray = Regex.Split(xKNow.OcrText, "##", RegexOptions.IgnoreCase);
|
string[] sArray = Regex.Split(WashBar, "##", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < sArray.Count(); i++)
|
for (int i = 0; i < sArray.Count(); i++)
|
||||||
@ -615,6 +629,45 @@ namespace HisenceYoloDetection
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsFuzzyMatchOcrText(string WashBar, List<string> DetMatstrList)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
List<string> strMatListListB = new List<string>();
|
||||||
|
if (WashBar.Contains("##"))
|
||||||
|
{
|
||||||
|
|
||||||
|
string[] sArray = Regex.Split(WashBar, "##", RegexOptions.IgnoreCase);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < sArray.Count(); i++)
|
||||||
|
{
|
||||||
|
if (sArray[i] != "")
|
||||||
|
{
|
||||||
|
strMatListListB.Add(sArray[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
var firstNotSecond = DetMatstrList.Intersect(strMatListListB, StringComparer.OrdinalIgnoreCase).ToList();
|
||||||
|
//var secondNotFirst = strMatListListB.Except(DetMatstrList, StringComparer.OrdinalIgnoreCase).ToList();
|
||||||
|
if (firstNotSecond.Count() > (strMatListListB.Count) / 2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实时移动模组
|
/// 实时移动模组
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -901,7 +954,7 @@ namespace HisenceYoloDetection
|
|||||||
myLog("第一次采集图像", DateTime.Now);
|
myLog("第一次采集图像", DateTime.Now);
|
||||||
//移动模组 读三次测距的地址 看是否往前移动
|
//移动模组 读三次测距的地址 看是否往前移动
|
||||||
MoveToP(8974, 0, 0);
|
MoveToP(8974, 0, 0);
|
||||||
|
// Thread.Sleep(2000);//删
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -922,17 +975,20 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
MoveToP(8974, 0, (int)(dismove));
|
MoveToP(8974, 0, (int)(dismove));
|
||||||
}
|
}
|
||||||
|
Thread.Sleep(2000);//删
|
||||||
Thread.Sleep(500);
|
Thread.Sleep(500);
|
||||||
Cam1.SnapshotCount = 0;
|
Cam1.SnapshotCount = 0;
|
||||||
Cam1.Snapshot();
|
Cam1.Snapshot();
|
||||||
|
IfCam2Triger = true;
|
||||||
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;
|
//currentXP = 54964;
|
||||||
|
//Thread.Sleep(2000);//删
|
||||||
MoveToP(54964, 0, (int)(dismove));
|
MoveToP(54964, 0, (int)(dismove));
|
||||||
Cam1.Snapshot();
|
Cam1.Snapshot();
|
||||||
MoveToP(8974, 0, 0);
|
MoveToP(8974, 0, 0);
|
||||||
@ -1004,7 +1060,9 @@ namespace HisenceYoloDetection
|
|||||||
//第一次拍照
|
//第一次拍照
|
||||||
if (SnapshotCount == 1)
|
if (SnapshotCount == 1)
|
||||||
{
|
{
|
||||||
// Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg");
|
// Mat mat = Cv2.ImRead("D:\\Hisence\\1\\202451716511.jpg");
|
||||||
|
//Mat mat = Cv2.ImRead("D:\\Hisence\\类型\\Lp\\2024517171911.jpg");
|
||||||
|
//Cam1ImgOne = mat;
|
||||||
Cam1ImgOne = cameraMat;
|
Cam1ImgOne = cameraMat;
|
||||||
IfCam1OneTriger = true;
|
IfCam1OneTriger = true;
|
||||||
originMatShow.Image = cameraMat.ToBitmap();
|
originMatShow.Image = cameraMat.ToBitmap();
|
||||||
@ -1015,7 +1073,9 @@ namespace HisenceYoloDetection
|
|||||||
//第二次拍照
|
//第二次拍照
|
||||||
if (SnapshotCount == 2)
|
if (SnapshotCount == 2)
|
||||||
{
|
{
|
||||||
// Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517164541.jpg");
|
// Mat mat = Cv2.ImRead("D:\\Hisence\\1\\2024517164541.jpg");
|
||||||
|
//Mat mat = Cv2.ImRead("D:\\Hisence\\类型\\Lp\\002.jpg");
|
||||||
|
//Cam1ImgTwo = mat;
|
||||||
Cam1ImgTwo = cameraMat;
|
Cam1ImgTwo = cameraMat;
|
||||||
|
|
||||||
IfCam1TwoTriger = true;
|
IfCam1TwoTriger = true;
|
||||||
@ -1065,7 +1125,7 @@ namespace HisenceYoloDetection
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void ReadyDetect()
|
public void ReadyDetect()
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run((Action)(() =>
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.Priority = ThreadPriority.Highest;
|
Thread.CurrentThread.Priority = ThreadPriority.Highest;
|
||||||
while (true)
|
while (true)
|
||||||
@ -1079,19 +1139,36 @@ namespace HisenceYoloDetection
|
|||||||
//OCR识别
|
//OCR识别
|
||||||
MLRequest req = new MLRequest();
|
MLRequest req = new MLRequest();
|
||||||
req.currentMat = Cam2ImgShowBar;
|
req.currentMat = Cam2ImgShowBar;
|
||||||
//req.currentMat = Cv2.ImRead("D:\\Hisence\\202452414231.jpg");
|
// req.currentMat = Cv2.ImRead("D:\\Hisence\\类型\\Lp\\202453015229201.jpg");
|
||||||
MLResultModel mL = paddleOcrModelCountry.RunInferenceFixed(req);
|
MLResult mL = paddleOcrModelCountry.RunInferenceFixed(req);
|
||||||
//数据库比对
|
//相机识别的字符串
|
||||||
xKNow = GetModeFromBar(mL.WashMachineBar);//从数据库中查询到这个条码的四轴的值
|
string IOcrBAr = "";
|
||||||
|
for (int v = 0; v < Enumerable.Count<DetectionResultDetail>(mL.ResultDetails); v++)
|
||||||
|
{
|
||||||
|
string iv = mL.ResultDetails[v].LabelDisplay;
|
||||||
|
string result = Regex.Replace(iv, "[ \\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::?`·、。,;,.;/\"‘’“”-]", "");
|
||||||
|
|
||||||
|
IOcrBAr += result;
|
||||||
|
}
|
||||||
|
//IOcrBAr = "LR1006G4SILVERWJ060480U0SW901N120105";
|
||||||
|
//根据条码数据库比对
|
||||||
|
xKNow = GetModeFromBar(IOcrBAr);//从数据库中查询到这个条码的四轴的值
|
||||||
|
List<XK_HisenceWord> xkWordList = ManagerModelHelper.GetModeWordFromBar(IOcrBAr);
|
||||||
|
if (xkWordList.Count() == 1)
|
||||||
|
{
|
||||||
|
xK_HisenceSQLWord = xkWordList[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (xKNow.OcrBar == null)
|
if (xKNow.OcrBar == null)
|
||||||
{
|
{
|
||||||
myLog("未匹配成功" + IfChangeLanguage, DateTime.Now);
|
myLog("未匹配成功" + IfChangeLanguage, DateTime.Now);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (xKNow.OcrText != "" && xKNow.Detect != "")
|
if ( xKNow.Detect != "")
|
||||||
{
|
{
|
||||||
//此时运行的洗衣机是和之前一个语言模型
|
//此时运行的洗衣机是和之前一个语言模型
|
||||||
if (IfChangeLanguage == mL.WashMachineBar)
|
if (IfChangeLanguage == IOcrBAr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1102,7 +1179,7 @@ namespace HisenceYoloDetection
|
|||||||
{
|
{
|
||||||
paddleOcrModel.Load(xKNow.OcrParm, "CPU");
|
paddleOcrModel.Load(xKNow.OcrParm, "CPU");
|
||||||
|
|
||||||
IfChangeLanguage = mL.WashMachineBar;
|
IfChangeLanguage = IOcrBAr;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1120,6 +1197,8 @@ namespace HisenceYoloDetection
|
|||||||
//相机1第二次拍照
|
//相机1第二次拍照
|
||||||
if (IfCam1TwoTriger && bBarTriger)
|
if (IfCam1TwoTriger && bBarTriger)
|
||||||
{
|
{
|
||||||
|
XK_HisenceWord xK_MatchDet = new XK_HisenceWord();
|
||||||
|
xK_MatchDet.TwoIFWhile = xK_HisenceSQLWord.TwoIFWhile;
|
||||||
AllDsums++;
|
AllDsums++;
|
||||||
//进行推理
|
//进行推理
|
||||||
MLRequest req = new MLRequest();
|
MLRequest req = new MLRequest();
|
||||||
@ -1127,46 +1206,57 @@ namespace HisenceYoloDetection
|
|||||||
req.ResizeWidth = 640;
|
req.ResizeWidth = 640;
|
||||||
req.ResizeHeight = 640;
|
req.ResizeHeight = 640;
|
||||||
req.Score = 0.3f;
|
req.Score = 0.3f;
|
||||||
req.in_lable_path = "D:\\Hisence\\ClassName.txt";//标签路径
|
req.in_lable_path = LablePath;//标签路径
|
||||||
req.confThreshold = 0.3f;//模型置信度
|
req.confThreshold = 0.3f;//模型置信度
|
||||||
req.iouThreshold = 0.4f;//检测IOU
|
req.iouThreshold = 0.4f;//检测IOU
|
||||||
req.out_node_name = "output";
|
req.out_node_name = "output";
|
||||||
MLResult mL = simboObjectDetection.RunInferenceFixed(req);
|
MLResult mL = simboObjectDetection.RunInferenceFixed(req);
|
||||||
|
MLResult mLButton = simboObjectDetButton.RunInferenceFixed(req);
|
||||||
|
|
||||||
DateTime dt = DateTime.Now;
|
DateTime dt = DateTime.Now;
|
||||||
//将所有的块裁剪 识别字符对比字符串
|
//将所有的块裁剪 识别字符对比字符串
|
||||||
List<string> strMatListListOne = new List<string>();
|
List<string> strMatListOne = new List<string>();
|
||||||
|
List<string> strMatFuzzyListOne = new List<string>();
|
||||||
Mat mResultCut = req.currentMat.Clone();
|
Mat mResultCut = req.currentMat.Clone();
|
||||||
|
Mat mCut = new Mat();
|
||||||
|
ManagerModelHelper.InsertSqlRunDataButton(false,ref mCut, ref mResultCut, mL, mLButton, ref xK_MatchDet, /*ref strMatListOne, ref strMatFuzzyListOne, */ref paddleOcrModel);
|
||||||
|
|
||||||
InsertSqlRunData(ref mResultCut, mL, ref strMatListListOne, ref paddleOcrModel);
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
//进行推理
|
//进行推理
|
||||||
MLRequest req2 = new MLRequest();
|
MLRequest req2 = new MLRequest();
|
||||||
req2.currentMat = Cam1ImgTwo;
|
req2.currentMat = Cam1ImgTwo;
|
||||||
req2.ResizeWidth = 640;
|
req2.ResizeWidth = 640;
|
||||||
req2.ResizeHeight = 640;
|
req2.ResizeHeight = 640;
|
||||||
req2.Score = 0.3f;
|
req2.Score = 0.3f;
|
||||||
req2.in_lable_path = "D:\\Hisence\\ClassName.txt";//标签路径
|
req2.in_lable_path = LablePath;//标签路径
|
||||||
req2.confThreshold = 0.3f;//模型置信度
|
req2.confThreshold = 0.3f;//模型置信度
|
||||||
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> strMatListListTwo = new List<string>();
|
List<string> strMatListTwo = new List<string>();
|
||||||
|
List<string> strMatFuzzyListTwo = new List<string>();
|
||||||
Mat mResultCut2 = req2.currentMat.Clone();
|
Mat mResultCut2 = req2.currentMat.Clone();
|
||||||
|
|
||||||
InsertSqlRunData(ref mResultCut2, mL2, ref strMatListListTwo, ref paddleOcrModel);
|
ManagerModelHelper.InsertSqlRunData(false, ref mResultCut2, mL2, ref xK_MatchDet, /*ref strMatListTwo, ref strMatFuzzyListTwo,*/ ref paddleOcrModel);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//执行比对 这个模型2和3一样
|
//执行定位数组块
|
||||||
string[] listLabels = xKNow.Detect.Split(",");
|
string[] listLabels = xKNow.Detect.Split(",");
|
||||||
|
|
||||||
MLResult MLsum = mL;
|
MLResult MLsum = mL;
|
||||||
for (int i = 0; i < mL2.ResultDetails.Count; i++)
|
for (int i = 0; i < mL2.ResultDetails.Count; i++)
|
||||||
{
|
{
|
||||||
MLsum.ResultDetails.Add(mL2.ResultDetails[i]);
|
MLsum.ResultDetails.Add((DetectionResultDetail)mL2.ResultDetails[i]);
|
||||||
}
|
}
|
||||||
string[] RealLabels = new string[MLsum.ResultDetails.Count];
|
string[] RealLabels = new string[MLsum.ResultDetails.Count];
|
||||||
string detstr = "";
|
string detstr = "";
|
||||||
@ -1183,47 +1273,23 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
///执行比对 小图
|
||||||
|
bool MatchStr = ManagerModelHelper.IsMatchSQLText(ref mCut, ref xK_HisenceSQLWord, ref xK_MatchDet);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IfCam1TwoTriger = false;
|
IfCam1TwoTriger = false;
|
||||||
bBarTriger = false;
|
bBarTriger = false;
|
||||||
bool isMatch = false;
|
|
||||||
string OcrTextinsert = "";
|
|
||||||
List<string> bingji = strMatListListOne.Union(strMatListListTwo).ToList();//并(全)集
|
|
||||||
for (int j = 0; j < bingji.Count; j++)
|
|
||||||
{
|
|
||||||
string jdetial = bingji[j];
|
|
||||||
OcrTextinsert += jdetial + "##";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ismatch = IsMatchOcrText(xKNow.OcrBar, bingji);
|
|
||||||
|
|
||||||
// 求差集
|
|
||||||
//var except = listLabels.Except(RealLabels);
|
if (MatchStr)
|
||||||
//Console.WriteLine("数组的差集:");
|
|
||||||
//if (except.Count() == 0)
|
|
||||||
//{
|
|
||||||
// // isMatch = true;
|
|
||||||
//}
|
|
||||||
//foreach (var num in except)
|
|
||||||
//{
|
|
||||||
// if ((num == "2" || num == "3") && except.Count() == 1)
|
|
||||||
// {
|
|
||||||
// // isMatch = true;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// // isMatch = false;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
if (isMatch)
|
|
||||||
{
|
{
|
||||||
OKDsums++;
|
OKDsums++;
|
||||||
myLog("匹配成功", DateTime.Now);
|
myLog("匹配成功", DateTime.Now);
|
||||||
//界面显示
|
//界面显示
|
||||||
string sql = "insert into XK_HisenceDet VALUES('" + xKNow.Type + "','" + xKNow.OcrBar + "'," + xKNow.MoveX + "," + xKNow.MoveY + "," +
|
InsertXK_HisenceWordMatchData(xK_MatchDet, true);
|
||||||
xKNow.MoveZ + ",'" + detstr + "','" + OcrTextinsert + "'," + xKNow.MoveTwoX + "," + xKNow.MoveTwoY + "," + xKNow.MoveTwoZ + ", '" + DateTime.Now + "'," + 1 + ")";
|
|
||||||
SQLiteHelper.ExecuteSql(sql);
|
|
||||||
OKOrNGShow.Image = OKbitmap;
|
OKOrNGShow.Image = OKbitmap;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1231,9 +1297,7 @@ namespace HisenceYoloDetection
|
|||||||
NGDsums++;
|
NGDsums++;
|
||||||
myLog("匹配失败", DateTime.Now);
|
myLog("匹配失败", DateTime.Now);
|
||||||
//界面显示
|
//界面显示
|
||||||
string sql = "insert into XK_HisenceDet VALUES('" + xKNow.Type + "','" + xKNow.OcrBar + "'," + xKNow.MoveX + "," + xKNow.MoveY + "," +
|
InsertXK_HisenceWordMatchData(xK_MatchDet, false);
|
||||||
xKNow.MoveZ + ",'" + detstr + "','" + OcrTextinsert + "'," + xKNow.MoveTwoX + "," + xKNow.MoveTwoY + "," + xKNow.MoveTwoZ + ", '" + DateTime.Now + "'," + 0 + ")";
|
|
||||||
SQLiteHelper.ExecuteSql(sql);
|
|
||||||
OKOrNGShow.Image = NGbitmap;
|
OKOrNGShow.Image = NGbitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1255,7 +1319,7 @@ namespace HisenceYoloDetection
|
|||||||
Thread.Sleep(10);
|
Thread.Sleep(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}));
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -1268,10 +1332,20 @@ namespace HisenceYoloDetection
|
|||||||
//从模板库里读
|
//从模板库里读
|
||||||
|
|
||||||
DataSet ds = SQLiteHelper.Query($"select * from XK_Hisence where OCRBar='{SkBar}' ");
|
DataSet ds = SQLiteHelper.Query($"select * from XK_Hisence where OCRBar='{SkBar}' ");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
XKHisence XK_hisence = new XKHisence();
|
XKHisence XK_hisence = new XKHisence();
|
||||||
|
|
||||||
//cbx.DataSource = ds;
|
//cbx.DataSource = ds;
|
||||||
DataTableReader rdr = ds.CreateDataReader();
|
DataTableReader rdr = ds.CreateDataReader();
|
||||||
|
|
||||||
|
//autxRecords = new List<AuxRecord>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//cbx.Rows.Clear();
|
//cbx.Rows.Clear();
|
||||||
while (rdr.Read())//读取表中数据
|
while (rdr.Read())//读取表中数据
|
||||||
|
|
||||||
@ -1290,6 +1364,7 @@ namespace HisenceYoloDetection
|
|||||||
XK_hisence.MoveTwoZ = (int)rdr["MoveTwoZ"];
|
XK_hisence.MoveTwoZ = (int)rdr["MoveTwoZ"];
|
||||||
XK_hisence.OcrParm = (string)rdr["OcrParm"];
|
XK_hisence.OcrParm = (string)rdr["OcrParm"];
|
||||||
XK_hisence.Language = (string)rdr["Language"];
|
XK_hisence.Language = (string)rdr["Language"];
|
||||||
|
XK_hisence.FuzzyOcrText = (string)rdr["FuzzyOcrText"];
|
||||||
//xKHisences.Add(XK_hisence);
|
//xKHisences.Add(XK_hisence);
|
||||||
return XK_hisence;
|
return XK_hisence;
|
||||||
//additem(XK_hisence);
|
//additem(XK_hisence);
|
||||||
@ -1482,10 +1557,7 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
private void InsertSqlBtn_Click(object sender, EventArgs e)
|
private void InsertSqlBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
InsertSqlFrm insertSqlFrm = new InsertSqlFrm();
|
|
||||||
// insertSqlFrm.
|
|
||||||
//insertSqlFrm.Parent = this;
|
|
||||||
insertSqlFrm.ShowDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefeshData_Click(object sender, EventArgs e)
|
private void RefeshData_Click(object sender, EventArgs e)
|
||||||
@ -1767,6 +1839,8 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
private void InsertBtn_Click(object sender, EventArgs e)
|
private void InsertBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string type = TypeBox.Text;
|
string type = TypeBox.Text;
|
||||||
@ -1778,6 +1852,20 @@ namespace HisenceYoloDetection
|
|||||||
string movetwoX = moveTwoXbox.Text;
|
string movetwoX = moveTwoXbox.Text;
|
||||||
string movetwoY = moveTwoYbox.Text;
|
string movetwoY = moveTwoYbox.Text;
|
||||||
string movetwoZ = moveTwoZbox.Text;
|
string movetwoZ = moveTwoZbox.Text;
|
||||||
|
bool whiteBan = true;
|
||||||
|
if (WhiteBanCbx.CheckState == CheckState.Checked)//选中
|
||||||
|
{
|
||||||
|
whiteBan = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (WhiteBanCbx.CheckState == CheckState.Unchecked)//没选中
|
||||||
|
{
|
||||||
|
whiteBan = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
whiteBan = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!Regex.IsMatch(moveX, @"^[0-9]+$"))
|
if (!Regex.IsMatch(moveX, @"^[0-9]+$"))
|
||||||
{
|
{
|
||||||
@ -1810,7 +1898,7 @@ namespace HisenceYoloDetection
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OcrBar != "" && Detect != "" && BarPath != "" && Cam1OnePath != "" && Cam1TwoPath != "" && ModelChangePath != "")
|
if (Detect != "" && BarPath != "" && Cam1OnePath != "" && Cam1TwoPath != "" && ModelChangePath != "")
|
||||||
{
|
{
|
||||||
int HmoveX = (int)Convert.ToInt64(moveX);
|
int HmoveX = (int)Convert.ToInt64(moveX);
|
||||||
int HmoveY = (int)Convert.ToInt64(moveY);
|
int HmoveY = (int)Convert.ToInt64(moveY);
|
||||||
@ -1818,7 +1906,7 @@ namespace HisenceYoloDetection
|
|||||||
int HmovetwoX = (int)Convert.ToInt64(movetwoX);
|
int HmovetwoX = (int)Convert.ToInt64(movetwoX);
|
||||||
int HmovetwoY = (int)Convert.ToInt64(movetwoY);
|
int HmovetwoY = (int)Convert.ToInt64(movetwoY);
|
||||||
int HmovetwoZ = (int)Convert.ToInt64(movetwoZ);
|
int HmovetwoZ = (int)Convert.ToInt64(movetwoZ);
|
||||||
InsertXK_Hisence(HmoveX, HmoveY, HmoveZ, HmovetwoX, HmovetwoY, HmovetwoZ);
|
InsertXK_Hisence(whiteBan,HmoveX, HmoveY, HmoveZ, HmovetwoX, HmovetwoY, HmovetwoZ);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1830,78 +1918,113 @@ namespace HisenceYoloDetection
|
|||||||
}
|
}
|
||||||
catch (Exception es)
|
catch (Exception es)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show(es.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void InsertXK_Hisence(int MoveX, int MoveY, int MoveZ, int MoveTwoX, int MoveTwoY, int MoveTwoZ)
|
public void InsertXK_Hisence(bool ifwhiteBan,int MoveX, int MoveY, int MoveZ, int MoveTwoX, int MoveTwoY, int MoveTwoZ)
|
||||||
{
|
{
|
||||||
PaddleOcrModel IpaddleOcrModel = new PaddleOcrModel();
|
PaddleOcrModel IpaddleOcrModel = new PaddleOcrModel();
|
||||||
IpaddleOcrModel.Load(ModelChangePath, "CPU");
|
IpaddleOcrModel.Load(ModelChangePath, "CPU");
|
||||||
|
|
||||||
|
//用中文文模型来识别条码
|
||||||
MLRequest OcrBari = new MLRequest();
|
MLRequest OcrBari = new MLRequest();
|
||||||
OcrBari.currentMat = Cv2.ImRead(BarPath);
|
OcrBari.currentMat = Cv2.ImRead(BarPath);
|
||||||
MLResultModel mL2 = IpaddleOcrModel.RunInferenceFixed(OcrBari);
|
MLResult mL2 = paddleOcrModelCountry.RunInferenceFixed(OcrBari);
|
||||||
|
|
||||||
string IOcrBAr = "";
|
string IOcrBAr = "";
|
||||||
for (int v = 0; v < mL2.ResultDetails.Count(); v++)
|
for (int v = 0; v < mL2.ResultDetails.Count(); v++)
|
||||||
{
|
{
|
||||||
string iv = mL2.ResultDetails[v].LabelDisplay;
|
string ivi = mL2.ResultDetails[v].LabelDisplay;
|
||||||
IOcrBAr += iv;
|
string result = Regex.Replace(ivi, "[ \\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::?`·、。,;,.;/\"‘’“”-]", "");
|
||||||
|
|
||||||
|
IOcrBAr += result;
|
||||||
}
|
}
|
||||||
|
OcrBarBox.Text = IOcrBAr;
|
||||||
|
XK_HisenceWord xkWord = new XK_HisenceWord();
|
||||||
|
xkWord.OcrBar = IOcrBAr;
|
||||||
|
xkWord.TwoIFWhile = ifwhiteBan;
|
||||||
using (StreamWriter sw = new StreamWriter("D://123.log", true))
|
using (StreamWriter sw = new StreamWriter("D://123.log", true))
|
||||||
{
|
{
|
||||||
sw.WriteLine("\n");
|
sw.WriteLine("\n");
|
||||||
sw.WriteLine(IOcrBAr);
|
sw.WriteLine(IOcrBAr);
|
||||||
sw.Flush();
|
sw.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//将所有的块裁剪 识别字符对比字符串
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//进行推理
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//从第一次拍照全图范围内目标检测然后进行OCR识别
|
||||||
MLRequest CamOneI = new MLRequest();
|
MLRequest CamOneI = new MLRequest();
|
||||||
CamOneI.currentMat = Cv2.ImRead(Cam1OnePath);
|
CamOneI.currentMat = Cv2.ImRead(Cam1OnePath);
|
||||||
CamOneI.ResizeWidth = 640;
|
CamOneI.ResizeWidth = 640;
|
||||||
CamOneI.ResizeHeight = 640;
|
CamOneI.ResizeHeight = 640;
|
||||||
CamOneI.Score = 0.3f;
|
CamOneI.Score = 0.3f;
|
||||||
CamOneI.in_lable_path = "D:\\Hisence\\ClassName.txt";//标签路径
|
CamOneI.in_lable_path = LablePath;//标签路径
|
||||||
CamOneI.confThreshold = 0.3f;//模型置信度
|
CamOneI.confThreshold = 0.3f;//模型置信度
|
||||||
CamOneI.iouThreshold = 0.4f;//检测IOU
|
CamOneI.iouThreshold = 0.4f;//检测IOU
|
||||||
CamOneI.out_node_name = "output";
|
CamOneI.out_node_name = "output";
|
||||||
MLResult mL3 = simboObjectDetection.RunInferenceFixed(CamOneI);
|
MLResult mL3 = simboObjectDetection.RunInferenceFixed(CamOneI);
|
||||||
if (mL3.IsSuccess)
|
MLResult mLButton = simboObjectDetButton.RunInferenceFixed(CamOneI);
|
||||||
{
|
//if (mL3.IsSuccess)
|
||||||
DateTime dt = DateTime.Now;
|
//{
|
||||||
mL3.ResultMap.Save("D:\\Hisence\\detImages\\" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "1result.jpg");
|
// DateTime dt = DateTime.Now;
|
||||||
|
// mL3.ResultMap.Save("D:\\Hisence\\detImages\\" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "1result.jpg");
|
||||||
|
|
||||||
}
|
//}
|
||||||
List<string> strMatListListOne = new List<string>();
|
List<string> strMatListOne = new List<string>();
|
||||||
|
List<string> strMatFuzzyListOne = new List<string>();
|
||||||
Mat mResultCut = CamOneI.currentMat.Clone();
|
Mat mResultCut = CamOneI.currentMat.Clone();
|
||||||
|
Mat mCut = new Mat();
|
||||||
|
ManagerModelHelper.InsertSqlRunDataButton(true,ref mCut, ref mResultCut, mL3, mLButton,ref xkWord, /*ref strMatListOne, ref strMatFuzzyListOne,*/ ref paddleOcrModel);
|
||||||
|
|
||||||
|
|
||||||
InsertSqlRunData(ref mResultCut, mL3, ref strMatListListOne, ref IpaddleOcrModel);
|
|
||||||
|
|
||||||
MLRequest CamTwoI = new MLRequest();
|
MLRequest CamTwoI = new MLRequest();
|
||||||
CamTwoI.currentMat = Cv2.ImRead(Cam1TwoPath);
|
CamTwoI.currentMat = Cv2.ImRead(Cam1TwoPath);
|
||||||
CamTwoI.ResizeWidth = 640;
|
CamTwoI.ResizeWidth = 640;
|
||||||
CamTwoI.ResizeHeight = 640;
|
CamTwoI.ResizeHeight = 640;
|
||||||
CamTwoI.Score = 0.3f;
|
CamTwoI.Score = 0.3f;
|
||||||
CamTwoI.in_lable_path = "D:\\Hisence\\ClassName.txt";//标签路径
|
CamTwoI.in_lable_path = LablePath;//标签路径
|
||||||
CamTwoI.confThreshold = 0.3f;//模型置信度
|
CamTwoI.confThreshold = 0.3f;//模型置信度
|
||||||
CamTwoI.iouThreshold = 0.4f;//检测IOU
|
CamTwoI.iouThreshold = 0.4f;//检测IOU
|
||||||
CamTwoI.out_node_name = "output";
|
CamTwoI.out_node_name = "output";
|
||||||
MLResult mL4 = simboObjectDetection.RunInferenceFixed(CamTwoI);
|
MLResult mL4 = simboObjectDetection.RunInferenceFixed(CamTwoI);
|
||||||
if (mL4.IsSuccess)
|
//if (mL4.IsSuccess)
|
||||||
{
|
//{
|
||||||
DateTime dt = DateTime.Now;
|
// DateTime dt = DateTime.Now;
|
||||||
mL4.ResultMap.Save("D:\\Hisence\\detImages\\" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
|
// mL4.ResultMap.Save("D:\\Hisence\\detImages\\" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
List<string> strMatListTwo = new List<string>();
|
||||||
|
List<string> strMatFuzzyListTwo = new List<string>();
|
||||||
List<string> strMatListListTwo = new List<string>();
|
|
||||||
Mat mResultCut2 = CamTwoI.currentMat.Clone();
|
Mat mResultCut2 = CamTwoI.currentMat.Clone();
|
||||||
|
|
||||||
InsertSqlRunData(ref mResultCut2, mL4, ref strMatListListTwo, ref IpaddleOcrModel);
|
ManagerModelHelper.InsertSqlRunData(true, ref mResultCut2, mL4, ref xkWord,/* ref strMatListTwo, ref strMatFuzzyListTwo,*/ ref paddleOcrModel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
InsertXKHisenceWordData( xkWord);//往关键字表中插入一条数据
|
||||||
//文本区域
|
//文本区域
|
||||||
string OcrTextinsert = "";
|
List<string> bingji = strMatListOne.Union(strMatListTwo).ToList();//并(全)集
|
||||||
List<string> bingji = strMatListListOne.Union(strMatListListTwo).ToList();//并(全)集
|
List<string> Fuzzybingji = strMatFuzzyListOne.Union(strMatFuzzyListTwo).ToList();//并(全)集
|
||||||
for (int j = 0; j < bingji.Count; j++)
|
string OcrTextone = bingji.Join("##");
|
||||||
{
|
string OcrTextTwo = Fuzzybingji.Join("##");
|
||||||
string jdetial = bingji[j];
|
|
||||||
OcrTextinsert += jdetial + "##";
|
//string OcrTextinsert = "";
|
||||||
}
|
//List<string> bingji = strMatListListOne.Union(strMatListListTwo).ToList();//并(全)集
|
||||||
|
//for (int j = 0; j < bingji.Count; j++)
|
||||||
|
//{
|
||||||
|
// string jdetial = bingji[j];
|
||||||
|
// OcrTextinsert += jdetial + "##";
|
||||||
|
//}
|
||||||
string detstr = "";
|
string detstr = "";
|
||||||
|
|
||||||
//找到识别区域
|
//找到识别区域
|
||||||
@ -1925,21 +2048,231 @@ namespace HisenceYoloDetection
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DateTime dt2 = DateTime.Now;
|
||||||
XKHisence xK = new XKHisence("1", IOcrBAr, MoveX, MoveY, MoveZ, detstr, OcrTextinsert, MoveTwoX, MoveTwoY, MoveTwoZ, ModelChangePath, "");
|
XKHisence xK = new XKHisence("1", IOcrBAr, MoveX, MoveY, MoveZ, detstr, OcrTextone, MoveTwoX, MoveTwoY, MoveTwoZ, ModelChangePath, "", OcrTextTwo);
|
||||||
|
//string log="D:\\Hisence\\detImages\\" + dt2.Year.ToString() + dt2.Month.ToString() + dt2.Day.ToString() + dt2.Hour.ToString() + dt2.Minute.ToString() + dt2.Millisecond.ToString() + "2result.log";
|
||||||
|
// using (StreamWriter sw=new StreamWriter(log, true))
|
||||||
|
// {
|
||||||
|
// // sw.WriteLine(xK.OcrBar+"\n");
|
||||||
|
// sw.WriteLine(xK.OcrText);
|
||||||
|
// sw.WriteLine(xK.FuzzyOcrText);
|
||||||
|
// }
|
||||||
//IpaddleOcrModel.FreeModel();
|
//IpaddleOcrModel.FreeModel();
|
||||||
|
|
||||||
string sql = "insert into XK_Hisence VALUES('" + xK.Type + "','" + xK.OcrBar + "'," + xK.MoveX + "," + xK.MoveY + "," + xK.MoveZ + ",'" + xK.Detect + "','" + xK.OcrText + "'," + xK.MoveTwoX + "," + xK.MoveTwoY + "," + xK.MoveTwoZ + ",'" + xK.OcrParm + "','" + xK.Language + "')";
|
string sql = "insert into XK_Hisence VALUES('" + xK.Type + "','" + xK.OcrBar + "'," + xK.MoveX + "," + xK.MoveY + "," + xK.MoveZ + ",'" + xK.Detect + "','" + xK.OcrText + "'," + xK.MoveTwoX + "," + xK.MoveTwoY + "," + xK.MoveTwoZ + ",'" + xK.OcrParm + "','" + xK.Language + "','" + xK.FuzzyOcrText + "')";
|
||||||
int i = SQLiteHelper.ExecuteSql(sql);
|
int i = SQLiteHelper.ExecuteSql(sql);
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
{
|
{
|
||||||
MessageBox.Show("插入一条数据");
|
MessageBox.Show("XK_Hisence插入一条数据");
|
||||||
}
|
}
|
||||||
//bool ismatch = IsMatchOcrText("WF3S7021BB", strMatListListOne);
|
//bool ismatch = IsMatchOcrText("WF3S7021BB", strMatListListOne);
|
||||||
//相机回调
|
//相机回调
|
||||||
}
|
}
|
||||||
|
public void InsertXKHisenceWordData(XK_HisenceWord xkWord)
|
||||||
|
{
|
||||||
|
StringBuilder strSql = new StringBuilder();
|
||||||
|
strSql.Append("insert into XK_HisenceWord(");
|
||||||
|
strSql.Append("OcrBar,OneblockPath,OneblockMainWord,OneblockText,TwoRect,TwoIFWhile,TwoblockPath,TwoblockMainWord,TwoblockText,ThreeblockPath," +
|
||||||
|
"ThreeblockMainWord,ThreeblockText,FourblockPath,FourblockMainWord,FourblockText,FiveblockPath,FiveblockMainWord,FiveblockText," +
|
||||||
|
"SixblockPath,SixblockMainWord,SixblockText,SevenblockPath,SevenblockMainWord,SevenblockText,EightblockPath,EightblockMainWord,EightblockText)");
|
||||||
|
strSql.Append(" values (");
|
||||||
|
strSql.Append("@OcrBar,@OneblockPath,@OneblockMainWord,@OneblockText,@TwoRect,@TwoIFWhile,@TwoblockPath,@TwoblockMainWord,@TwoblockText,@ThreeblockPath," +
|
||||||
|
"@ThreeblockMainWord,@ThreeblockText,@FourblockPath,@FourblockMainWord,@FourblockText,@FiveblockPath,@FiveblockMainWord,@FiveblockText," +
|
||||||
|
"@SixblockPath,@SixblockMainWord,@SixblockText,@SevenblockPath,@SevenblockMainWord,@SevenblockText,@EightblockPath,@EightblockMainWord,@EightblockText)");
|
||||||
|
SQLiteParameter[] parameters = {
|
||||||
|
new SQLiteParameter("@OcrBar", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@TwoRect",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoIFWhile",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockMainWord",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockText", DbType.String)};
|
||||||
|
|
||||||
|
parameters[0].Value = xkWord.OcrBar;
|
||||||
|
parameters[1].Value = xkWord.OneblockPath;
|
||||||
|
parameters[2].Value = xkWord.OneblockMainWord;
|
||||||
|
parameters[3].Value = xkWord.OneblockText;
|
||||||
|
|
||||||
|
parameters[4].Value = xkWord.TwoRect;
|
||||||
|
parameters[5].Value = xkWord.TwoIFWhile;
|
||||||
|
parameters[6].Value = xkWord.TwoblockPath;
|
||||||
|
parameters[7].Value = xkWord.TwoblockMainWord;
|
||||||
|
parameters[8].Value = xkWord.TwoblockText;
|
||||||
|
|
||||||
|
parameters[9].Value = xkWord.ThreeblockPath;
|
||||||
|
parameters[10].Value = xkWord.ThreeblockMainWord;
|
||||||
|
parameters[11].Value = xkWord.ThreeblockText;
|
||||||
|
|
||||||
|
parameters[12].Value = xkWord.FourblockPath;
|
||||||
|
parameters[13].Value = xkWord.FourblockMainWord;
|
||||||
|
parameters[14].Value = xkWord.FourblockText;
|
||||||
|
|
||||||
|
parameters[15].Value = xkWord.FiveblockPath;
|
||||||
|
parameters[16].Value = xkWord.FiveblockMainWord;
|
||||||
|
parameters[17].Value = xkWord.FiveblockText;
|
||||||
|
|
||||||
|
|
||||||
|
parameters[18].Value = xkWord.SixblockPath;
|
||||||
|
parameters[19].Value = xkWord.SixblockMainWord;
|
||||||
|
parameters[20].Value = xkWord.SixblockText;
|
||||||
|
|
||||||
|
parameters[21].Value = xkWord.SevenblockPath;
|
||||||
|
parameters[22].Value = xkWord.SevenblockMainWord;
|
||||||
|
parameters[23].Value = xkWord.SevenblockText;
|
||||||
|
|
||||||
|
parameters[24].Value = xkWord.EightblockPath;
|
||||||
|
parameters[25].Value = xkWord.EightblockMainWord;
|
||||||
|
parameters[26].Value = xkWord.EightblockText;
|
||||||
|
int iv = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters);
|
||||||
|
if (iv == 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("关键字XK_HisenceWord插入一条数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void InsertXK_HisenceWordMatchData(XK_HisenceWord xkWord,bool ifMatch)
|
||||||
|
{
|
||||||
|
StringBuilder strSql = new StringBuilder();
|
||||||
|
strSql.Append("insert into XK_HisenceWordMatch(");
|
||||||
|
strSql.Append("OcrBar,OneblockPath,OneblockMainWord,OneblockText,TwoRect,TwoIFWhile,TwoblockPath,TwoblockMainWord,TwoblockText,ThreeblockPath," +
|
||||||
|
"ThreeblockMainWord,ThreeblockText,FourblockPath,FourblockMainWord,FourblockText,FiveblockPath,FiveblockMainWord,FiveblockText," +
|
||||||
|
"SixblockPath,SixblockMainWord,SixblockText,SevenblockPath,SevenblockMainWord,SevenblockText,EightblockPath,EightblockMainWord,EightblockText,Datetime,IfMatch)");
|
||||||
|
strSql.Append(" values (");
|
||||||
|
strSql.Append("@OcrBar,@OneblockPath,@OneblockMainWord,@OneblockText,@TwoRect,@TwoIFWhile,@TwoblockPath,@TwoblockMainWord,@TwoblockText,@ThreeblockPath," +
|
||||||
|
"@ThreeblockMainWord,@ThreeblockText,@FourblockPath,@FourblockMainWord,@FourblockText,@FiveblockPath,@FiveblockMainWord,@FiveblockText," +
|
||||||
|
"@SixblockPath,@SixblockMainWord,@SixblockText,@SevenblockPath,@SevenblockMainWord,@SevenblockText,@EightblockPath,@EightblockMainWord,@EightblockText,@Datetime,@IfMatch)");
|
||||||
|
SQLiteParameter[] parameters = {
|
||||||
|
new SQLiteParameter("@OcrBar", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@OneblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@TwoRect",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoIFWhile",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockMainWord",DbType.String),
|
||||||
|
new SQLiteParameter("@TwoblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@ThreeblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@FourblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@FiveblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@SixblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@SevenblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockPath", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockMainWord", DbType.String),
|
||||||
|
new SQLiteParameter("@EightblockText", DbType.String),
|
||||||
|
new SQLiteParameter("@Datetime", DbType.String),
|
||||||
|
new SQLiteParameter("@IfMatch", DbType.Boolean)};
|
||||||
|
|
||||||
|
parameters[0].Value = xkWord.OcrBar;
|
||||||
|
parameters[1].Value = xkWord.OneblockPath;
|
||||||
|
parameters[2].Value = xkWord.OneblockMainWord;
|
||||||
|
parameters[3].Value = xkWord.OneblockText;
|
||||||
|
|
||||||
|
parameters[4].Value = xkWord.TwoRect;
|
||||||
|
parameters[5].Value = xkWord.TwoIFWhile;
|
||||||
|
parameters[6].Value = xkWord.TwoblockPath;
|
||||||
|
parameters[7].Value = xkWord.TwoblockMainWord;
|
||||||
|
parameters[8].Value = xkWord.TwoblockText;
|
||||||
|
|
||||||
|
parameters[9].Value = xkWord.ThreeblockPath;
|
||||||
|
parameters[10].Value = xkWord.ThreeblockMainWord;
|
||||||
|
parameters[11].Value = xkWord.ThreeblockText;
|
||||||
|
|
||||||
|
parameters[12].Value = xkWord.FourblockPath;
|
||||||
|
parameters[13].Value = xkWord.FourblockMainWord;
|
||||||
|
parameters[14].Value = xkWord.FourblockText;
|
||||||
|
|
||||||
|
parameters[15].Value = xkWord.FiveblockPath;
|
||||||
|
parameters[16].Value = xkWord.FiveblockMainWord;
|
||||||
|
parameters[17].Value = xkWord.FiveblockText;
|
||||||
|
|
||||||
|
|
||||||
|
parameters[18].Value = xkWord.SixblockPath;
|
||||||
|
parameters[19].Value = xkWord.SixblockMainWord;
|
||||||
|
parameters[20].Value = xkWord.SixblockText;
|
||||||
|
|
||||||
|
parameters[21].Value = xkWord.SevenblockPath;
|
||||||
|
parameters[22].Value = xkWord.SevenblockMainWord;
|
||||||
|
parameters[23].Value = xkWord.SevenblockText;
|
||||||
|
|
||||||
|
parameters[24].Value = xkWord.EightblockPath;
|
||||||
|
parameters[25].Value = xkWord.EightblockMainWord;
|
||||||
|
parameters[26].Value = xkWord.EightblockText;
|
||||||
|
|
||||||
|
parameters[27].Value = DateTime.Now;
|
||||||
|
parameters[28].Value = ifMatch;
|
||||||
|
int iv = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters);
|
||||||
|
if (iv == 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("关键字XK_HisenceWordMatch插入一条数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InsertXKHisenceDET(XKHisence xkWord)
|
||||||
|
{
|
||||||
|
StringBuilder strSql = new StringBuilder();
|
||||||
|
strSql.Append("insert into XKHisenceDet(");
|
||||||
|
strSql.Append("Type,OcrBar,MoveX,MoveY,MoveZ,Detect,OcrText,MoveTwoX,MoveTwoY,MoveTwoZ,Datetime,IfMatch)");
|
||||||
|
strSql.Append(" values (");
|
||||||
|
strSql.Append("@Type,@OcrBar,@MoveX,@MoveY,@MoveZ,@Detect,@OcrText,@MoveTwoX,@MoveTwoY,@MoveTwoZ,@Datetime,@IfMatch)");
|
||||||
|
SQLiteParameter[] parameters = {
|
||||||
|
new SQLiteParameter("@OcrBar", DbType.String),
|
||||||
|
new SQLiteParameter("@MoveX", DbType.String),
|
||||||
|
new SQLiteParameter("@MoveY", DbType.String),
|
||||||
|
new SQLiteParameter("@MoveZ", DbType.String),
|
||||||
|
new SQLiteParameter("@Detect",DbType.String),
|
||||||
|
new SQLiteParameter("@OcrText", DbType.String),
|
||||||
|
new SQLiteParameter("@MoveTwoX",DbType.String),
|
||||||
|
new SQLiteParameter("@MoveTwoY", DbType.String),
|
||||||
|
new SQLiteParameter("@MoveTwoZ", DbType.String),
|
||||||
|
new SQLiteParameter("@Datetime", DbType.String),
|
||||||
|
new SQLiteParameter("@IfMatch", DbType.String)};
|
||||||
|
parameters[0].Value = xkWord.OcrBar;
|
||||||
|
parameters[1].Value = xkWord.MoveX;
|
||||||
|
parameters[2].Value = xkWord.MoveY;
|
||||||
|
parameters[3].Value = xkWord.MoveZ;
|
||||||
|
|
||||||
|
parameters[4].Value = xkWord.Detect;
|
||||||
|
parameters[5].Value = xkWord.OcrText;
|
||||||
|
parameters[6].Value = xkWord.MoveTwoX;
|
||||||
|
parameters[7].Value = xkWord.MoveTwoY;
|
||||||
|
|
||||||
|
parameters[8].Value = xkWord.MoveTwoZ;
|
||||||
|
|
||||||
|
int iv = SQLiteHelper.ExecuteSql(strSql.ToString(), parameters);
|
||||||
|
if (iv == 1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("关键字XK_HisenceWord插入一条数据");
|
||||||
|
}
|
||||||
|
}
|
||||||
private void queryALLBtn_Click(object sender, EventArgs e)
|
private void queryALLBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -2043,5 +2376,10 @@ namespace HisenceYoloDetection
|
|||||||
tbExposure2.Text = Cam2.dvpGetExposure().ToString();
|
tbExposure2.Text = Cam2.dvpGetExposure().ToString();
|
||||||
tbGain2.Text = Cam2.dvpGetAnalogGain().ToString();
|
tbGain2.Text = Cam2.dvpGetAnalogGain().ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void panel2_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
479
HisenceYoloDetection/ManagerModelHelper.cs
Normal file
479
HisenceYoloDetection/ManagerModelHelper.cs
Normal file
@ -0,0 +1,479 @@
|
|||||||
|
using OpenCvSharp;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data.SQLite;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using XKRS.Device.SimboVision.SimboHelper;
|
||||||
|
using System.Diagnostics.Eventing.Reader;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
using System.Drawing;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
|
||||||
|
namespace HisenceYoloDetection
|
||||||
|
{
|
||||||
|
|
||||||
|
public static class ManagerModelHelper
|
||||||
|
{
|
||||||
|
public static string RootPath = "D:\\Hisence\\SQLImages\\";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全图洗衣机 裁剪之后 OCR识别的结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="saveimage"></param>
|
||||||
|
/// <param name="CutMat"></param>
|
||||||
|
/// <param name="currentMatC">全图图片</param>
|
||||||
|
/// <param name="cam1TwoML">全局图片上的目标定位结果(包括定位矩形框)</param>
|
||||||
|
/// <param name="cam1Button"></param>
|
||||||
|
/// <param name="xK_HisenceWord"></param>
|
||||||
|
/// <param name="strMatList">返回的定位框的结果</param>
|
||||||
|
/// <param name="strMatRefList"></param>
|
||||||
|
/// <param name="IOcrModel"></param>
|
||||||
|
public static void InsertSqlRunDataButton(bool saveimage,ref Mat CutMat, ref Mat currentMatC, MLResult cam1TwoML, MLResult cam1Button, ref XK_HisenceWord xK_HisenceWord, /*ref List<string> strMatList, ref List<string> strMatRefList, */ref PaddleOcrModel IOcrModel)
|
||||||
|
{
|
||||||
|
#if true
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
|
||||||
|
Mat mResultCut = currentMatC.Clone();
|
||||||
|
Rect areaBlack=new Rect();
|
||||||
|
//旋钮的位置
|
||||||
|
if (cam1Button.ResultDetails.Count == 1)
|
||||||
|
{
|
||||||
|
Mat mResultCuti = mResultCut.Clone();
|
||||||
|
int rectsx = cam1Button.ResultDetails[0].Rect.X;
|
||||||
|
int rectsy = cam1Button.ResultDetails[0].Rect.Y;
|
||||||
|
int rectsWidth = cam1Button.ResultDetails[0].Rect.Width;
|
||||||
|
int rectsHeight = cam1Button.ResultDetails[0].Rect.Height;
|
||||||
|
areaBlack = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
||||||
|
|
||||||
|
}
|
||||||
|
for (int i = 0; i < cam1TwoML.ResultDetails.Count; i++)
|
||||||
|
{
|
||||||
|
Mat mResultCuti = mResultCut.Clone();
|
||||||
|
int rectsx = cam1TwoML.ResultDetails[i].Rect.X;
|
||||||
|
int rectsy = cam1TwoML.ResultDetails[i].Rect.Y;
|
||||||
|
int rectsWidth = cam1TwoML.ResultDetails[i].Rect.Width;
|
||||||
|
int rectsHeight = cam1TwoML.ResultDetails[i].Rect.Height;
|
||||||
|
|
||||||
|
string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay;
|
||||||
|
Rect area2 = new Rect();
|
||||||
|
if (blockIndex == "2")//根据旋钮扩大范围
|
||||||
|
{
|
||||||
|
areaBlack.X -= rectsx;
|
||||||
|
areaBlack.Y -= rectsy;
|
||||||
|
area2 = areaBlack;
|
||||||
|
string TwoRectStr= CheckDiffSciHelper.rectChangeStr(area2);
|
||||||
|
xK_HisenceWord.TwoRect = TwoRectStr;
|
||||||
|
//Mat matCutblack = new Mat(mResultCuti, area2);
|
||||||
|
//if((bool)xK_HisenceWord.TwoIFWhile)
|
||||||
|
//{
|
||||||
|
// matCutblack.SetTo(Scalar.Black);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// matCutblack.SetTo(Scalar.Black);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//rectsx -= rectsWidth;
|
||||||
|
//rectsy -= 50;
|
||||||
|
//rectsWidth = rectsWidth + 2 * rectsWidth;
|
||||||
|
//rectsHeight = rectsHeight + 2 + 50;
|
||||||
|
|
||||||
|
Rect area = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
||||||
|
|
||||||
|
Mat matCut = new Mat(mResultCuti, area);
|
||||||
|
CutMat = matCut.Clone();
|
||||||
|
|
||||||
|
//Mat TwoCut = new Mat(mResultCuti, area2);
|
||||||
|
//TwoCut.SetTo(Scalar.Black);
|
||||||
|
//OCR识别裁剪图片
|
||||||
|
MLRequest reqcut = new MLRequest();
|
||||||
|
reqcut.currentMat = matCut.Clone();
|
||||||
|
MLResult mLCut = IOcrModel.RunInferenceFixed(reqcut);
|
||||||
|
|
||||||
|
//if (mLCut.IsSuccess)
|
||||||
|
//{
|
||||||
|
// DateTime dt = DateTime.Now;
|
||||||
|
// mLCut.ResultMap.Save("D:\\Hisence\\detImages\\OCR" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
BlockChangeFun(saveimage, blockIndex, ref matCut, ref mLCut, ref xK_HisenceWord);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Rect area = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
||||||
|
|
||||||
|
Mat matCut = new Mat(mResultCuti, area);
|
||||||
|
|
||||||
|
//OCR识别裁剪图片
|
||||||
|
MLRequest reqcut = new MLRequest();
|
||||||
|
reqcut.currentMat = matCut.Clone();
|
||||||
|
MLResult mLCut = IOcrModel.RunInferenceFixed(reqcut);
|
||||||
|
//if (mLCut.IsSuccess)
|
||||||
|
//{
|
||||||
|
// DateTime dt = DateTime.Now;
|
||||||
|
// mLCut.ResultMap.Save("D:\\Hisence\\detImages\\OCR" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
BlockChangeFun(saveimage, blockIndex, ref matCut, ref mLCut, ref xK_HisenceWord);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//插入数据库
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//}
|
||||||
|
//catch (Exception ex)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 全图洗衣机 裁剪之后 OCR识别的结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="currentMatC">全图图片</param>
|
||||||
|
/// <param name="cam1TwoML">全局图片上的目标定位结果(包括定位矩形框)</param>
|
||||||
|
/// <param name="strMatList">返回的定位框的结果</param>
|
||||||
|
public static void InsertSqlRunData(bool saveimage, ref Mat currentMatC, MLResult cam1TwoML, ref XK_HisenceWord xK_HisenceWord, /*ref List<string> strMatList, ref List<string> strMatRefList,*/ ref PaddleOcrModel IOcrModel)
|
||||||
|
{
|
||||||
|
#if true
|
||||||
|
//try
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
Mat mResultCut = currentMatC.Clone();
|
||||||
|
|
||||||
|
for (int i = 0; i < cam1TwoML.ResultDetails.Count; i++)
|
||||||
|
{
|
||||||
|
Mat mResultCuti = mResultCut.Clone();
|
||||||
|
int rectsx = cam1TwoML.ResultDetails[i].Rect.X;
|
||||||
|
int rectsy = cam1TwoML.ResultDetails[i].Rect.Y;
|
||||||
|
int rectsWidth = cam1TwoML.ResultDetails[i].Rect.Width;
|
||||||
|
int rectsHeight = cam1TwoML.ResultDetails[i].Rect.Height;
|
||||||
|
string blockIndex = cam1TwoML.ResultDetails[i].LabelDisplay;
|
||||||
|
|
||||||
|
|
||||||
|
Rect area = new Rect(rectsx, rectsy, rectsWidth, rectsHeight);
|
||||||
|
Mat matCut = new Mat(mResultCuti, area);
|
||||||
|
|
||||||
|
//OCR识别裁剪图片
|
||||||
|
MLRequest reqcut = new MLRequest();
|
||||||
|
reqcut.currentMat = matCut.Clone();
|
||||||
|
MLResult mLCut = IOcrModel.RunInferenceFixed(reqcut);
|
||||||
|
//if (mLCut.IsSuccess)
|
||||||
|
//{
|
||||||
|
// DateTime dt = DateTime.Now;
|
||||||
|
// mLCut.ResultMap.Save("D:\\Hisence\\detImages\\OCR" + dt.Year.ToString() + dt.Month.ToString() + dt.Day.ToString() + dt.Hour.ToString() + dt.Minute.ToString() + dt.Millisecond.ToString() + "2result.jpg");
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
BlockChangeFun(saveimage, blockIndex, ref matCut, ref mLCut, ref xK_HisenceWord);
|
||||||
|
//插入数据库
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//}
|
||||||
|
//catch (Exception ex)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="saveimage">是否保存</param>
|
||||||
|
/// <param name="blockIndex">裁剪的一块索引</param>
|
||||||
|
/// <param name="CutBlockMat">裁剪的一张图片</param>
|
||||||
|
/// <param name="mLcut">裁剪图片的一些信息</param>
|
||||||
|
/// <param name="xK_HisenceWord">要存储入数据库的东西</param>
|
||||||
|
public static void BlockChangeFun(bool saveimage, string blockIndex, ref Mat CutBlockMat, ref MLResult mLcut, ref XK_HisenceWord xK_HisenceWord)
|
||||||
|
{
|
||||||
|
string ocrBar = xK_HisenceWord.OcrBar;
|
||||||
|
//存放关键字和所有字符串
|
||||||
|
List<string> OcrTextinsert = new List<string>();//存放关键字
|
||||||
|
List<string> OcrFuzzyTextInsert = new List<string>();//存放模糊字
|
||||||
|
string CutSavePath = "";
|
||||||
|
CombineMessage(saveimage, ocrBar, blockIndex, ref CutBlockMat, ref mLcut, ref OcrTextinsert, ref OcrFuzzyTextInsert, ref CutSavePath);
|
||||||
|
|
||||||
|
switch (blockIndex)
|
||||||
|
{
|
||||||
|
case "1"://完全匹配 重量信息
|
||||||
|
{
|
||||||
|
xK_HisenceWord.OneblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.OneblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.OneblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "2"://控制面板 匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.TwoblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.TwoblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.TwoblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "3"://第三块板匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.ThreeblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.ThreeblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.ThreeblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "4"://贴纸匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.FourblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.FourblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.FourblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "5"://贴纸匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.FiveblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.FiveblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.FiveblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "6"://贴纸匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.SixblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.SixblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.SixblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "7"://贴纸匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.SevenblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.SevenblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.SevenblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "8"://贴纸匹配
|
||||||
|
{
|
||||||
|
xK_HisenceWord.EightblockPath = CutSavePath;
|
||||||
|
xK_HisenceWord.EightblockMainWord = OcrTextinsert.Join("##");
|
||||||
|
xK_HisenceWord.EightblockText = OcrFuzzyTextInsert.Join("##");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="saveimage">是否保存本地图片</param>
|
||||||
|
/// <param name="OcrBar">唯一条形码</param>
|
||||||
|
/// <param name="blockIndex">区块号</param>
|
||||||
|
/// <param name="CutBlockMat">图像</param>
|
||||||
|
/// <param name="mLcut">图像上的数据</param>
|
||||||
|
/// <param name="OcrTextinsert">关键字</param>
|
||||||
|
/// <param name="OcrFuzzyTextInsert">所有字</param>
|
||||||
|
/// <param name="cutSavepath">图片保存路径</param>
|
||||||
|
public static void CombineMessage(bool saveimage, string OcrBar, string blockIndex, ref Mat CutBlockMat, ref MLResult mLcut, ref List<string> OcrTextinsert, ref List<string> OcrFuzzyTextInsert, ref string cutSavepath)
|
||||||
|
{
|
||||||
|
//在这里面找到带数字的关键字 将所有字也存放在数据库中
|
||||||
|
for (int j = 0; j < mLcut.ResultDetails.Count; j++)
|
||||||
|
{
|
||||||
|
string jdetial = mLcut.ResultDetails[j].LabelDisplay;
|
||||||
|
string result = Regex.Replace(jdetial, "[ \\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::?`·、。,;,.;/\"‘’“”-]", "");
|
||||||
|
if (Regex.IsMatch(result, @"\d"))
|
||||||
|
{
|
||||||
|
OcrTextinsert.Add(result);
|
||||||
|
}
|
||||||
|
OcrFuzzyTextInsert.Add(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveimage)
|
||||||
|
{
|
||||||
|
DateTime dt = DateTime.Now;
|
||||||
|
string namecutSavepath = OcrBar + "\\" + blockIndex + "\\" + OcrBar + "result.jpg";
|
||||||
|
|
||||||
|
cutSavepath = Path.Combine(RootPath, namecutSavepath);
|
||||||
|
//得到目录
|
||||||
|
if (!Directory.Exists(Path.GetDirectoryName(cutSavepath)))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(Path.GetDirectoryName(cutSavepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
Cv2.ImWrite(cutSavepath, CutBlockMat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<XK_HisenceWord> GetModeWordFromBar(string SkBar)
|
||||||
|
{
|
||||||
|
List<XK_HisenceWord> cslist = SQLiteHelper.ExecuteQuery($"select * from XK_HisenceWord where OCRBar='{SkBar}' ", r => new XK_HisenceWord
|
||||||
|
{
|
||||||
|
OcrBar = r["OcrBar"].ToString(),
|
||||||
|
OneblockPath = r["OneblockPath"].ToString(),
|
||||||
|
OneblockMainWord = r["OneblockMainWord"].ToString(),
|
||||||
|
OneblockText = r["OneblockText"].ToString(),
|
||||||
|
TwoRect = r["TwoRect"].ToString(),
|
||||||
|
TwoIFWhile = r["TwoIFWhile"].ToBool(),
|
||||||
|
TwoblockPath = r["TwoblockPath"].ToString(),
|
||||||
|
TwoblockMainWord = r["TwoblockMainWord"].ToString(),
|
||||||
|
TwoblockText = r["TwoblockText"].ToString(),
|
||||||
|
ThreeblockPath = r["ThreeblockPath"].ToString(),
|
||||||
|
ThreeblockMainWord = r["ThreeblockMainWord"].ToString(),
|
||||||
|
ThreeblockText = r["ThreeblockText"].ToString(),
|
||||||
|
FourblockPath = r["FourblockPath"].ToString(),
|
||||||
|
FourblockMainWord = r["FourblockMainWord"].ToString(),
|
||||||
|
FourblockText = r["FourblockText"].ToString(),
|
||||||
|
FiveblockPath = r["FiveblockPath"].ToString(),
|
||||||
|
FiveblockMainWord = r["FiveblockMainWord"].ToString(),
|
||||||
|
FiveblockText = r["FiveblockText"].ToString(),
|
||||||
|
SixblockPath = r["SixblockPath"].ToString(),
|
||||||
|
SixblockMainWord = r["SixblockMainWord"].ToString(),
|
||||||
|
SixblockText = r["SixblockText"].ToString(),
|
||||||
|
SevenblockPath = r["SevenblockPath"].ToString(),
|
||||||
|
SevenblockMainWord = r["SevenblockMainWord"].ToString(),
|
||||||
|
SevenblockText = r["SevenblockText"].ToString(),
|
||||||
|
EightblockPath = r["EightblockPath"].ToString(),
|
||||||
|
EightblockMainWord = r["EightblockMainWord"].ToString(),
|
||||||
|
EightblockText = r["EightblockText"].ToString()
|
||||||
|
|
||||||
|
});
|
||||||
|
return cslist;
|
||||||
|
|
||||||
|
}
|
||||||
|
public static bool IsMatchSQLText(ref Mat detMat, ref XK_HisenceWord XKSQL, ref XK_HisenceWord XKDet)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string TwoRectstr=XKSQL.TwoRect;
|
||||||
|
string oneBlockWordSql = XKSQL.OneblockMainWord;
|
||||||
|
string twoBlockWordSql = XKSQL.TwoblockMainWord;
|
||||||
|
string threeBlockWordSql = XKSQL.ThreeblockMainWord;
|
||||||
|
string fourBlockWordSql = XKSQL.FourblockMainWord;
|
||||||
|
string fiveBlockWordSql = XKSQL.FiveblockMainWord;
|
||||||
|
string sixBlockWordSql = XKSQL.SixblockMainWord;
|
||||||
|
string sevenBlockWordSql = XKSQL.SevenblockMainWord;
|
||||||
|
string eightBlockWordSql = XKSQL.EightblockMainWord;
|
||||||
|
|
||||||
|
string oneBlockWordDet = XKDet.OneblockMainWord;
|
||||||
|
string twoBlockWordDet = XKDet.TwoblockMainWord;
|
||||||
|
string threeBlockWordDet = XKDet.ThreeblockMainWord;
|
||||||
|
string fourBlockWordDet = XKDet.FourblockMainWord;
|
||||||
|
string fiveBlockWordDet = XKDet.FiveblockMainWord;
|
||||||
|
string sixBlockWordDet = XKDet.SixblockMainWord;
|
||||||
|
string sevenBlockWordDet = XKDet.SevenblockMainWord;
|
||||||
|
string eightBlockWordDet = XKDet.EightblockMainWord;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool OneIF = isMatchStr(oneBlockWordSql, oneBlockWordDet);
|
||||||
|
bool TwoIF = isMatchStr(twoBlockWordSql, twoBlockWordDet);
|
||||||
|
bool ThreeIF = isMatchStr(threeBlockWordSql, threeBlockWordDet);
|
||||||
|
bool FourIF = isMatchStr(fourBlockWordSql, fourBlockWordDet);
|
||||||
|
bool FiveIF = isMatchStr(fiveBlockWordSql, fiveBlockWordDet);
|
||||||
|
bool SixIF = isMatchStr(sixBlockWordSql, sixBlockWordDet);
|
||||||
|
bool SenvenIF = isMatchStr(sevenBlockWordSql, sevenBlockWordDet);
|
||||||
|
bool EightIF = isMatchStr(eightBlockWordSql, eightBlockWordDet);
|
||||||
|
//第二快 卷积匹配
|
||||||
|
string PathSql = XKSQL.TwoblockPath;
|
||||||
|
//
|
||||||
|
Rect rectsql = CheckDiffSciHelper.strChangeRect(TwoRectstr);
|
||||||
|
Rect rectDet = CheckDiffSciHelper.strChangeRect(XKDet.TwoRect);
|
||||||
|
bool twoif2 = CheckDiffSciHelper.CheckDiffSci(PathSql, detMat, rectsql, rectDet,(bool)XKSQL.TwoIFWhile, "D://");
|
||||||
|
//第三块区域一直都是false
|
||||||
|
if (OneIF && TwoIF && ThreeIF && FourIF && FiveIF && SixIF && SenvenIF && EightIF&& twoif2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static bool isMatchStr(string SqlText, string DetText)
|
||||||
|
{
|
||||||
|
if (SqlText.Contains("##") && DetText.Contains("##"))
|
||||||
|
{
|
||||||
|
// 计算Levenshtein距离
|
||||||
|
int distance = LevenshteinDistance(SqlText, DetText);
|
||||||
|
|
||||||
|
// 计算相似度(相似度等于1减去标准化的Levenshtein距离)
|
||||||
|
double similarity = 1 - ((double)distance / Math.Max(SqlText.Length, DetText.Length));
|
||||||
|
bool areEqual = false;
|
||||||
|
if (similarity<0.5)
|
||||||
|
{
|
||||||
|
areEqual = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
areEqual = true;
|
||||||
|
}
|
||||||
|
//string[] sArraysql = Regex.Split(SqlText, "##", RegexOptions.IgnoreCase);
|
||||||
|
//string[] sArraydet = Regex.Split(DetText, "##", RegexOptions.IgnoreCase);
|
||||||
|
//bool areEqual = sArraysql.OrderBy(x => x).SequenceEqual(sArraydet.OrderBy(x => x));
|
||||||
|
return areEqual;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ((SqlText == "" || SqlText == null) && (DetText == "" || DetText == null))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 计算Levenshtein距离
|
||||||
|
static int LevenshteinDistance(string string1, string string2)
|
||||||
|
{
|
||||||
|
int[,] dp = new int[string1.Length + 1, string2.Length + 1];
|
||||||
|
|
||||||
|
for (int i = 0; i <= string1.Length; i++)
|
||||||
|
dp[i, 0] = i;
|
||||||
|
|
||||||
|
for (int j = 0; j <= string2.Length; j++)
|
||||||
|
dp[0, j] = j;
|
||||||
|
|
||||||
|
for (int i = 1; i <= string1.Length; i++)
|
||||||
|
{
|
||||||
|
for (int j = 1; j <= string2.Length; j++)
|
||||||
|
{
|
||||||
|
int cost = string1[i - 1] == string2[j - 1] ? 0 : 1;
|
||||||
|
|
||||||
|
dp[i, j] = Math.Min(Math.Min(dp[i - 1, j] + 1, dp[i, j - 1] + 1), dp[i - 1, j - 1] + cost);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return dp[string1.Length, string2.Length];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
@ -111,7 +111,7 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[HandleProcessCorruptedStateExceptions]
|
[HandleProcessCorruptedStateExceptions]
|
||||||
public MLResultModel RunInference(MLRequest req)
|
public MLResult RunInference(MLRequest req)
|
||||||
{
|
{
|
||||||
#if USE_MULTI_THREAD
|
#if USE_MULTI_THREAD
|
||||||
MLResult mlResult = null;
|
MLResult mlResult = null;
|
||||||
@ -139,7 +139,7 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ConvertJsonResult(string json, ref MLResultModel result)
|
private void ConvertJsonResult(string json, ref MLResult result)
|
||||||
{
|
{
|
||||||
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
|
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
|
||||||
//
|
//
|
||||||
@ -199,9 +199,9 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
|
|
||||||
|
|
||||||
[HandleProcessCorruptedStateExceptions]
|
[HandleProcessCorruptedStateExceptions]
|
||||||
public MLResultModel RunInferenceFixed(MLRequest req)
|
public MLResult RunInferenceFixed(MLRequest req)
|
||||||
{
|
{
|
||||||
MLResultModel mlResult = new MLResultModel();
|
MLResult mlResult = new MLResult();
|
||||||
Mat originMat = new Mat();
|
Mat originMat = new Mat();
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -237,7 +237,7 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
mlResult.ResultMap = BitmapConverter.ToBitmap(maskWeighted);//4ms
|
mlResult.ResultMap = BitmapConverter.ToBitmap(maskWeighted);//4ms
|
||||||
|
|
||||||
//将字节数组转换为字符串
|
//将字节数组转换为字符串
|
||||||
mlResult.ResultMap = originMat.ToBitmap();//4ms
|
//mlResult.ResultMap = originMat.ToBitmap();//4ms
|
||||||
string strGet = System.Text.Encoding.Default.GetString(labellist, 0, labellist.Length);
|
string strGet = System.Text.Encoding.Default.GetString(labellist, 0, labellist.Length);
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
[HandleProcessCorruptedStateExceptions]
|
[HandleProcessCorruptedStateExceptions]
|
||||||
public MLResultModel RunInference(MLRequest req)
|
public MLResult RunInference(MLRequest req)
|
||||||
{
|
{
|
||||||
#if USE_MULTI_THREAD
|
#if USE_MULTI_THREAD
|
||||||
MLResult mlResult = null;
|
MLResult mlResult = null;
|
||||||
@ -139,7 +139,7 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ConvertJsonResult(string json, ref MLResultModel result)
|
private void ConvertJsonResult(string json, ref MLResult result)
|
||||||
{
|
{
|
||||||
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
|
// json = "{\"FastDetResult\":[{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654843,\"rect\":[175,99,110,594]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654589,\"rect\":[2608,19,104,661]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.654285,\"rect\":[1275,19,104,662]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.620762,\"rect\":[1510,95,107,600]},{\"cls_id\":0,\"cls\":\"liewen\",\"fScore\":0.617812,\"rect\":[2844,93,106,602]}]}";
|
||||||
//
|
//
|
||||||
@ -220,9 +220,9 @@ namespace XKRS.Device.SimboVision.SimboHelper
|
|||||||
|
|
||||||
|
|
||||||
[HandleProcessCorruptedStateExceptions]
|
[HandleProcessCorruptedStateExceptions]
|
||||||
public MLResultModel RunInferenceFixed(MLRequest req)
|
public MLResult RunInferenceFixed(MLRequest req)
|
||||||
{
|
{
|
||||||
MLResultModel mlResult = new MLResultModel();
|
MLResult mlResult = new MLResult();
|
||||||
Mat originMat = new Mat();
|
Mat originMat = new Mat();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -3,6 +3,7 @@ namespace HisenceYoloDetection
|
|||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
static MainForm? mainFrm = null;
|
static MainForm? mainFrm = null;
|
||||||
|
static Form1? form1 = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -17,6 +18,8 @@ namespace HisenceYoloDetection
|
|||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
mainFrm = new MainForm();
|
mainFrm = new MainForm();
|
||||||
Application.Run(mainFrm);
|
Application.Run(mainFrm);
|
||||||
|
//form1 = new Form1();
|
||||||
|
//Application.Run(form1);
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
Application.ThreadException += Application_ThreadException;
|
Application.ThreadException += Application_ThreadException;
|
||||||
}catch (Exception ex)
|
}catch (Exception ex)
|
||||||
|
@ -4,6 +4,8 @@ using System.Collections.Specialized;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
|
using System.Data.SqlClient;
|
||||||
|
using System.Data.SqlTypes;
|
||||||
|
|
||||||
|
|
||||||
public class SQLiteHelper
|
public class SQLiteHelper
|
||||||
@ -358,6 +360,31 @@ using System.Configuration;
|
|||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 执行一个查询,并将结果集映射到一个对象列表
|
||||||
|
public static List<T> ExecuteQuery<T>(string SQLString, Func<IDataRecord, T> selector, params SQLiteParameter[] parameters)
|
||||||
|
{
|
||||||
|
using (SQLiteConnection connection = new SQLiteConnection(connectionString))
|
||||||
|
{
|
||||||
|
using (SQLiteCommand cmd = new SQLiteCommand(SQLString, connection))
|
||||||
|
{
|
||||||
|
// 添加参数
|
||||||
|
cmd.Parameters.AddRange(parameters);
|
||||||
|
// 打开连接
|
||||||
|
connection.Open();
|
||||||
|
// 创建DataReader对象并读取数据,将每行数据映射到对象并添加到列表中
|
||||||
|
using (SQLiteDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
List<T> list = new List<T>();
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
list.Add(selector(reader));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static DataSet Query(string SQLString, string TableName)
|
public static DataSet Query(string SQLString, string TableName)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,74 @@ using System.Drawing;
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|
||||||
|
public class XK_HisenceWord
|
||||||
|
{
|
||||||
|
public string? OcrBar;
|
||||||
|
public string? OneblockPath;
|
||||||
|
public string? OneblockMainWord;
|
||||||
|
public string? OneblockText;
|
||||||
|
public string? TwoRect;
|
||||||
|
public bool? TwoIFWhile;
|
||||||
|
public string? TwoblockPath;
|
||||||
|
public string? TwoblockMainWord;
|
||||||
|
public string? TwoblockText;
|
||||||
|
public string? ThreeblockPath;
|
||||||
|
public string? ThreeblockMainWord;
|
||||||
|
public string? ThreeblockText;
|
||||||
|
public string? FourblockPath;
|
||||||
|
public string? FourblockMainWord;
|
||||||
|
public string? FourblockText;
|
||||||
|
public string? FiveblockPath;
|
||||||
|
public string? FiveblockMainWord;
|
||||||
|
public string? FiveblockText;
|
||||||
|
public string? SixblockPath;
|
||||||
|
public string? SixblockMainWord;
|
||||||
|
public string? SixblockText;
|
||||||
|
public string? SevenblockPath;
|
||||||
|
public string? SevenblockMainWord;
|
||||||
|
public string? SevenblockText;
|
||||||
|
public string? EightblockPath;
|
||||||
|
public string? EightblockMainWord;
|
||||||
|
public string? EightblockText;
|
||||||
|
|
||||||
|
public XK_HisenceWord()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public XK_HisenceWord(string? ocrBar, string? oneblockPath, string? oneblockMainWord, string? oneblockText, string? twoRect, bool? twoIFWhile, string? twoblockPath, string? twoblockMainWord, string? twoblockText, string? threeblockPath, string? threeblockMainWord, string? threeblockText, string? fourblockPath, string? fourblockMainWord, string? fourblockText, string? fiveblockPath, string? fiveblockMainWord, string? fiveblockText, string? sixblockPath, string? sixblockMainWord, string? sixblockText, string? sevenblockPath, string? sevenblockMainWord, string? sevenblockText, string? eightblockPath, string? eightblockMainWord, string? eightblockText)
|
||||||
|
{
|
||||||
|
OcrBar = ocrBar;
|
||||||
|
OneblockPath = oneblockPath;
|
||||||
|
OneblockMainWord = oneblockMainWord;
|
||||||
|
OneblockText = oneblockText;
|
||||||
|
TwoRect = twoRect;
|
||||||
|
TwoIFWhile = twoIFWhile;
|
||||||
|
TwoblockPath = twoblockPath;
|
||||||
|
TwoblockMainWord = twoblockMainWord;
|
||||||
|
TwoblockText = twoblockText;
|
||||||
|
ThreeblockPath = threeblockPath;
|
||||||
|
ThreeblockMainWord = threeblockMainWord;
|
||||||
|
ThreeblockText = threeblockText;
|
||||||
|
FourblockPath = fourblockPath;
|
||||||
|
FourblockMainWord = fourblockMainWord;
|
||||||
|
FourblockText = fourblockText;
|
||||||
|
FiveblockPath = fiveblockPath;
|
||||||
|
FiveblockMainWord = fiveblockMainWord;
|
||||||
|
FiveblockText = fiveblockText;
|
||||||
|
SixblockPath = sixblockPath;
|
||||||
|
SixblockMainWord = sixblockMainWord;
|
||||||
|
SixblockText = sixblockText;
|
||||||
|
SevenblockPath = sevenblockPath;
|
||||||
|
SevenblockMainWord = sevenblockMainWord;
|
||||||
|
SevenblockText = sevenblockText;
|
||||||
|
EightblockPath = eightblockPath;
|
||||||
|
EightblockMainWord = eightblockMainWord;
|
||||||
|
EightblockText = eightblockText;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class XKHisence
|
public class XKHisence
|
||||||
{
|
{
|
||||||
@ -23,12 +91,13 @@ public class XKHisence
|
|||||||
public int MoveTwoZ;
|
public int MoveTwoZ;
|
||||||
public string ?OcrParm;
|
public string ?OcrParm;
|
||||||
public string ?Language;
|
public string ?Language;
|
||||||
|
public string? FuzzyOcrText;
|
||||||
public XKHisence()
|
public XKHisence()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XKHisence(String type,string ocrBar,int MoveX,int MoveY,int MoveZ,string Detect,string ocrText,int MoveTwoX,int MoveTwoY,int MoveTwoZ,string OcrParm,string Language)
|
public XKHisence(string type,string ocrBar,int MoveX,int MoveY,int MoveZ,string Detect,string ocrText,int MoveTwoX,int MoveTwoY,int MoveTwoZ,string OcrParm,string Language,string FuzzyOcrText)
|
||||||
{
|
{
|
||||||
this.Type = type;
|
this.Type = type;
|
||||||
this.OcrBar = ocrBar;
|
this.OcrBar = ocrBar;
|
||||||
@ -42,6 +111,7 @@ public class XKHisence
|
|||||||
this.MoveTwoZ = MoveTwoZ;
|
this.MoveTwoZ = MoveTwoZ;
|
||||||
this.OcrParm = OcrParm;
|
this.OcrParm = OcrParm;
|
||||||
this.Language = Language;
|
this.Language = Language;
|
||||||
|
this.FuzzyOcrText = FuzzyOcrText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,12 +139,13 @@ public class MLRequest
|
|||||||
public int ResizeImageSize;
|
public int ResizeImageSize;
|
||||||
public int segmentWidth;
|
public int segmentWidth;
|
||||||
public int ImageWidth;
|
public int ImageWidth;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public float Score;
|
public float Score;
|
||||||
|
|
||||||
|
public MLRequest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public class DetectionResultDetail
|
public class DetectionResultDetail
|
||||||
{
|
{
|
||||||
@ -111,17 +182,7 @@ public class MLResult
|
|||||||
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
|
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
|
||||||
|
|
||||||
}
|
}
|
||||||
public class MLResultModel
|
|
||||||
{
|
|
||||||
public bool IsSuccess = false;
|
|
||||||
public string ResultMessage;
|
|
||||||
public Bitmap ResultMap;
|
|
||||||
public List<DetectionResultDetail> ResultDetails = new List<DetectionResultDetail>();
|
|
||||||
public string WashMachineBar;
|
|
||||||
public string WashMachineBatch;
|
|
||||||
public string WashMachineSN;
|
|
||||||
public string WashMachineLanguage;
|
|
||||||
}
|
|
||||||
public static class MLEngine
|
public static class MLEngine
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -9,9 +9,16 @@ using System.Runtime.CompilerServices;
|
|||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Runtime.Serialization.Formatters.Binary;
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public static class StaticHelper
|
public static class StaticHelper
|
||||||
{
|
{
|
||||||
|
//判断是否为正整数
|
||||||
|
public static bool IsInt(string inString)
|
||||||
|
{
|
||||||
|
Regex regex = new Regex("^[0-9]*[1-9][0-9]*$");
|
||||||
|
return regex.IsMatch(inString.Trim());
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数值转换为byte数组 高位在前,低位在后
|
/// 数值转换为byte数组 高位在前,低位在后
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user