check point
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using Hawkeye.VisionBuilder.Workflow.Datatypes;
|
||||
using Hawkeye.VisionBuilder.Workflow.Operations.Attributes;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace Hawkeye.VisionBuilder.Workflow.Operations.Morphology;
|
||||
|
||||
[Category("Morphology")]
|
||||
public class ClosingOperation:BaseOperation
|
||||
{
|
||||
public ClosingOperation()
|
||||
{
|
||||
CanHaveProcessingError = false;
|
||||
}
|
||||
|
||||
public int Closing { get; set; } = 1;
|
||||
|
||||
protected override void InterpretInternal(Context context)
|
||||
{
|
||||
if (!CheckImageExists(context)) return;
|
||||
if (!CheckGrayscale(context)) return;
|
||||
|
||||
var element = Cv2.GetStructuringElement(MorphShapes.Ellipse, new Size(Closing, Closing));
|
||||
context.ActiveImage = new HawkeyeImage()
|
||||
{
|
||||
ImageData = context.ActiveImage!.ImageData.MorphologyEx(MorphTypes.Close, element)
|
||||
};
|
||||
|
||||
Status = $"Closing {Closing}";
|
||||
Result = true;
|
||||
}
|
||||
|
||||
public override void Save(BinaryWriter bw)
|
||||
{
|
||||
base.Save(bw);
|
||||
bw.Write(Closing);
|
||||
}
|
||||
|
||||
public override void Load(BinaryReader br)
|
||||
{
|
||||
base.Load(br);
|
||||
Closing = br.ReadInt32();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user