修复注释乱码

This commit is contained in:
李伟
2026-04-14 17:11:31 +08:00
parent b8bcefc84b
commit cd03e30bb8
58 changed files with 761 additions and 767 deletions
@@ -1,23 +1,23 @@
// ============================================================================
// Copyright © 2026 Hexagon Technology Center GmbH. All Rights Reserved.
// ? ContourProcessor.cs
// 文件名: ContourProcessor.cs
// 描述: 轮廓查找算子,用于检测和分析图像中的轮廓
// 功能:
// - 瘚见㦛譍葉刻蔭撱?
// - 检测图像中的外部轮廓
// - 根据面积范围过滤轮廓
// - 霈∠頧桀雿閧鸌敺Y妖𪂹葉敹亦畆敶Y嚗?
// - 颲枏枂頧桀靽⊥靘𥕦蝏剖?
// 蝞埈: OpenCV蔭撱𤘪瘚讠瘜?
// 雿𡏭? 𦒘 wei.lw.li@hexagon.com
// - 计算轮廓的几何特征(面积、周长、中心、外接矩形等)
// - 输出轮廓信息供后续处理使用
// 算法: 基于OpenCV的轮廓检测算法
// 作者: 李伟 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;
@@ -117,7 +117,7 @@ public class ContourProcessor : ImageProcessorBase
OutputData.Clear();
// 𥕦遣颲枏祉鍂鈭𤾸?
// 创建输入图像的副本用于处理
Image<Gray, byte> processImage = inputImage.Clone();
// 步骤1:如果启用阈值分割,先进行二值化
@@ -128,18 +128,18 @@ public class ContourProcessor : ImageProcessorBase
if (useOtsu)
{
// 雿輻鍂Otsu芸𢆡?
// 使用Otsu自动阈值
CvInvoke.Threshold(processImage, thresholdImage, 0, 255, ThresholdType.Otsu);
_logger.Debug("Applied Otsu threshold");
}
else
{
// 雿輻鍂?
// 使用固定阈值
CvInvoke.Threshold(processImage, thresholdImage, thresholdValue, 255, ThresholdType.Binary);
_logger.Debug("Applied binary threshold with value {ThresholdValue}", thresholdValue);
}
// 靽嘥讐鍂鈭舘霂?
// 保存阈值处理后的图像用于调试
try
{
string debugPath = Path.Combine("logs", $"contour_threshold_{DateTime.Now:yyyyMMdd_HHmmss}.png");
@@ -156,7 +156,7 @@ public class ContourProcessor : ImageProcessorBase
processImage = thresholdImage;
}
// 甇仿炊2嚗𡁜𦦵𤌍糓暺𤏸𠧧嚗屸頧砍㦛?
// 步骤2:如果目标是黑色区域,需要反转图像
bool isBlackTarget = targetColor != null &&
(targetColor.Equals("Black", StringComparison.OrdinalIgnoreCase) ||
targetColor.Equals("黑色", StringComparison.OrdinalIgnoreCase));
@@ -180,7 +180,7 @@ public class ContourProcessor : ImageProcessorBase
}
}
// 甇仿炊3嚗𡁏䰻曇蔭撱?
// 步骤3:查找轮廓
using (VectorOfVectorOfPoint contours = new VectorOfVectorOfPoint())
{
Mat hierarchy = new Mat();