Commit aa6345ce SK

Mark点设置

1 个父辈 d4ca7d6b
...@@ -20,10 +20,26 @@ namespace AOI ...@@ -20,10 +20,26 @@ namespace AOI
/// </summary> /// </summary>
public GraphicsPath SearchPath; public GraphicsPath SearchPath;
/// <summary>
/// 根据Mark点校正相机获取的图片
/// </summary>
/// <param name="standardImage">标准图片</param>
/// <param name="imageToCheck">相机获取的图片</param>
/// <returns></returns>
public override ResultBean Check(Image standardImage, Image imageToCheck) public override ResultBean Check(Image standardImage, Image imageToCheck)
{ {
ResultBean resultBean = new ResultBean(); ResultBean resultBean = new ResultBean();
resultBean.standardRoiImage = standardImage; resultBean.standardRoiImage = standardImage;
Image resultImage = FixImage(standardImage, imageToCheck);
if(resultImage != null)
{
resultBean.result = true;
}
return resultBean;
}
public Image FixImage(Image standardImage, Image imageToCheck)
{
bool needCut = false; bool needCut = false;
//标准图中的Mart区域 //标准图中的Mart区域
Image markImage = GetRoiImage(standardImage, RoiPath, needCut); Image markImage = GetRoiImage(standardImage, RoiPath, needCut);
...@@ -32,15 +48,14 @@ namespace AOI ...@@ -32,15 +48,14 @@ namespace AOI
if (markImage != null && searchImage != null) if (markImage != null && searchImage != null)
{ {
var affine = GetAffineMat(markImage, searchImage); var affine = GetAffineMat(markImage, searchImage);
if(affine != null) if (affine != null)
{ {
var matToCheck = ImageUtil.ToMat(imageToCheck); var matToCheck = ImageUtil.ToMat(imageToCheck);
var fixedMat = FixImage(affine, matToCheck); var fixedMat = FixImage(affine, matToCheck);
resultBean.result = true; return ImageUtil.ToImage(fixedMat);
resultBean.currentRoiImage = ImageUtil.ToImage(fixedMat);
} }
} }
return resultBean; return null;
} }
/// <summary> /// <summary>
......
...@@ -28,12 +28,63 @@ ...@@ -28,12 +28,63 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.flatLabel1 = new Asa.Theme.FlatLabel();
this.flatTextSearch = new Asa.Theme.FlatText();
this.flatLabel2 = new Asa.Theme.FlatLabel();
this.label1 = new System.Windows.Forms.Label();
this.panParam.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// panParam
//
this.panParam.Controls.Add(this.label1);
this.panParam.Controls.Add(this.flatLabel2);
this.panParam.Controls.Add(this.flatTextSearch);
this.panParam.Controls.Add(this.flatLabel1);
//
// panResult // panResult
// //
this.panResult.Size = new System.Drawing.Size(298, 197); this.panResult.Size = new System.Drawing.Size(298, 197);
// //
// flatLabel1
//
this.flatLabel1.Inside = false;
this.flatLabel1.Location = new System.Drawing.Point(9, 33);
this.flatLabel1.Name = "flatLabel1";
this.flatLabel1.Size = new System.Drawing.Size(80, 30);
this.flatLabel1.TabIndex = 0;
this.flatLabel1.Text = "搜索区域:";
//
// flatTextSearch
//
this.flatTextSearch.Font = new System.Drawing.Font("宋体", 9F);
this.flatTextSearch.Inside = false;
this.flatTextSearch.Location = new System.Drawing.Point(170, 33);
this.flatTextSearch.Name = "flatTextSearch";
this.flatTextSearch.Size = new System.Drawing.Size(95, 30);
this.flatTextSearch.TabIndex = 1;
this.flatTextSearch.Text = "2";
//
// flatLabel2
//
this.flatLabel2.Inside = false;
this.flatLabel2.Location = new System.Drawing.Point(104, 33);
this.flatLabel2.Name = "flatLabel2";
this.flatLabel2.Size = new System.Drawing.Size(65, 30);
this.flatLabel2.TabIndex = 2;
this.flatLabel2.Text = "Mark区域x";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("黑体", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Red;
this.label1.Location = new System.Drawing.Point(70, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(162, 24);
this.label1.TabIndex = 4;
this.label1.Text = "Mark区域无效";
//
// AioMarkControl // AioMarkControl
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
...@@ -41,10 +92,17 @@ ...@@ -41,10 +92,17 @@
this.ClientSize = new System.Drawing.Size(312, 700); this.ClientSize = new System.Drawing.Size(312, 700);
this.Name = "AioMarkControl"; this.Name = "AioMarkControl";
this.TitleName = "Mark设置"; this.TitleName = "Mark设置";
this.panParam.ResumeLayout(false);
this.panParam.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private Asa.Theme.FlatLabel flatLabel2;
private Asa.Theme.FlatText flatTextSearch;
private Asa.Theme.FlatLabel flatLabel1;
private System.Windows.Forms.Label label1;
} }
} }
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!