123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using PaintDotNet.Data.Param;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PaintDotNet.Data.Action
- {
- /// <summary>
- /// 物相间距
- /// </summary>
- public class Action1010 : ParamObject
- {
- /// <summary>
- /// 无视场执行提取
- /// </summary>
- /// <param name="src"></param>
- /// <returns></returns>
- public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src)
- {
- return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, this.Lists);
- }
- /// <summary>
- /// 多视场执行提取
- /// </summary>
- /// <param name="src">视场mat</param>
- /// <param name="mat">原图mat</param>
- /// <returns></returns>
- public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src, OpenCvSharp.Mat mat)
- {
- return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, mat, this.Lists);
- }
- /// <summary>
- /// 用于初始化参数
- /// </summary>
- public Action1010()
- {
- this.MenuId = ActionType.ActionBinaryExtraction;
- this.OpenImage = "current";
- //默认1个颜色区间
- BooleanObject colorInterval = new BooleanObject();
- colorInterval.key = "colorInterval";
- colorInterval.name = PdnResources.GetString("Menu.inverse.text");
- colorInterval.initialValue = 1;
- colorInterval.value = 1;
- lists.Add(colorInterval);
- //第一个参数
- List<double> oneL = new List<double>();
- oneL.Add(0);
- oneL.Add(0);
- DecimalScope one = new DecimalScope(0, 255);
- one.key = "scope1";
- one.name = PdnResources.GetString("Menu.Colorinterval.text");
- one.value = oneL;
- lists.Add(one);
- List<double> twoL = new List<double>();
- twoL.Add(0);
- twoL.Add(0);
- DecimalScope two = new DecimalScope(0, 255);
- two.key = "scope2";
- two.name = PdnResources.GetString("Menu.Colorinterval.text");
- two.value = twoL;
- lists.Add(two);
- List<double> threeL = new List<double>();
- threeL.Add(0);
- threeL.Add(0);
- DecimalScope three = new DecimalScope(0, 255);
- three.key = "scope3";
- three.name = PdnResources.GetString("Menu.Colorinterval.text");
- three.value = threeL;
- lists.Add(three);
- BooleanObject autoThreshold = new BooleanObject();
- autoThreshold.key = "autoThreshold";
- autoThreshold.name = PdnResources.GetString("Menu.Automaticthreshold.text");
- autoThreshold.initialValue = false;
- autoThreshold.value = false;
- lists.Add(autoThreshold);
- //处理细节
- BooleanObject deleteBoundaryObject = new BooleanObject();
- deleteBoundaryObject.key = "deleteBoundaryObject";
- deleteBoundaryObject.name = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Deleteboundaryobject.text");
- deleteBoundaryObject.initialValue = false;
- deleteBoundaryObject.value = false;
- lists.Add(deleteBoundaryObject);
- BooleanObject holeFilling = new BooleanObject();
- holeFilling.key = "holeFilling";
- holeFilling.name = PdnResources.GetString("Menu.BinaryAction.HoleFilling.Text");
- holeFilling.initialValue = false;
- holeFilling.Value = false;
- lists.Add(holeFilling);
- BooleanObject debrisRemoval = new BooleanObject();
- debrisRemoval.key = "debrisRemoval";
- debrisRemoval.name = PdnResources.GetString("Menu.Clasticdelete.text");
- debrisRemoval.initialValue = false;
- debrisRemoval.value = false;
- lists.Add(debrisRemoval);
- List<double> fiveL = new List<double>();
- fiveL.Add(0);
- fiveL.Add(0);
- DecimalScope five = new DecimalScope(0, int.MaxValue);
- five.key = "scope4";
- five.name = PdnResources.GetString("Menu.suiarea.Text");
- five.value = fiveL;
- lists.Add(five);
- //二值样式
- //实心/边线 1实心 2边线
- IntegerNumber binaryType = new IntegerNumber(0, 1);
- binaryType.key = "binaryStyle";
- binaryType.name = PdnResources.GetString("Menu.Binarystyle.text");
- binaryType.Value = 1;
- lists.Add(binaryType);
- ColorNumber phaseColor = new ColorNumber();
- phaseColor.key = "phaseColor";
- phaseColor.name = PdnResources.GetString("Menu.Phasecolor.text");
- phaseColor.Value = Color.Red.ToArgb();
- lists.Add(phaseColor);
- //目标选择,用于视场 1/2/3
- IntegerNumber targetSelection = new IntegerNumber(1, 3);
- targetSelection.key = "targetSelection";
- targetSelection.name = PdnResources.GetString("Menu.Targetselection.text");
- targetSelection.Value = 1;
- lists.Add(targetSelection);
- }
- }
- }
|