using Hawkeye.VisionBuilder.Workflow.Datatypes; using Hawkeye.VisionBuilder.Workflow.Operations.Attributes; namespace Hawkeye.VisionBuilder.Workflow.Operations.Basic; [Category("Basic")] public class CannyOperation:BaseOperation { public int Threshold1 { get; set; } = 100; public int Threshold2 { get; set; } = 200; protected override void InterpretInternal(Context context) { if (!CheckImageExists(context)) return; context.ActiveImage = new HawkeyeImage() { ImageData = context.ActiveImage.ImageData.Canny(Threshold1, Threshold2) }; Status = $"Canny with Threshold1={Threshold1} and Threshold2={Threshold2}"; Result = true; } public override void Save(BinaryWriter bw) { base.Save(bw); bw.Write(Threshold1); bw.Write(Threshold2); } public override void Load(BinaryReader br) { base.Load(br); Threshold1 = br.ReadInt32(); Threshold2 = br.ReadInt32(); } }