This commit is contained in:
xhm\HP 2024-05-31 11:16:22 +08:00
parent 3c72adc00f
commit 85ba963a93

View File

@ -497,7 +497,7 @@ namespace HisenceYoloDetection
int IfXZeros = melsecPLCTCPDriver.ReadInt("102"); int IfXZeros = melsecPLCTCPDriver.ReadInt("102");
int IfYZeros = melsecPLCTCPDriver.ReadInt("112"); int IfYZeros = melsecPLCTCPDriver.ReadInt("112");
int IfZZeros = melsecPLCTCPDriver.ReadInt("122"); int IfZZeros = melsecPLCTCPDriver.ReadInt("122");
if (IfXZeros <= 40 && IfYZeros <= 140 && IfZZeros <= 40) if (IfXZeros <= 140 && IfYZeros <= 140 && IfZZeros <= 140)
{ {
StartDecBtn.Enabled = true; StartDecBtn.Enabled = true;
break; break;
@ -519,15 +519,15 @@ 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 InsertSqlRunData(ref Mat currentMatC, MLResult cam1TwoML, ref List<string> strMatListList, ref PaddleOcrModel IOcrModel)
{ {
#if false #if true
try try
{ {
List<Mat> mats = new List<Mat>(); List<Mat> mats = new List<Mat>();
@ -900,6 +900,11 @@ namespace HisenceYoloDetection
myLog("第一次采集图像", DateTime.Now); myLog("第一次采集图像", DateTime.Now);
//移动模组 读三次测距的地址 看是否往前移动 //移动模组 读三次测距的地址 看是否往前移动
MoveToP(8974, 0, 0);
List<int> DisList = new List<int>(); List<int> DisList = new List<int>();
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
@ -911,9 +916,12 @@ namespace HisenceYoloDetection
// 计算剩余值的平均数 // 计算剩余值的平均数
double average = DisList.Average(); double average = DisList.Average();
double disreal = average * (-0.54054) + 1324.3232; double disreal = average * (-0.54054) + 1324.3232;
//测距距离-标准距离=要移动的距离
double dismove = disreal - 876;
MoveToP(8974, 0, (int)(disreal)); if(dismove>0&& dismove<4000)
{
MoveToP(8974, 0, (int)(dismove));
}
Thread.Sleep(500); Thread.Sleep(500);
Cam1.SnapshotCount = 0; Cam1.SnapshotCount = 0;
Cam1.Snapshot(); Cam1.Snapshot();
@ -925,8 +933,7 @@ namespace HisenceYoloDetection
// MoveToP(xKNow.MoveTwoX, xKNow.MoveTwoY, xKNow.MoveTwoZ); // MoveToP(xKNow.MoveTwoX, xKNow.MoveTwoY, xKNow.MoveTwoZ);
//} //}
// currentXP = 54964; // currentXP = 54964;
MoveToP(54964, 0, (int)(disreal)); MoveToP(54964, 0, (int)(dismove));
//Thread.Sleep(3000);
Cam1.Snapshot(); Cam1.Snapshot();
MoveToP(8974, 0, 0); MoveToP(8974, 0, 0);
//if (xKNow != null) //if (xKNow != null)
@ -999,7 +1006,7 @@ namespace HisenceYoloDetection
{ {
// Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg"); // Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg");
Cam1ImgOne = cameraMat; Cam1ImgOne = cameraMat;
IfCam2Triger = true; IfCam1OneTriger = true;
originMatShow.Image = cameraMat.ToBitmap(); originMatShow.Image = cameraMat.ToBitmap();
//pictureBox1.Image = cameraMat.ToBitmap(); //pictureBox1.Image = cameraMat.ToBitmap();
@ -1035,9 +1042,7 @@ namespace HisenceYoloDetection
{ {
Directory.CreateDirectory(fitImageFolder); Directory.CreateDirectory(fitImageFolder);
} }
//µÚÒ»´ÎÅÄÕÕ
if (SnapshotCount == 1)
{
// Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg"); // Mat mat = Cv2.ImRead("F:\\海信洗衣机\\cam1\\2024517161641.jpg");
Cam2ImgShowBar = cameraMat; Cam2ImgShowBar = cameraMat;
IfCam2Triger = true; IfCam2Triger = true;
@ -1045,7 +1050,7 @@ namespace HisenceYoloDetection
//pictureBox1.Image = cameraMat.ToBitmap(); //pictureBox1.Image = cameraMat.ToBitmap();
}
pictureBox2.Image = cameraMat.ToBitmap(); pictureBox2.Image = cameraMat.ToBitmap();