check point

This commit is contained in:
meelstorm
2025-07-14 12:03:59 +02:00
commit d3cb790bd9
431 changed files with 44078 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
using Hawkeye.VisionBuilder.Workflow;
using Hawkeye.VisionBuilder.Workflow.Datatypes.Elements;
using OpenCvSharp;
namespace VisionBuilder.UI.Recipes.HawkeyeRecipe;
public class OpenCVCanvas:ICanvas
{
private readonly Mat _image;
public OpenCVCanvas(Mat image)
{
_image = image;
}
public void DrawRectangle(Vector2 start, Vector2 size, bool isGood)
{
_image.Rectangle(
new Point(start.X, start.Y),
new Point(start.X + size.X, start.Y + size.Y),
isGood ? Scalar.Green : Scalar.Red,
2);
}
public void DrawLine(Vector2 start, Vector2 end, LineType type)
{
var color = type switch
{
LineType.Good => Scalar.Green,
LineType.Bad => Scalar.Red,
_ => Scalar.White
};
_image.Line(
new Point(start.X, start.Y),
new Point(end.X, end.Y),
color,
2);
}
public void DrawPoly(Vector2[] points, bool isGood)
{
var color = isGood ? Scalar.Green : Scalar.Red;
var cvPoints = points.Select(p => new Point(p.X, p.Y)).ToArray();
_image.Polylines([cvPoints], true, color, 2);
}
public void DrawCross(Vector2 location)
{
throw new NotImplementedException();
}
public void DrawNode(Vector2 location)
{
throw new NotImplementedException();
}
public void DrawArrow(Vector2 location, Vector2 direction)
{
throw new NotImplementedException();
}
}