7447463c1a
- Core: Pose2D、Point2D、RoiAlignment、AlignmentRecipe(示教多边形→运行图刚体变换) - Processors: TemplateMatchAlignmentExtensions.ToPose2D / 四角与中心一致性校验 Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
976 B
C#
22 lines
976 B
C#
namespace XP.ImageProcessing.Core.Alignment;
|
|
|
|
/// <summary>
|
|
/// 示教阶段保存的对齐配方:基准位姿 + 示教图像素坐标下的检测 ROI。
|
|
/// </summary>
|
|
public sealed class AlignmentRecipe
|
|
{
|
|
/// <summary>示教图上的基准位姿(建议示教图自匹配得到,或与模板 ROI 中心 + 角度 0 一致)。</summary>
|
|
public Pose2D ReferencePose { get; set; }
|
|
|
|
/// <summary>示教图上的 ROI 多边形顶点(至少 3 点)。</summary>
|
|
public List<Point2D> RoiPoints { get; set; } = new();
|
|
|
|
/// <summary>将示教 ROI 变换到运行图坐标。</summary>
|
|
public Point2D[] TransformRoi(Pose2D measuredPose)
|
|
=> RoiAlignment.TransformPolygon(RoiPoints, ReferencePose, measuredPose);
|
|
|
|
/// <summary>变换为整型顶点,供检测算子注入。</summary>
|
|
public (int X, int Y)[] TransformRoiToInt(Pose2D measuredPose)
|
|
=> RoiAlignment.TransformPolygonToInt(RoiPoints, ReferencePose, measuredPose);
|
|
}
|