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 { /// /// 物相间距 /// public class Action1010 : ParamObject { /// /// 无视场执行提取 /// /// /// public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src) { return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, this.Lists); } /// /// 多视场执行提取 /// /// 视场mat /// 原图mat /// public override OpenCvSharp.Mat PerformProcess(OpenCvSharp.Mat src, OpenCvSharp.Mat mat) { return Adjust.BinaryExtractionIntent.ImageBinaryExtraction(src, mat, this.Lists); } /// /// 用于初始化参数 /// 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 oneL = new List(); 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 twoL = new List(); 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 threeL = new List(); 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 fiveL = new List(); 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); } } }