mirror of
https://github.com/eggplantlwj/VisionEdit.git
synced 2026-03-28 19:26:35 +08:00
1、解决因在debug目录下放置多余的dll导致反射时报错的问题
2、解决显示窗口滑动时,坐标及灰度值不实时更新的问题 3、解决模板匹配工具,模板图像不更新的问题 4、将各工具的生成位置改至主程序的debug目录下
This commit is contained in:
82
PMAlignTool/FormPMAlignTool.Designer.cs
generated
82
PMAlignTool/FormPMAlignTool.Designer.cs
generated
@@ -120,11 +120,11 @@ namespace PMAlignTool
|
||||
this.ckb_showCross = new System.Windows.Forms.CheckBox();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.dgv_matchResult = new System.Windows.Forms.DataGridView();
|
||||
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column7 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column8 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column9 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column10 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Column12 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.statusStrip.SuspendLayout();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
@@ -1546,44 +1546,62 @@ namespace PMAlignTool
|
||||
//
|
||||
// dgv_matchResult
|
||||
//
|
||||
this.dgv_matchResult.AllowDrop = true;
|
||||
this.dgv_matchResult.AllowUserToAddRows = false;
|
||||
this.dgv_matchResult.AllowUserToDeleteRows = false;
|
||||
this.dgv_matchResult.AllowUserToResizeRows = false;
|
||||
this.dgv_matchResult.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgv_matchResult.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Column1,
|
||||
this.Column2,
|
||||
this.Column3,
|
||||
this.Column4,
|
||||
this.Column5});
|
||||
this.Column7,
|
||||
this.Column8,
|
||||
this.Column9,
|
||||
this.Column10,
|
||||
this.Column12});
|
||||
this.dgv_matchResult.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgv_matchResult.Location = new System.Drawing.Point(0, 0);
|
||||
this.dgv_matchResult.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.dgv_matchResult.Name = "dgv_matchResult";
|
||||
this.dgv_matchResult.ReadOnly = true;
|
||||
this.dgv_matchResult.RowHeadersVisible = false;
|
||||
this.dgv_matchResult.RowTemplate.Height = 23;
|
||||
this.dgv_matchResult.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dgv_matchResult.Size = new System.Drawing.Size(392, 568);
|
||||
this.dgv_matchResult.TabIndex = 0;
|
||||
this.dgv_matchResult.TabIndex = 15;
|
||||
//
|
||||
// Column1
|
||||
// Column7
|
||||
//
|
||||
this.Column1.HeaderText = "序号";
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column7.HeaderText = "编号";
|
||||
this.Column7.Name = "Column7";
|
||||
this.Column7.ReadOnly = true;
|
||||
this.Column7.Width = 70;
|
||||
//
|
||||
// Column2
|
||||
// Column8
|
||||
//
|
||||
this.Column2.HeaderText = "分值";
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column8.HeaderText = "分数";
|
||||
this.Column8.Name = "Column8";
|
||||
this.Column8.ReadOnly = true;
|
||||
this.Column8.Width = 75;
|
||||
//
|
||||
// Column3
|
||||
// Column9
|
||||
//
|
||||
this.Column3.HeaderText = "行";
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column9.HeaderText = "行";
|
||||
this.Column9.Name = "Column9";
|
||||
this.Column9.ReadOnly = true;
|
||||
this.Column9.Width = 70;
|
||||
//
|
||||
// Column4
|
||||
// Column10
|
||||
//
|
||||
this.Column4.HeaderText = "列";
|
||||
this.Column4.Name = "Column4";
|
||||
this.Column10.HeaderText = "列";
|
||||
this.Column10.Name = "Column10";
|
||||
this.Column10.ReadOnly = true;
|
||||
this.Column10.Width = 70;
|
||||
//
|
||||
// Column5
|
||||
// Column12
|
||||
//
|
||||
this.Column5.HeaderText = "角度";
|
||||
this.Column5.Name = "Column5";
|
||||
this.Column12.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.Column12.HeaderText = "角度(°)";
|
||||
this.Column12.Name = "Column12";
|
||||
this.Column12.ReadOnly = true;
|
||||
//
|
||||
// FormPMAlignTool
|
||||
//
|
||||
@@ -1739,11 +1757,11 @@ namespace PMAlignTool
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel lb_RunTime;
|
||||
private System.Windows.Forms.TabPage tabPage3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column4;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
|
||||
public System.Windows.Forms.DataGridView dgv_matchResult;
|
||||
internal System.Windows.Forms.DataGridView dgv_matchResult;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column7;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column8;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column9;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column10;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column12;
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ namespace PMAlignTool
|
||||
myPMAlign.toolName = myToolInfo.toolName;
|
||||
myPMAlign.bingdingJobName = myToolInfo.bingingJobName;
|
||||
myPMAlign.DispImage();
|
||||
myPMAlign.InitTool();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +104,22 @@ namespace PMAlignTool
|
||||
nud_ScaleRange.Value = myPMAlign.maxScale;
|
||||
tkb_contrast.Value = myPMAlign.contrast;
|
||||
#endregion
|
||||
if(myPMAlign.modelPartImage != null)
|
||||
|
||||
if (myPMAlign.oldTrainImage == null && File.Exists(myPMAlign.trainImgPath) && File.Exists(myPMAlign.trainModelPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
HOperatorSet.ReadImage(out myPMAlign.oldTrainImage, myPMAlign.trainImgPath);
|
||||
HOperatorSet.ReadImage(out myPMAlign.modelPartImage, myPMAlign.trainModelPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (myPMAlign.modelPartImage != null)
|
||||
{
|
||||
hWindowTool_Smart1.DispImage(myPMAlign.modelPartImage);
|
||||
}
|
||||
// myHwindow.DispHWindow.AttachDrawingObjectToWindow(serachRegion_drawing_object);
|
||||
tsbtRunTool_Click(null, null);
|
||||
isInitTool = false;
|
||||
}
|
||||
@@ -321,14 +333,27 @@ namespace PMAlignTool
|
||||
|
||||
private void btnChangeModel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(!File.Exists(myPMAlign.pmaModelName + ".ShapeModel"))
|
||||
if(!File.Exists(myPMAlign.trainShmPath))
|
||||
{
|
||||
MessageBox.Show("还未创建过模板,请先进行创建!");
|
||||
MessageBox.Show("无已训练好的模型,请先创建模型");
|
||||
return;
|
||||
}
|
||||
myPMAlign.inputImage = myPMAlign.oldTrainImage;
|
||||
myPMAlign.Run(SoftwareRunState.Debug);
|
||||
|
||||
else
|
||||
{
|
||||
if (myPMAlign.oldTrainImage == null && File.Exists(myPMAlign.trainImgPath) && File.Exists(myPMAlign.trainModelPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
HOperatorSet.ReadImage(out myPMAlign.oldTrainImage, myPMAlign.trainImgPath);
|
||||
HOperatorSet.ReadImage(out myPMAlign.modelPartImage, myPMAlign.trainModelPath);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
myPMAlign.inputImage = myPMAlign.oldTrainImage;
|
||||
myPMAlign.Run(SoftwareRunState.Debug);
|
||||
}
|
||||
}
|
||||
|
||||
private void cbx_searchRegionType_SelectedIndexChanged()
|
||||
|
||||
@@ -196,19 +196,19 @@
|
||||
n4H40MZzWKY2esaEIAiCIAiCIKrhy5f/A2/46JDXUARZAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column7.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column9.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column10.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Column5.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="Column12.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
@@ -173,8 +173,20 @@ namespace PMAlignTool
|
||||
public bool isAutoConstants { get; set; }
|
||||
public string modelFilePath { get; set; }
|
||||
public RegionType searchRegionType { get; set; }
|
||||
/// <summary>
|
||||
/// 文件存储路径
|
||||
/// </summary>
|
||||
public string trainImgPath, trainShmPath, trainModelPath, dataDirectory;
|
||||
[NonSerialized]
|
||||
public HObject SearchRegion;
|
||||
|
||||
public void InitTool()
|
||||
{
|
||||
trainImgPath = ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}_TrainImage.bmp";
|
||||
trainShmPath = ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}.Shm";
|
||||
trainModelPath = ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}_ModelImage.bmp";
|
||||
dataDirectory = ConfigData.ConfigPath + $"\\{bingdingJobName}\\";
|
||||
}
|
||||
public override void Run(SoftwareRunState softwareState)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -372,9 +384,10 @@ namespace PMAlignTool
|
||||
}
|
||||
isCreateModel = true;
|
||||
// 模板句柄信息
|
||||
Directory.CreateDirectory(ConfigData.ConfigPath + $"\\{bingdingJobName}\\");
|
||||
HOperatorSet.WriteShapeModel(modelID, ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}.Shm");
|
||||
|
||||
Directory.CreateDirectory(dataDirectory);
|
||||
HOperatorSet.WriteShapeModel(modelID, trainShmPath);
|
||||
HOperatorSet.WriteImage(inputImage, "bmp", 0, trainImgPath);
|
||||
HOperatorSet.WriteImage(modelPartImage, "bmp", 0, trainModelPath);
|
||||
if (scores != null && scores.Type != HTupleType.EMPTY)
|
||||
{
|
||||
templatePose = new PosXYU { X = rows[0].D, Y = cols[0].D , U = angles[0].D };
|
||||
@@ -397,12 +410,12 @@ namespace PMAlignTool
|
||||
|
||||
public int FindModelTemplate(HObject findModelImage)
|
||||
{
|
||||
if (!File.Exists(ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}.Shm"))
|
||||
if (!File.Exists(trainShmPath))
|
||||
{
|
||||
LoggerClass.WriteLog($"{toolName}未创建或加载模板", MsgLevel.Exception);
|
||||
return -1;
|
||||
}
|
||||
HOperatorSet.ReadShapeModel(ConfigData.ConfigPath + $"\\{bingdingJobName}\\{toolName}_{pmaModelName}.Shm", out modelID);
|
||||
HOperatorSet.ReadShapeModel(trainShmPath, out modelID);
|
||||
HObject image;
|
||||
if (searchRegionType == RegionType.AllImage)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<OutputPath>..\VisionEdit\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
|
||||
@@ -55,6 +55,7 @@ namespace PMAlignTool
|
||||
}
|
||||
}
|
||||
}
|
||||
myPMAlign.InitTool();
|
||||
myPMAlign.Run(SoftwareRunState.Release);
|
||||
if (myPMAlign.toolRunStatu != ToolRunStatu.Succeed)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user