/*
* ==============================================================================
*
* Filename: PMAlign
* Description:
*
* Version: 1.0
* Created: 2021/3/30 14:07:10
*
* Author: liu.wenjie
*
* ==============================================================================
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CommonMethods;
using HalconDotNet;
using ToolBase;
using static DataStruct.DataStruct;
namespace PMAlignTool
{
[Serializable]
public class PMAlign:IToolBase
{
///
/// 是否显示匹配到的模板
///
internal bool showTemplate { get; set; } = true;
///
/// 是否显示中心十字架
///
internal bool showCross { get; set; } = true;
///
/// 是否显示特征
///
internal bool showFeature { get; set; } = true;
///
/// 显示结果序号
///
internal bool showIndex { get; set; } = true;
///
/// 是否显示搜索区域
///
internal bool showSearchRegion { get; set; } = true;
///
/// 模板句柄
///
internal HTuple modelID { get; set; } = -1;
///
/// 行列间隔像素数
///
internal int spanPixelNum { get; set; } = 100;
///
/// 排序模式
///
// internal SortMode sortMode = SortMode.从上至下且从左至右;
///
/// 模板区域
///
internal HObject templateRegion { get; set; }
///
/// 在进行模板创建及匹配时进行的图像预处理
///
public ImagePreProcess imageProcess { get; set; } = new ImagePreProcess();
internal HObject totalRegion;
///
/// 搜索区域图像
///
internal HObject reducedImage;
///
/// 最小匹配分数
///
internal double minScore { get; set; } = 0.5;
///
/// 匹配个数
///
internal int matchNum { get; set; } = 1;
///
/// 起始角度
///
internal int startAngle { get; set; } = -30;
///
/// 角度范围
///
internal int angleRange { get; set; } = 30;
///
/// 角度步长
///
internal int angleStep { get; set; } = 1;
///
/// 对比度
///
internal int contrast { get; set; } = 30;
///
/// 训练时所使用的模板图像,不点击获取图像时,不进行更新
///
public HObject oldTrainImage { get; set; }
internal void DispMainWindow(object dispHWindow)
{
throw new NotImplementedException();
}
///
/// 极性
///
internal string polarity { get; set; } = "use_polarity";
///
/// 工具锁
///
private object obj { get; set; } = new object();
///
/// 模板匹配结果
///
internal List L_result = new List();
public override void Run(SoftwareRunState softwareRunState)
{
}
public override void DispImage()
{
if (inputImage != null)
{
FormPMAlignTool.Instance.myHwindow.DispHWindow.DispObj(inputImage);
}
}
public override void DispMainWindow(HWindow window)
{
throw new NotImplementedException();
}
public void CreateModelTemplate()
{
}
}
[Serializable]
public class ImagePreProcess
{
public ProcessAlg erosionValue1 { get; set; } = new ProcessAlg();
public ProcessAlg dilationValue { get; set; } = new ProcessAlg();
public ProcessAlg erosionValue2 { get; set; } = new ProcessAlg();
}
[Serializable]
public class ProcessAlg
{
public double algValue { get; set; } = 0;
public bool isEnable { get; set; } = false;
}
}