修复注释乱码
This commit is contained in:
@@ -1,64 +1,53 @@
|
||||
// ============================================================================
|
||||
// Copyright © 2026 Hexagon Technology Center GmbH. All Rights Reserved.
|
||||
// 文件� EllipseDetectionProcessor.cs
|
||||
// æ��è¿°: æ¤åœ†æ£€æµ‹ç®—å�,基于轮廓分æž�å’Œæ¤åœ†æ‹Ÿå�ˆæ£€æµ‹å›¾åƒ�ä¸çš„æ¤åœ?
|
||||
// 文件名: EllipseDetectionProcessor.cs
|
||||
// 描述: 椭圆检测算子,基于轮廓分析和椭圆拟合检测图像中的椭圆
|
||||
// 功能:
|
||||
// - 阈值分�+ 轮廓��
|
||||
// - æ¤åœ†æ‹Ÿå�ˆï¼ˆFitEllipseï¼?
|
||||
// - �积/轴长/离心�拟�误差多维过滤
|
||||
// - 支��阈值分割和 Otsu 自动阈�
|
||||
// 算法: 阈值分�+ OpenCV FitEllipse
|
||||
// 作� �伟 wei.lw.li@hexagon.com
|
||||
// - 阈值分割 + 轮廓提取
|
||||
// - 椭圆拟合(FitEllipse)
|
||||
// - 面积/轴长/离心率/拟合误差多维过滤
|
||||
// - 支持双阈值分割和 Otsu 自动阈值
|
||||
// 算法: 阈值分割 + OpenCV FitEllipse
|
||||
// 作者: 李伟 wei.lw.li@hexagon.com
|
||||
// ============================================================================
|
||||
|
||||
using Emgu.CV;
|
||||
using Emgu.CV.CvEnum;
|
||||
using Emgu.CV.Structure;
|
||||
using Emgu.CV.Util;
|
||||
using XP.ImageProcessing.Core;
|
||||
using Serilog;
|
||||
using System.Drawing;
|
||||
using XP.ImageProcessing.Core;
|
||||
|
||||
namespace XP.ImageProcessing.Processors;
|
||||
|
||||
/// <summary>
|
||||
/// æ¤åœ†æ£€æµ‹ç»“æž?
|
||||
/// 椭圆检测结果
|
||||
/// </summary>
|
||||
public class EllipseInfo
|
||||
{
|
||||
/// <summary>序号</summary>
|
||||
public int Index { get; set; }
|
||||
|
||||
/// <summary>中心点X</summary>
|
||||
public float CenterX { get; set; }
|
||||
|
||||
/// <summary>中心点Y</summary>
|
||||
public float CenterY { get; set; }
|
||||
|
||||
/// <summary>长轴长度</summary>
|
||||
public float MajorAxis { get; set; }
|
||||
|
||||
/// <summary>短轴长度</summary>
|
||||
public float MinorAxis { get; set; }
|
||||
|
||||
/// <summary>旋转角度(度�/summary>
|
||||
/// <summary>旋转角度(度)</summary>
|
||||
public float Angle { get; set; }
|
||||
|
||||
/// <summary>面积</summary>
|
||||
public double Area { get; set; }
|
||||
|
||||
/// <summary>周长</summary>
|
||||
public double Perimeter { get; set; }
|
||||
|
||||
/// <summary>离心çŽ?(0=åœ? 接近1=æ‰�æ¤åœ?</summary>
|
||||
/// <summary>离心率 (0=圆, 接近1=扁椭圆)</summary>
|
||||
public double Eccentricity { get; set; }
|
||||
|
||||
/// <summary>拟合误差(像素)</summary>
|
||||
public double FitError { get; set; }
|
||||
|
||||
/// <summary>轮廓点集</summary>
|
||||
public Point[] ContourPoints { get; set; } = Array.Empty<Point>();
|
||||
|
||||
/// <summary>外接矩形</summary>
|
||||
public Rectangle BoundingBox { get; set; }
|
||||
}
|
||||
@@ -81,7 +70,7 @@ public class EllipseDetector
|
||||
public double MaxFitError { get; set; } = 5.0;
|
||||
public int Thickness { get; set; } = 2;
|
||||
|
||||
/// <summary>执行æ¤åœ†æ£€æµ?/summary>
|
||||
/// <summary>执行椭圆检测</summary>
|
||||
public List<EllipseInfo> Detect(Image<Gray, byte> inputImage, Image<Gray, byte>? roiMask = null)
|
||||
{
|
||||
_logger.Debug("Ellipse detection started: UseOtsu={UseOtsu}, MinThreshold={Min}, MaxThreshold={Max}",
|
||||
@@ -197,7 +186,7 @@ public class EllipseDetector
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// æ¤åœ†æ£€æµ‹ç®—å?
|
||||
/// 椭圆检测算子
|
||||
/// </summary>
|
||||
public class EllipseDetectionProcessor : ImageProcessorBase
|
||||
{
|
||||
@@ -211,7 +200,7 @@ public class EllipseDetectionProcessor : ImageProcessorBase
|
||||
|
||||
protected override void InitializeParameters()
|
||||
{
|
||||
// ── 多边形ROI(由UI注入,最�2个点�──
|
||||
// ── 多边形ROI(由UI注入,最多32个点) ──
|
||||
Parameters.Add("PolyCount", new ProcessorParameter("PolyCount", "PolyCount", typeof(int), 0, null, null, "") { IsVisible = false });
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
@@ -311,4 +300,4 @@ public class EllipseDetectionProcessor : ImageProcessorBase
|
||||
_logger.Information("Ellipse detection completed: detected {Count} ellipses", ellipses.Count);
|
||||
return inputImage.Clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user