debug on site
This commit is contained in:
@@ -612,7 +612,7 @@ namespace TetraPackOCR
|
|||||||
OcrParameter.use_angle_cls = true;//是否开启方向检测,用于检测识别180旋转
|
OcrParameter.use_angle_cls = true;//是否开启方向检测,用于检测识别180旋转
|
||||||
OcrParameter.det_db_score_mode = true;//是否使用多段线,即文字区域是用多段线还是用矩形,
|
OcrParameter.det_db_score_mode = true;//是否使用多段线,即文字区域是用多段线还是用矩形,
|
||||||
OcrParameter.det_db_unclip_ratio = 1.6f;
|
OcrParameter.det_db_unclip_ratio = 1.6f;
|
||||||
OcrParameter.max_side_len = 3200;
|
OcrParameter.max_side_len = 3800;
|
||||||
|
|
||||||
//初始化OCR
|
//初始化OCR
|
||||||
Engine = new PaddleOCREngine(config, OcrParameter);
|
Engine = new PaddleOCREngine(config, OcrParameter);
|
||||||
@@ -1140,6 +1140,28 @@ namespace TetraPackOCR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
this.lbl_L1_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L1_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L2_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L2_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L3_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L3_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L4_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L4_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L5_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L5_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L6_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L6_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L7_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L7_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L8_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L8_verOcrRs.BackColor = Color.Gray;
|
||||||
|
this.lbl_L9_verOcrRs.Text = "未启用";
|
||||||
|
this.lbl_L9_verOcrRs.BackColor = Color.Gray;
|
||||||
|
}));
|
||||||
|
|
||||||
autorunFlag = check_Autorun.Checked;
|
autorunFlag = check_Autorun.Checked;
|
||||||
btn_StarDet_manual.Enabled = false;
|
btn_StarDet_manual.Enabled = false;
|
||||||
button1.Enabled = true;
|
button1.Enabled = true;
|
||||||
@@ -1306,6 +1328,7 @@ namespace TetraPackOCR
|
|||||||
this.lbl_XShow.Text = xx.ToString();
|
this.lbl_XShow.Text = xx.ToString();
|
||||||
this.lbl_YShow.Text = yy.ToString();
|
this.lbl_YShow.Text = yy.ToString();
|
||||||
this.lbl_RShow.Text = rr.ToString();
|
this.lbl_RShow.Text = rr.ToString();
|
||||||
|
log.Info($"x:{xx} y:{yy} degree:{rr}");
|
||||||
|
|
||||||
//画模型轮廓
|
//画模型轮廓
|
||||||
CogCompositeShape shape = myPMA.Results[i].CreateResultGraphics(CogPMAlignResultGraphicConstants.MatchFeatures);
|
CogCompositeShape shape = myPMA.Results[i].CreateResultGraphics(CogPMAlignResultGraphicConstants.MatchFeatures);
|
||||||
@@ -1475,7 +1498,7 @@ namespace TetraPackOCR
|
|||||||
fs.Close();
|
fs.Close();
|
||||||
log.Info("OCR存图已完成");
|
log.Info("OCR存图已完成");
|
||||||
|
|
||||||
CutPicture(SaveImageFileOCR + '\\' + strtimef + '\\' + strTime + ".bmp", 600, 1800, 3200, 1600);
|
CutPicture(SaveImageFileOCR + '\\' + strtimef + '\\' + strTime + ".bmp", 1000, 1800, 3800, 1600);
|
||||||
//List<PointD> temps = new List<PointD>();
|
//List<PointD> temps = new List<PointD>();
|
||||||
if (Engine == null)
|
if (Engine == null)
|
||||||
{
|
{
|
||||||
@@ -1516,7 +1539,7 @@ namespace TetraPackOCR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
txt_readOcrResultShow.Text = sResult.text;
|
txt_readOcrResultShow.Text = sResult.text;
|
||||||
log.Info("字符读取结果:" + sResult.text);
|
log.Info("s通道字符读取结果:" + sResult.text);
|
||||||
matchOK = sResult.match;
|
matchOK = sResult.match;
|
||||||
pointsTotal = sResult.points;
|
pointsTotal = sResult.points;
|
||||||
|
|
||||||
@@ -1530,7 +1553,7 @@ namespace TetraPackOCR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
txt_readOcrResultShow.Text += "\n" + hResult.text;
|
txt_readOcrResultShow.Text += "\n" + hResult.text;
|
||||||
log.Info("字符读取结果:" + hResult.text);
|
log.Info("h通道字符读取结果:" + hResult.text);
|
||||||
matchOK = hResult.match;
|
matchOK = hResult.match;
|
||||||
if (hResult.points != null && hResult.points.Length > 0)
|
if (hResult.points != null && hResult.points.Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1550,7 +1573,7 @@ namespace TetraPackOCR
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
txt_readOcrResultShow.Text += "\n" + vResult.text;
|
txt_readOcrResultShow.Text += "\n" + vResult.text;
|
||||||
log.Info("字符读取结果:" + vResult.text);
|
log.Info("v通道字符读取结果:" + vResult.text);
|
||||||
matchOK = vResult.match;
|
matchOK = vResult.match;
|
||||||
if (vResult.points != null && vResult.points.Length > 0)
|
if (vResult.points != null && vResult.points.Length > 0)
|
||||||
{
|
{
|
||||||
@@ -1571,7 +1594,7 @@ namespace TetraPackOCR
|
|||||||
}
|
}
|
||||||
Ocr_picBox.BackgroundImage = null;
|
Ocr_picBox.BackgroundImage = null;
|
||||||
Ocr_picBox.BackgroundImage = Bmp;
|
Ocr_picBox.BackgroundImage = Bmp;
|
||||||
int m1 = ocrTextResult.Select(x => x.Value == true).Count();
|
int m1 = ocrTextResult.Count(x => x.Value);
|
||||||
log.Info($"OCR识别完成,匹配成功{m1}个字符,匹配失败{ocrTextResult.Count - m1}个字符");
|
log.Info($"OCR识别完成,匹配成功{m1}个字符,匹配失败{ocrTextResult.Count - m1}个字符");
|
||||||
ShowTheLansRs(mMatchingStr, (float)m1 / (float)ocrTextResult.Count);
|
ShowTheLansRs(mMatchingStr, (float)m1 / (float)ocrTextResult.Count);
|
||||||
}
|
}
|
||||||
@@ -1682,11 +1705,18 @@ namespace TetraPackOCR
|
|||||||
}
|
}
|
||||||
result.text = GETOCR(lastocr, ocrTextDesign[mMatchingStr]);
|
result.text = GETOCR(lastocr, ocrTextDesign[mMatchingStr]);
|
||||||
|
|
||||||
|
var keysToUpdate = new List<string>();
|
||||||
foreach (var item in ocrTextResult)
|
foreach (var item in ocrTextResult)
|
||||||
{
|
{
|
||||||
if (result.text.Contains(item.Key))
|
if (result.text.Contains(item.Key))
|
||||||
ocrTextResult[item.Key] = true;
|
keysToUpdate.Add(item.Key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var item in keysToUpdate)
|
||||||
|
{
|
||||||
|
ocrTextResult[item] = true;
|
||||||
|
}
|
||||||
|
|
||||||
result.match = true;
|
result.match = true;
|
||||||
foreach (var item in ocrTextResult)
|
foreach (var item in ocrTextResult)
|
||||||
{
|
{
|
||||||
@@ -1697,7 +1727,7 @@ namespace TetraPackOCR
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.Error(ex.Message);
|
log.Error(ex.Message + ex.StackTrace);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2118,7 +2148,7 @@ namespace TetraPackOCR
|
|||||||
#region 接收到OCR拍照信号
|
#region 接收到OCR拍照信号
|
||||||
if (e.CameraIndex == 1)
|
if (e.CameraIndex == 1)
|
||||||
{
|
{
|
||||||
Thread.Sleep(100);
|
Thread.Sleep(1000);
|
||||||
OcrCamTriger();
|
OcrCamTriger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2286,7 +2316,29 @@ namespace TetraPackOCR
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "TPA200SQ":
|
||||||
|
switch (col.Length)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
xx = (float)x - 9.5f;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
xx = (float)x - 9f;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
xx = (float)x - 9f;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
xx = (float)x - 9f;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
xx = (float)x - 9f;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
xx = (float)x - 9f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ocrx = 0, ocry = 0;
|
float ocrx = 0, ocry = 0;
|
||||||
@@ -2318,10 +2370,10 @@ namespace TetraPackOCR
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Info("第" + (item + 1) + "组坐标为:X:" + ocrxx[item] + ",Y:" + ocryy[item] + "。");
|
log.Info("第" + (item + 1) + "组坐标为:X:" + ocrxx[item] + ",Y:" + ocryy[item] + "。");
|
||||||
if (ocrxx[item] < 0 || ocrxx[item] > 1200)
|
if (ocrxx[item] < 0 || ocrxx[item] > 1600)
|
||||||
{
|
{
|
||||||
EnableStartDetect();
|
EnableStartDetect();
|
||||||
log.Error("x范围 0,1200!");
|
log.Error("x范围 0,1600!");
|
||||||
byte[] datax = DataConverter.FloatToByte(0.0f, true);
|
byte[] datax = DataConverter.FloatToByte(0.0f, true);
|
||||||
cc24?.NotifyCamInspectionComplete(0, datax);
|
cc24?.NotifyCamInspectionComplete(0, datax);
|
||||||
cc24?.NotifyCamAcqComplete(0);
|
cc24?.NotifyCamAcqComplete(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user