using OpenCvSharp; using PaintDotNet.Base.Enum; using PaintDotNet.Base.Functionodel; using PaintDotNet.Data.Param; using System.Drawing; namespace PaintDotNet.Data.Action { /// /// 物相提取 /// public class Action902 : ParamObject { public override Mat PerformProcess(Mat hls, Mat rgb, Mat origin, PhaseModel model, System.Drawing.Point point) { return Adjust.PhaseExtractionIntent.ImagePhaseExtractionWithView(hls, rgb, origin, model, point, this.Lists); } public override Mat PerformProcess(Mat rgb, Mat origin, PhaseModel model, System.Drawing.Point point) { return Adjust.PhaseExtractionIntent.ImagePhaseExtractionWithView(rgb, null, origin, model, point, this.Lists); } public override Mat PerformProcess(Mat src, PhaseModel model, System.Drawing.Point point) { return Adjust.PhaseExtractionIntent.ImagePhaseExtraction(src, model, point, this.Lists); } public Action902() { this.MenuId = ActionType.ActionPhaseExtraction; this.OpenImage = ""; #region 整个图像 ChoiseArray defineObject = new ChoiseArray("defineObject", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Definetheobject.text"), new BooleanObject[] { new BooleanObject("item1", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.click.text"), true, new IntegerNumber[]{ new IntegerNumber(0, 100, 0, "allowable", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.admissiblevalue.text")), new IntegerNumber(0, 100, 0, "scopeSize", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Rangesize.text")) }), new BooleanObject("item2", PdnResources.GetString("Menu.contour.text"), false, new StringArray[]{ new StringArray("contourObject", PdnResources.GetString("Menu.quyuname.Text"), InvariantData.contourparameters, ContourParameters.Polygon) } ) } ); StringArray binaryTypeA = new StringArray(); binaryTypeA.key = "binaryType"; binaryTypeA.name = PdnResources.GetString("Menu.Binarystyle.text"); binaryTypeA.initialValue = InvariantData.styleparameters; binaryTypeA.Value = StyleParameters.Solid; StringArray targetProcess = new StringArray(); targetProcess.key = "targetProcess"; targetProcess.name = PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Targetprocessing.text"); targetProcess.initialValue = InvariantData.processingparameters; targetProcess.Value = ProcessingParameters.Add; ChoiseArray setColor = new ChoiseArray("setColor", PdnResources.GetString("Menu.Setting.Text"), new BooleanObject[] { new BooleanObject("RGBColor", "RGB", true, new DecimalScope[] { new DecimalScope(0, 255, 0, "RColor", "R"), new DecimalScope(0, 255, 0, "GColor", "G"), new DecimalScope(0, 255, 0, "BColor", "B") } ), new BooleanObject("HLSColor", "HLS",false, new DecimalScope[] { new DecimalScope(0, 255, 0, "HColor", "H"), new DecimalScope(0, 255, 0, "LColor", "L"), new DecimalScope(0, 255, 0, "SColor", "S") } ) } ); #endregion #region 单个目标 ChoiseArray binaryType = new ChoiseArray("binaryType", PdnResources.GetString("Menu.Binarystyle.text"), new BooleanObject[] { new BooleanObject("fill", PdnResources.GetString("Menu.solid.text"), true, null), new BooleanObject("solid", PdnResources.GetString("Menu.Sideline.text"), false, null) } ); #endregion StringArray objectSelect = new StringArray(); objectSelect.key = "objectSelect"; objectSelect.name = PdnResources.GetString("Menu.Targetselection.text"); objectSelect.initialValue = InvariantData.fieldofviewparameters; objectSelect.Value = FieldOfViewParameters.One; BooleanObject wholeObject = new BooleanObject("wholeObject", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Wholeimage.text"), true, null); wholeObject.Lists.Add(defineObject); wholeObject.Lists.Add(binaryTypeA); wholeObject.Lists.Add(targetProcess); wholeObject.Lists.Add(new BooleanObject("deleteRect", PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Deleteboundaryobject.text"), null)); wholeObject.Lists.Add(new BooleanObject("holeFill", PdnResources.GetString("Menu.BinaryAction.HoleFilling.Text"), null)); wholeObject.Lists.Add(new BooleanObject("bitsDelete", PdnResources.GetString("Menu.Clasticdelete.text"), null)); wholeObject.Lists.Add(new DecimalScope(0, 100, 0, "bitsDeleteScope", PdnResources.GetString("Menu.suiarea.Text"))); wholeObject.Lists.Add(setColor); BooleanObject single = new BooleanObject("singleObject", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Singletarget.text"), false, null); single.Lists.Add(new IntegerNumber(0, 100, 0, "offset", PdnResources.GetString("Menu.deviation.Text"))); single.Lists.Add(binaryType); ChoiseArray oneParam = new ChoiseArray("scopeChoise", PdnResources.GetString("Menu.Binaryoperation.Phaseextraction.Extractionmode.text"), null); oneParam.choiseList.Add(wholeObject); oneParam.choiseList.Add(single); oneParam.choiseList.Add(objectSelect); lists.Add(oneParam); } } }