修复注释乱码

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,6 +1,6 @@
// ============================================================================
// Copyright © 2026 Hexagon Technology Center GmbH. All Rights Reserved.
// 文件å? RetinexProcessor.cs
// 文件名: RetinexProcessor.cs
// 描述: 基于Retinex的多尺度阴影校正算子
// 功能:
// - 单尺度Retinex (SSR)
@@ -8,19 +8,19 @@
// - 带色彩恢复的多尺度Retinex (MSRCR)
// - 光照不均匀校正
// - 阴影去除
// 算法: Retinexç†è®º - 将图åƒåˆ†è§£ä¸ºå射分é‡å’Œå…‰ç…§åˆ†é‡?
// 作è€? æŽä¼Ÿ wei.lw.li@hexagon.com
// 算法: Retinex理论 - 将图像分解为反射分量和光照分量
// 作者: 李伟 wei.lw.li@hexagon.com
// ============================================================================
using Emgu.CV;
using Emgu.CV.Structure;
using Serilog;
using XP.ImageProcessing.Core;
using Serilog;
namespace XP.ImageProcessing.Processors;
/// <summary>
/// Retinex多尺度阴影校正算�
/// Retinex多尺度阴影校正算子
/// </summary>
public class RetinexProcessor : ImageProcessorBase
{
@@ -145,7 +145,7 @@ public class RetinexProcessor : ImageProcessorBase
// 高斯模糊得到光照分量
Image<Gray, float> blurred = new Image<Gray, float>(inputImage.Size);
int kernelSize = (int)(sigma * 6) | 1; // ç¡®ä¿ä¸ºå¥‡æ•?
int kernelSize = (int)(sigma * 6) | 1; // 确保为奇数
if (kernelSize < 3) kernelSize = 3;
CvInvoke.GaussianBlur(floatImage, blurred, new System.Drawing.Size(kernelSize, kernelSize), sigma);
@@ -162,7 +162,7 @@ public class RetinexProcessor : ImageProcessorBase
// R = log(I) - log(I*G)
Image<Gray, float> retinex = logImage - logBlurred;
// 应用增益和åç§?
// 应用增益和偏移
retinex = retinex * gain + offset;
// 归一化到0-255
@@ -183,7 +183,7 @@ public class RetinexProcessor : ImageProcessorBase
/// </summary>
private Image<Gray, byte> MultiScaleRetinex(Image<Gray, byte> inputImage, double[] sigmas, double gain, int offset)
{
// 转æ¢ä¸ºæµ®ç‚¹å›¾åƒ?
// 转换为浮点图像
Image<Gray, float> floatImage = inputImage.Convert<Gray, float>();
floatImage = floatImage + 1.0f;
@@ -197,7 +197,7 @@ public class RetinexProcessor : ImageProcessorBase
}
}
// 累加多个尺度的结�
// 累加多个尺度的结果
Image<Gray, float> msrResult = new Image<Gray, float>(inputImage.Size);
msrResult.SetZero();
@@ -229,10 +229,10 @@ public class RetinexProcessor : ImageProcessorBase
// 平均
msrResult = msrResult / sigmas.Length;
// 应用增益和åç§?
// 应用增益和偏移
msrResult = msrResult * gain + offset;
// 归一�
// 归一化
Image<Gray, byte> result = NormalizeToByteImage(msrResult);
floatImage.Dispose();
@@ -244,14 +244,14 @@ public class RetinexProcessor : ImageProcessorBase
/// <summary>
/// 带色彩恢复的多尺度Retinex (MSRCR)
/// 对于ç°åº¦å›¾åƒï¼Œä½¿ç”¨ç®€åŒ–版æœ?
/// 对于灰度图像,使用简化版本
/// </summary>
private Image<Gray, byte> MultiScaleRetinexCR(Image<Gray, byte> inputImage, double[] sigmas, double gain, int offset)
{
// 先执行MSR
Image<Gray, byte> msrResult = MultiScaleRetinex(inputImage, sigmas, gain, offset);
// 对于ç°åº¦å›¾åƒï¼Œè‰²å½©æ¢å¤ç®€åŒ–为对比度增å¼?
// 对于灰度图像,色彩恢复简化为对比度增强
Image<Gray, float> floatMsr = msrResult.Convert<Gray, float>();
Image<Gray, float> floatInput = inputImage.Convert<Gray, float>();
@@ -285,7 +285,7 @@ public class RetinexProcessor : ImageProcessorBase
/// </summary>
private Image<Gray, byte> NormalizeToByteImage(Image<Gray, float> floatImage)
{
// 找到最å°å€¼å’Œæœ€å¤§å€?
// 找到最小值和最大值
double minVal = double.MaxValue;
double maxVal = double.MinValue;