29 lines
785 B
C#
29 lines
785 B
C#
using Hawkeye.VisionBuilder.Workflow.Datatypes;
|
|
using Hawkeye.VisionBuilder.Workflow.Operations.Attributes;
|
|
|
|
namespace Hawkeye.VisionBuilder.Workflow.Operations.Image;
|
|
|
|
[Category("Image")]
|
|
public class ImageSizeOperation : BaseOperation
|
|
{
|
|
|
|
public ImageSizeOperation()
|
|
{
|
|
CanHaveProcessingError = false;
|
|
}
|
|
public int Width { get; set; } = 450;
|
|
public int Height { get; set; } = 352;
|
|
|
|
protected override void InterpretInternal(Context context)
|
|
{
|
|
if (!CheckImageExists(context)) return;
|
|
|
|
context.ActiveImage = new HawkeyeImage()
|
|
{
|
|
ImageData = context.ActiveImage.ImageData.Resize(new OpenCvSharp.Size(Width, Height))
|
|
};
|
|
|
|
Status = $"Image resized to {Width}x{Height}";
|
|
Result = true;
|
|
}
|
|
} |