修复注释乱码

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,26 +1,26 @@
// ============================================================================
// Copyright © 2026 Hexagon Technology Center GmbH. All Rights Reserved.
// 文件å? HorizontalEdgeProcessor.cs
// 文件名: HorizontalEdgeProcessor.cs
// 描述: 水平边缘检测算子,专门用于检测水平方向的边缘
// 功能:
// - 检测水平边�
// - 检测水平边缘
// - 支持Prewitt和Sobel算子
// - 可调节检测灵敏度
// - 适用于检测水平线条和纹理
// 算法: Prewitt/Sobel水平算子
// 作è€? æŽä¼Ÿ wei.lw.li@hexagon.com
// 作者: 李伟 wei.lw.li@hexagon.com
// ============================================================================
using Emgu.CV;
using Emgu.CV.CvEnum;
using Emgu.CV.Structure;
using Serilog;
using XP.ImageProcessing.Core;
using Serilog;
namespace XP.ImageProcessing.Processors;
/// <summary>
/// 水平边缘检测算�
/// 水平边缘检测算子
/// </summary>
public class HorizontalEdgeProcessor : ImageProcessorBase
{
@@ -92,15 +92,15 @@ public class HorizontalEdgeProcessor : ImageProcessorBase
private Image<Gray, byte> ApplySobel(Image<Gray, byte> inputImage, double sensitivity, int threshold)
{
// 使用Sobelç®—å­æ£€æµ‹æ°´å¹³è¾¹ç¼˜ï¼ˆYæ–¹å‘导数ï¼?
// 使用Sobel算子检测水平边缘(Y方向导数)
Image<Gray, float> sobelY = new Image<Gray, float>(inputImage.Size);
CvInvoke.Sobel(inputImage, sobelY, DepthType.Cv32F, 0, 1, 3);
// 转æ¢ä¸ºç»å¯¹å€¼å¹¶åº”ç”¨çµæ•åº?
// 转换为绝对值并应用灵敏度
Image<Gray, byte> result = new Image<Gray, byte>(inputImage.Size);
CvInvoke.ConvertScaleAbs(sobelY, result, sensitivity, 0);
// 应用阈�
// 应用阈值
if (threshold > 0)
{
CvInvoke.Threshold(result, result, threshold, 255, ThresholdType.Binary);
@@ -141,10 +141,10 @@ public class HorizontalEdgeProcessor : ImageProcessorBase
sum -= inputData[y + 1, x, 0];
sum -= inputData[y + 1, x + 1, 0];
// å–ç»å¯¹å€¼å¹¶åº”ç”¨çµæ•åº?
// 取绝对值并应用灵敏度
int value = (int)(Math.Abs(sum) * sensitivity);
// 应用阈�
// 应用阈值
if (value > threshold)
{
outputData[y, x, 0] = (byte)Math.Min(255, value);
@@ -161,11 +161,11 @@ public class HorizontalEdgeProcessor : ImageProcessorBase
private Image<Gray, byte> ApplySimple(Image<Gray, byte> inputImage, double sensitivity, int threshold)
{
// 简å•差分算å­?
// 简单差分算子
// [ 1 1 1]
// [ 0 0 0]
// [-1 -1 -1]
// 但æƒé‡æ›´ç®€å?
// 但权重更简单
int width = inputImage.Width;
int height = inputImage.Height;
@@ -182,7 +182,7 @@ public class HorizontalEdgeProcessor : ImageProcessorBase
int diff = inputData[y - 1, x, 0] - inputData[y + 1, x, 0];
int value = (int)(Math.Abs(diff) * sensitivity);
// 应用阈�
// 应用阈值
if (value > threshold)
{
outputData[y, x, 0] = (byte)Math.Min(255, value);