feat: ROI 对齐工具与 TM_Result 位姿扩展
- Core: Pose2D、Point2D、RoiAlignment、AlignmentRecipe(示教多边形→运行图刚体变换) - Processors: TemplateMatchAlignmentExtensions.ToPose2D / 四角与中心一致性校验 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using XP.ImageProcessing.Core.Alignment;
|
||||
|
||||
namespace XP.ImageProcessing.Processors;
|
||||
|
||||
/// <summary>
|
||||
/// 将 TemplateMatchLib 匹配结果转换为对齐工具使用的 <see cref="Pose2D"/>。
|
||||
/// </summary>
|
||||
public static class TemplateMatchAlignmentExtensions
|
||||
{
|
||||
public static Pose2D ToPose2D(this TM_Result result)
|
||||
=> new(result.CenterX, result.CenterY, result.Angle);
|
||||
|
||||
/// <summary>四角质心是否与 Center 一致(容差默认 1 像素)。</summary>
|
||||
public static bool IsCenterConsistentWithCorners(this TM_Result result, double tolerancePixels = 1.0)
|
||||
=> RoiAlignment.IsMatchCenterConsistentWithCorners(
|
||||
result.CenterX,
|
||||
result.CenterY,
|
||||
result.LtX,
|
||||
result.LtY,
|
||||
result.RtX,
|
||||
result.RtY,
|
||||
result.RbX,
|
||||
result.RbY,
|
||||
result.LbX,
|
||||
result.LbY,
|
||||
tolerancePixels);
|
||||
}
|
||||
Reference in New Issue
Block a user