修复注释乱码
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user