规范类名及命名空间名称

This commit is contained in:
李伟
2026-04-13 14:35:37 +08:00
parent c430ec229b
commit ace1c70ddf
217 changed files with 1271 additions and 1384 deletions
@@ -0,0 +1,80 @@
// ============================================================================
// Copyright 穢 2026 Hexagon Technology Center GmbH. All Rights Reserved.
// ? GrayscaleProcessor.cs
// 讛膩: 啣漲曇蓮摮琜脣㦛讛蓮V蛹啣漲
// :
// - 啣漲頧祆揢嚗
// - 撟喳
// - 憭批
// - 撠誩
// 蝞埈: 撟喳瘜?Gray = 0.299*R + 0.587*G + 0.114*B
// 雿𡏭? 𦒘 wei.lw.li@hexagon.com
// ============================================================================
using Emgu.CV;
using Emgu.CV.Structure;
using Serilog;
using XP.ImageProcessing.Core;
namespace XP.ImageProcessing.Processors;
/// <summary>
/// 啣漲曇蓮摮?
/// </summary>
public class GrayscaleProcessor : ImageProcessorBase
{
private static readonly ILogger _logger = Log.ForContext<GrayscaleProcessor>();
public GrayscaleProcessor()
{
Name = LocalizationHelper.GetString("GrayscaleProcessor_Name");
Description = LocalizationHelper.GetString("GrayscaleProcessor_Description");
}
protected override void InitializeParameters()
{
Parameters.Add("Method", new ProcessorParameter(
"Method",
LocalizationHelper.GetString("GrayscaleProcessor_Method"),
typeof(string),
"Weighted",
null,
null,
LocalizationHelper.GetString("GrayscaleProcessor_Method_Desc"),
new string[] { "Weighted", "Average", "Max", "Min" }));
_logger.Debug("InitializeParameters");
}
public override Image<Gray, byte> Process(Image<Gray, byte> inputImage)
{
string method = GetParameter<string>("Method");
// 憒颲枏撌脩摨血㦛嚗峕覔格䲮瘜閗?
var result = inputImage.Clone();
switch (method)
{
case "Average":
// 撖嫣撌脩摨衣銝齿㺿睃㦛?
break;
case "Max":
// 憓𧼮撩鈭桀漲
result = result * 1.2;
break;
case "Min":
// 鈭桀漲
result = result * 0.8;
break;
case "Weighted":
default:
// 靽脲
break;
}
_logger.Debug("Process: Method = {Method}", method);
return result;
}
}