diff --git a/.vs/VisionEdit/v14/.suo b/.vs/VisionEdit/v14/.suo
index 9159d43..33a5d43 100644
Binary files a/.vs/VisionEdit/v14/.suo and b/.vs/VisionEdit/v14/.suo differ
diff --git a/FindLine/FindLine.cs b/FindLine/FindLine.cs
index cc3c371..5d18adb 100644
--- a/FindLine/FindLine.cs
+++ b/FindLine/FindLine.cs
@@ -16,10 +16,53 @@ namespace FindLineTool
///
public PosXYU inputPose = new PosXYU();
///
+ /// 输入姿态
+ ///
+ public HTuple inputPoseHomMat2D = new HTuple();
+ ///
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+>>>>>>> 8c64a4f (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
+ /// 位置修正姿态
+ ///
+ public HTuple changePoseHomMat2D = new HTuple();
+ ///
+ /// 制作模板时的位姿
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+=======
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> b070592 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
/// 制作模板时的输入位姿
+>>>>>>> b070592 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+>>>>>>> 8c64a4f (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
///
public PosXYU templatePose = new PosXYU();
///
+ /// 修改的位姿
+ ///
+ public HTuple changedPose = new HTuple();
+ ///
/// 卡尺
///
public HObject contoursDisp = null;
@@ -50,7 +93,11 @@ namespace FindLineTool
///
/// 新的跟随姿态变化后的预期线信息
///
- HTuple newExpectLineStartRow = new HTuple(200), newExpectLineStartCol = new HTuple(200), newExpectLineEndRow = new HTuple(200), newExpectLineEndCol = new HTuple(600);
+ public HTuple modelStartRow = new HTuple(200), modelStartCol = new HTuple(200), modelEndRow = new HTuple(200), modelEndCol = new HTuple(600);
+ ///
+ /// 新的跟随姿态变化后的预期线信息
+ ///
+ public HTuple newExpectLineStartRow = new HTuple(200), newExpectLineStartCol = new HTuple(200), newExpectLineEndRow = new HTuple(200), newExpectLineEndCol = new HTuple(600);
/////
///// 区域中心行坐标
/////
@@ -214,7 +261,16 @@ namespace FindLineTool
FormFindLine.Instance.myHwindow.DispHWindow.ClearWindow();
DispImage();
}
-
+ // 更新模板线的位置,并生成变换矩阵
+ public void UpdateModelLineLocation()
+ {
+ // 计算新的位置线和转换之后位置线之间的差异,再将差异补偿到模板位置线中
+ HOperatorSet.VectorToSimilarity(new HTuple(newExpectLineStartRow, newExpectLineEndRow), new HTuple(newExpectLineStartCol, newExpectLineEndCol),
+ new HTuple(expectLineStartRow, expectLineEndRow), new HTuple(expectLineStartCol, expectLineEndCol), out changePoseHomMat2D);
+ // 更新位置
+ HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelStartRow, modelStartCol, out modelStartRow, out modelStartCol);
+ HOperatorSet.AffineTransPixel(changePoseHomMat2D, modelEndRow, modelEndCol, out modelEndRow, out modelEndCol);
+ }
public override void Run(SoftwareRunState softwareRunState)
{
@@ -235,20 +291,62 @@ namespace FindLineTool
{
UpdateImage();
}
- if (inputPose != null)
+ if (inputPoseHomMat2D != null)
{
- HTuple Row = inputPose.X - templatePose.X;
- HTuple Col = inputPose.Y - templatePose.Y;
- HTuple angle = inputPose.U - templatePose.U;
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+ //对预期线的起始点做放射变换
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelStartRow, modelStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelEndRow, modelEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+=======
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> b070592 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
+ //HTuple Row = inputPose.X - templatePose.X;
+ //HTuple Col = inputPose.Y - templatePose.Y;
+ //HTuple angle = inputPose.U - templatePose.U;
- HTuple _homMat2D;
- HOperatorSet.HomMat2dIdentity(out _homMat2D);
- HOperatorSet.HomMat2dRotate(_homMat2D, (HTuple)(angle), (HTuple)templatePose.X, (HTuple)templatePose.Y, out _homMat2D);
- HOperatorSet.HomMat2dTranslate(_homMat2D, (HTuple)(Row), (HTuple)(Col), out _homMat2D);
+ //HTuple _homMat2D;
+ //HOperatorSet.HomMat2dIdentity(out _homMat2D);
+ //HOperatorSet.HomMat2dRotate(_homMat2D, (HTuple)(angle), (HTuple)templatePose.X, (HTuple)templatePose.Y, out _homMat2D);
+ //HOperatorSet.HomMat2dTranslate(_homMat2D, (HTuple)(Row), (HTuple)(Col), out _homMat2D);
//对预期线的起始点做放射变换
- HOperatorSet.AffineTransPixel(_homMat2D, (HTuple)expectLineStartRow, (HTuple)expectLineStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
- HOperatorSet.AffineTransPixel(_homMat2D, (HTuple)expectLineEndRow, (HTuple)expectLineEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, (HTuple)expectLineStartRow, (HTuple)expectLineStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, (HTuple)expectLineEndRow, (HTuple)expectLineEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+<<<<<<< HEAD
+<<<<<<< HEAD
+<<<<<<< HEAD
+>>>>>>> b070592 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
+=======
+ //对预期线的起始点做放射变换
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelStartRow, modelStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelEndRow, modelEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+ //对预期线的起始点做放射变换
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelStartRow, modelStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelEndRow, modelEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+>>>>>>> 8c64a4f (1、修复找线工具的selectObject无法实时跟随的问题)
+=======
+>>>>>>> b070592 (修正FindLine工具无法位置跟随的问题)
+=======
+>>>>>>> fa76389 (修正FindLine工具无法位置跟随的问题)
+=======
+ //对预期线的起始点做放射变换
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelStartRow, modelStartCol, out newExpectLineStartRow, out newExpectLineStartCol);
+ HOperatorSet.AffineTransPixel(inputPoseHomMat2D, modelEndRow, modelEndCol, out newExpectLineEndRow, out newExpectLineEndCol);
+>>>>>>> 751e985 (1、修复找线工具的selectObject无法实时跟随的问题)
}
else
{
diff --git a/FindLine/FindLineTool.csproj b/FindLine/FindLineTool.csproj
index cae03de..5b451a7 100644
--- a/FindLine/FindLineTool.csproj
+++ b/FindLine/FindLineTool.csproj
@@ -34,6 +34,9 @@
C:\Program Files\MVTec\HALCON-19.05-Progress\bin\dotnet20\halcondotnet.dll
+
+ ..\VisionEdit\bin\Debug\ThirdLib\SunnyUI.dll
+
diff --git a/FindLine/FindLineToolRun.cs b/FindLine/FindLineToolRun.cs
index d7d6323..e3b32f7 100644
--- a/FindLine/FindLineToolRun.cs
+++ b/FindLine/FindLineToolRun.cs
@@ -59,7 +59,7 @@ namespace FindLineTool
myFindLine.inputImage = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HObject;
break;
case "InputPos":
- myFindLine.inputPose = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as PosXYU;
+ myFindLine.inputPoseHomMat2D = myJob.GetToolInfoByToolName(sourceToolName).GetOutput(toolItem).value as HTuple;
break;
default:
break;
diff --git a/FindLine/FormFindLine.Designer.cs b/FindLine/FormFindLine.Designer.cs
index 8994546..6f7ba4b 100644
--- a/FindLine/FormFindLine.Designer.cs
+++ b/FindLine/FormFindLine.Designer.cs
@@ -71,6 +71,7 @@ namespace FindLineTool
this.label7 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
+ this.btnSetModelPose = new Sunny.UI.UISymbolButton();
this.toolStrip1.SuspendLayout();
this.statusStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
@@ -189,6 +190,7 @@ namespace FindLineTool
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.btnSetModelPose);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.tbx_minScore);
this.groupBox1.Controls.Add(this.label5);
@@ -544,6 +546,20 @@ namespace FindLineTool
this.label9.TabIndex = 105;
this.label9.Text = "起点列坐标:";
//
+ // btnSetModelPose
+ //
+ this.btnSetModelPose.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.btnSetModelPose.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+ this.btnSetModelPose.IsScaled = false;
+ this.btnSetModelPose.Location = new System.Drawing.Point(40, 437);
+ this.btnSetModelPose.MinimumSize = new System.Drawing.Size(1, 1);
+ this.btnSetModelPose.Name = "btnSetModelPose";
+ this.btnSetModelPose.Size = new System.Drawing.Size(352, 35);
+ this.btnSetModelPose.Symbol = 361771;
+ this.btnSetModelPose.TabIndex = 334;
+ this.btnSetModelPose.Text = "标定为模板位置";
+ this.btnSetModelPose.Click += new System.EventHandler(this.btnSetModelPose_Click);
+ //
// FormFindLine
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -624,5 +640,6 @@ namespace FindLineTool
private System.Windows.Forms.ToolStripStatusLabel lb_RunStatus;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel lb_RunTime;
+ private Sunny.UI.UISymbolButton btnSetModelPose;
}
}
\ No newline at end of file
diff --git a/FindLine/FormFindLine.cs b/FindLine/FormFindLine.cs
index deb6157..d363b8a 100644
--- a/FindLine/FormFindLine.cs
+++ b/FindLine/FormFindLine.cs
@@ -67,8 +67,10 @@ namespace FindLineTool
myHwindow.Dock = DockStyle.Fill;
InitTool();
}
+ bool isInit = false;
private void InitTool()
{
+ isInit = true;
this.Text = myToolInfo.toolName;
Application.DoEvents();
@@ -84,14 +86,16 @@ namespace FindLineTool
tbx_caliperLength2.Text = myFindLine.weidth.ToString();
chBDispRec.Checked = myFindLine.dispRec;
chBDispCross.Checked = myFindLine.dispCross;
- // 将要编辑的线显示
- selected_drawing_object = HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] { myFindLine.expectLineStartRow, myFindLine.expectLineStartCol, myFindLine.expectLineEndRow, myFindLine.expectLineEndCol });
+ //// 将要编辑的线显示
+ selected_drawing_object = myFindLine.inputPoseHomMat2D != null? HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] { myFindLine.newExpectLineStartRow, myFindLine.newExpectLineStartCol, myFindLine.newExpectLineEndRow, myFindLine.newExpectLineEndCol })
+ :HDrawingObject.CreateDrawingObject(HDrawingObject.HDrawingObjectType.LINE, new HTuple[] {myFindLine.modelStartRow, myFindLine.modelStartCol, myFindLine.modelEndRow, myFindLine.modelEndCol });
GC.KeepAlive(selected_drawing_object);
selected_drawing_object.OnSelect(OnSelectDrawingObject);
selected_drawing_object.OnAttach(OnSelectDrawingObject);
selected_drawing_object.OnResize(OnSelectDrawingObject);
selected_drawing_object.OnDrag(OnSelectDrawingObject);
myHwindow.DispHWindow.AttachDrawingObjectToWindow(selected_drawing_object);
+ isInit = false;
}
///
/// 参数回调
@@ -122,7 +126,7 @@ namespace FindLineTool
}
///
/// 设定工具运行状态
- ///
+ /// `
/// 运行中的信息
/// 运行状态
public void SetToolStatus(string msg, ToolRunStatu status)
@@ -146,8 +150,11 @@ namespace FindLineTool
private void DispSetCheck(object sender, EventArgs e)
{
- myFindLine.dispRec = chBDispRec.Checked ? true : false;
- myFindLine.dispCross = chBDispCross.Checked ? true : false;
+ if(!isInit)
+ {
+ myFindLine.dispRec = chBDispRec.Checked ? true : false;
+ myFindLine.dispCross = chBDispCross.Checked ? true : false;
+ }
}
private void FormFindLine2_FormClosing(object sender, FormClosingEventArgs e)
@@ -157,5 +164,11 @@ namespace FindLineTool
this.Dispose();
GC.Collect();
}
+
+ private void btnSetModelPose_Click(object sender, EventArgs e)
+ {
+ myFindLine.UpdateModelLineLocation();
+ MessageBox.Show("模板线位置已更新");
+ }
}
}
diff --git a/PMAlignTool/FormPMAlignTool.Designer.cs b/PMAlignTool/FormPMAlignTool.Designer.cs
index 893e087..47a065f 100644
--- a/PMAlignTool/FormPMAlignTool.Designer.cs
+++ b/PMAlignTool/FormPMAlignTool.Designer.cs
@@ -1030,6 +1030,7 @@ namespace PMAlignTool
this.nud_angleRange.Size = new System.Drawing.Size(102, 28);
this.nud_angleRange.TabIndex = 182;
this.nud_angleRange.Value = 10D;
+ this.nud_angleRange.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// ckb_autoContrast
//
@@ -1071,6 +1072,7 @@ namespace PMAlignTool
this.nud_ScaleRange.Size = new System.Drawing.Size(104, 28);
this.nud_ScaleRange.TabIndex = 180;
this.nud_ScaleRange.Value = 1.1D;
+ this.nud_ScaleRange.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// nud_ScaleStart
//
@@ -1100,6 +1102,7 @@ namespace PMAlignTool
this.nud_ScaleStart.Size = new System.Drawing.Size(96, 28);
this.nud_ScaleStart.TabIndex = 179;
this.nud_ScaleStart.Value = 0.9D;
+ this.nud_ScaleStart.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// nud_angleStart
//
@@ -1129,6 +1132,7 @@ namespace PMAlignTool
this.nud_angleStart.Size = new System.Drawing.Size(96, 28);
this.nud_angleStart.TabIndex = 176;
this.nud_angleStart.Value = -10D;
+ this.nud_angleStart.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// cbx_polarity
//
@@ -1176,6 +1180,7 @@ namespace PMAlignTool
this.nud_minScore.Size = new System.Drawing.Size(227, 26);
this.nud_minScore.TabIndex = 173;
this.nud_minScore.Value = 0.8D;
+ this.nud_minScore.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// nud_Timeout
//
@@ -1205,6 +1210,7 @@ namespace PMAlignTool
this.nud_Timeout.Size = new System.Drawing.Size(227, 28);
this.nud_Timeout.TabIndex = 177;
this.nud_Timeout.Value = 500D;
+ this.nud_Timeout.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// nud_angleStep
//
@@ -1234,6 +1240,7 @@ namespace PMAlignTool
this.nud_angleStep.Size = new System.Drawing.Size(227, 28);
this.nud_angleStep.TabIndex = 175;
this.nud_angleStep.Value = 1D;
+ this.nud_angleStep.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// nud_matchNum
//
@@ -1263,6 +1270,7 @@ namespace PMAlignTool
this.nud_matchNum.Size = new System.Drawing.Size(227, 28);
this.nud_matchNum.TabIndex = 174;
this.nud_matchNum.Value = 1D;
+ this.nud_matchNum.ValueChanged += new Controls.DValueChanged(this.UIParams_ValueChanged);
//
// tkb_contrast
//
diff --git a/PMAlignTool/FormPMAlignTool.cs b/PMAlignTool/FormPMAlignTool.cs
index a7378e4..a032cba 100644
--- a/PMAlignTool/FormPMAlignTool.cs
+++ b/PMAlignTool/FormPMAlignTool.cs
@@ -102,6 +102,7 @@ namespace PMAlignTool
tkb_contrast.Value = myPMAlign.contrast;
#endregion
+ isInitTool = false;
}
private void btnAcqNewModelImage_Click(object sender, EventArgs e)
@@ -305,5 +306,21 @@ namespace PMAlignTool
{
lbl_contastValue.Text = tkb_contrast.Value.ToString();
}
+
+ private void UIParams_ValueChanged(double value)
+ {
+ if (!isInitTool)
+ {
+ myPMAlign.minScore = nud_minScore.Value;
+ myPMAlign.startAngle = Convert.ToInt16(nud_angleStart.Value);
+ myPMAlign.angleRange = Convert.ToInt16(nud_angleRange.Value);
+ myPMAlign.angleStep = Convert.ToInt16(nud_angleStep.Value);
+ myPMAlign.polarity = cbx_polarity.TextStr;
+ myPMAlign.isAutoConstants = ckb_autoContrast.Checked;
+ myPMAlign.minScale = nud_ScaleStart.Value;
+ myPMAlign.maxScale = nud_ScaleRange.Value;
+ }
+ }
+
}
}
diff --git a/PMAlignTool/FormPMAlignTool.resx b/PMAlignTool/FormPMAlignTool.resx
index e90db2b..836d7e6 100644
--- a/PMAlignTool/FormPMAlignTool.resx
+++ b/PMAlignTool/FormPMAlignTool.resx
@@ -211,21 +211,6 @@
True
-
- True
-
-
- True
-
-
- True
-
-
- True
-
-
- True
-
71
diff --git a/PMAlignTool/PMAlign.cs b/PMAlignTool/PMAlign.cs
index 9422da9..2e15b7a 100644
--- a/PMAlignTool/PMAlign.cs
+++ b/PMAlignTool/PMAlign.cs
@@ -117,6 +117,10 @@ namespace PMAlignTool
public HObject oldTrainImage { get; set; }
public bool isCreateModel { get; set; }
internal string pmaModelName { get; set; } = Guid.NewGuid().ToString();
+ ///
+ /// 模板位置和实际位置的姿态差异
+ ///
+ internal HTuple posHomMat2D = new HTuple();
public override void DispMainWindow(HWindow dispHWindow)
{
@@ -185,7 +189,7 @@ namespace PMAlignTool
//对预期线的找模板区域做放射变换
}
- UpdateParamsFromUI(); // 操作前先将UI中参数写入类
+ // UpdateParamsFromUI(); // 操作前先将UI中参数写入类
HObject findModelImg = ProcessImage(inputImage);
int ret = FindModelTemplate(findModelImg);
ToolRunStatu myState = ret == 0 ? ToolRunStatu.Succeed : ToolRunStatu.Model_UnFound;
@@ -239,6 +243,18 @@ namespace PMAlignTool
}
}
+ public void SetParamsFromUI()
+ {
+ minScore = FormPMAlignTool.Instance.nud_minScore.Value;
+ startAngle = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleStart.Value);
+ angleRange = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleRange.Value);
+ angleStep = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleStep.Value);
+ polarity = FormPMAlignTool.Instance.cbx_polarity.TextStr;
+ isAutoConstants = FormPMAlignTool.Instance.ckb_autoContrast.Checked;
+ minScale = FormPMAlignTool.Instance.nud_ScaleStart.Value;
+ maxScale = FormPMAlignTool.Instance.nud_ScaleRange.Value;
+ }
+
public int CreateModelTemplate()
{
HObject template;
@@ -254,14 +270,7 @@ namespace PMAlignTool
HOperatorSet.GenEmptyObj(out createModelImg);
createModelImg = ProcessImage(inputImage);
HOperatorSet.ReduceDomain(createModelImg, templateRegion, out template);
- minScore = FormPMAlignTool.Instance.nud_minScore.Value;
- startAngle = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleStart.Value);
- angleRange = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleRange.Value);
- angleStep = Convert.ToInt16(FormPMAlignTool.Instance.nud_angleStep.Value);
- polarity = FormPMAlignTool.Instance.cbx_polarity.TextStr;
- isAutoConstants = FormPMAlignTool.Instance.ckb_autoContrast.Checked;
- minScale = FormPMAlignTool.Instance.nud_ScaleStart.Value;
- maxScale = FormPMAlignTool.Instance.nud_ScaleRange.Value;
+ //SetParamsFromUI();
try
{
HTuple rows, cols, angles, scores, scale;
@@ -291,38 +300,6 @@ namespace PMAlignTool
out cols,
out angles,
out scores);
- /*
- HOperatorSet.CreateScaledShapeModel(template,
- "auto",
- ((HTuple)startAngle).TupleRad(),
- ((HTuple)angleRange).TupleRad(),
- "auto",
- minScale,
- maxScale,
- "auto",
- "auto",
- polarity,
- isAutoConstants ? (HTuple)"auto" : (HTuple)contrast,
- "auto",
- out modelID);
- HOperatorSet.FindScaledShapeModel(createModelImg,
- (HTuple)modelID,
- ((HTuple)startAngle).TupleRad(),
- ((HTuple)angleRange - startAngle).TupleRad(),
- minScale,
- maxScale,
- (HTuple)minScore,
- (HTuple)matchNum,
- (HTuple)0.5,
- (HTuple)"least_squares",
- (HTuple)0,
- (HTuple)0.9,
- out rows,
- out cols,
- out angles,
- out scale,
- out scores);
- */
}
else
{
@@ -354,6 +331,7 @@ namespace PMAlignTool
{
templatePose = new PosXYU { X = rows[0].D, Y = cols[0].D , U = angles[0].D };
}
+
}
catch (Exception ex)
{
@@ -463,6 +441,7 @@ namespace PMAlignTool
L_resultList.Add(matchResult);
}
MatchResult temp;
+ // 将匹配结果按分值由大到小排序
for (int i = 0; i < L_resultList.Count - 1; i++)
{
for (int j = i + 1; j < L_resultList.Count; j++)
@@ -475,6 +454,7 @@ namespace PMAlignTool
}
}
}
+ HOperatorSet.VectorAngleToRigid(templatePose.X, templatePose.Y, templatePose.U, L_resultList[0].Row, L_resultList[0].Col, L_resultList[0].Angle, out posHomMat2D);
}
if (softwareRunState == SoftwareRunState.Debug)
{
diff --git a/PMAlignTool/PMAlignToolRun.cs b/PMAlignTool/PMAlignToolRun.cs
index bf5bc9d..08a072e 100644
--- a/PMAlignTool/PMAlignToolRun.cs
+++ b/PMAlignTool/PMAlignToolRun.cs
@@ -67,9 +67,7 @@ namespace PMAlignTool
// 将输出值赋值到界面输出中
if (myPMAlign.L_resultList.Count > 0)
{
- L_toolList[toolIndex].toolOutput[0] = new ToolIO("GetPose",
- new PosXYU { X = myPMAlign.L_resultList[0].Row, Y = myPMAlign.L_resultList[0].Col, U = myPMAlign.L_resultList[0].Angle },
- DataType.Pose);
+ L_toolList[toolIndex].toolOutput[0] = new ToolIO("GetPose", myPMAlign.posHomMat2D,DataType.Pose);
L_toolList[toolIndex].toolOutput[1] = new ToolIO("GetPose.X", myPMAlign.L_resultList[0].Row, DataType.IntValue);
L_toolList[toolIndex].toolOutput[2] = new ToolIO("GetPose.Y", myPMAlign.L_resultList[0].Col, DataType.IntValue);
L_toolList[toolIndex].toolOutput[3] = new ToolIO("GetPose.Z", myPMAlign.L_resultList[0].Angle, DataType.DoubleValue);
diff --git a/VisionEdit/FormMain.cs b/VisionEdit/FormMain.cs
index 9f6b7b4..416d5a8 100644
--- a/VisionEdit/FormMain.cs
+++ b/VisionEdit/FormMain.cs
@@ -115,6 +115,7 @@ namespace VisionEdit
if (dr == DialogResult.Yes)
{
VisionJobParams.pVisionProject.SaveObject();
+ Environment.Exit(0);
}
else if (dr == DialogResult.Cancel)
{
diff --git a/VisionEdit/bin/Debug/DockPanel.config b/VisionEdit/bin/Debug/DockPanel.config
index 605611e..0c5b398 100644
Binary files a/VisionEdit/bin/Debug/DockPanel.config and b/VisionEdit/bin/Debug/DockPanel.config differ