check point
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using Hawkeye.VisionBuilder.Workflow.Datatypes;
|
||||
using Hawkeye.VisionBuilder.Workflow.Operations.Attributes;
|
||||
|
||||
namespace Hawkeye.VisionBuilder.Workflow.Operations.Morphology;
|
||||
|
||||
[Category("Morphology")]
|
||||
public class SubtractOperation : BaseOperation
|
||||
{
|
||||
public string SlotName { get; set; } = "Image";
|
||||
|
||||
public SubtractOperation()
|
||||
{
|
||||
CanHaveProcessingError = false;
|
||||
}
|
||||
|
||||
protected override void InterpretInternal(Context context)
|
||||
{
|
||||
if (!CheckImageExists(context)) return;
|
||||
if (!CheckGrayscale(context)) return;
|
||||
|
||||
if (!context.Memory.ContainsKey(SlotName))
|
||||
{
|
||||
Status = "Slot not found";
|
||||
Result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var first = context.ActiveImage;
|
||||
var second = context.Memory[SlotName];
|
||||
|
||||
context.ActiveImage = new HawkeyeImage()
|
||||
{
|
||||
ImageData = first.ImageData - second.ImageData
|
||||
};
|
||||
|
||||
Result = true;
|
||||
}
|
||||
|
||||
public override void Save(BinaryWriter bw)
|
||||
{
|
||||
base.Save(bw);
|
||||
}
|
||||
|
||||
public override void Load(BinaryReader br)
|
||||
{
|
||||
base.Load(br);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user