规范类名及命名空间名称
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
// ============================================================================
|
||||
// Copyright © 2026 Hexagon Technology Center GmbH. All Rights Reserved.
|
||||
// 文件� GaussianBlurProcessor.cs
|
||||
// æ��è¿°: 高斯模糊算å�,用于图åƒ�平滑和é™�噪
|
||||
// 功能:
|
||||
// - é«˜æ–¯æ ¸å�·ç§¯å¹³æ»?
|
||||
// - å�¯è°ƒèŠ‚æ ¸å¤§å°�å’Œæ ‡å‡†å·®
|
||||
// - 有效去除高斯噪声
|
||||
// - ��边缘相对清晰
|
||||
// 算法: 高斯滤波器��
|
||||
// 作� �伟 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 GaussianBlurProcessor : ImageProcessorBase
|
||||
{
|
||||
private static readonly ILogger _logger = Log.ForContext<GammaProcessor>();
|
||||
|
||||
public GaussianBlurProcessor()
|
||||
{
|
||||
Name = LocalizationHelper.GetString("GaussianBlurProcessor_Name");
|
||||
Description = LocalizationHelper.GetString("GaussianBlurProcessor_Description");
|
||||
}
|
||||
|
||||
protected override void InitializeParameters()
|
||||
{
|
||||
Parameters.Add("KernelSize", new ProcessorParameter(
|
||||
"KernelSize",
|
||||
LocalizationHelper.GetString("GaussianBlurProcessor_KernelSize"),
|
||||
typeof(int),
|
||||
5,
|
||||
1,
|
||||
31,
|
||||
LocalizationHelper.GetString("GaussianBlurProcessor_KernelSize_Desc")));
|
||||
|
||||
Parameters.Add("Sigma", new ProcessorParameter(
|
||||
"Sigma",
|
||||
LocalizationHelper.GetString("GaussianBlurProcessor_Sigma"),
|
||||
typeof(double),
|
||||
1.5,
|
||||
0.1,
|
||||
10.0,
|
||||
LocalizationHelper.GetString("GaussianBlurProcessor_Sigma_Desc")));
|
||||
_logger.Debug("InitializeParameters");
|
||||
}
|
||||
|
||||
public override Image<Gray, byte> Process(Image<Gray, byte> inputImage)
|
||||
{
|
||||
int kernelSize = GetParameter<int>("KernelSize");
|
||||
double sigma = GetParameter<double>("Sigma");
|
||||
|
||||
if (kernelSize % 2 == 0) kernelSize++;
|
||||
|
||||
var result = inputImage.Clone();
|
||||
CvInvoke.GaussianBlur(inputImage, result,
|
||||
new System.Drawing.Size(kernelSize, kernelSize), sigma);
|
||||
_logger.Debug("Process: KernelSize = {KernelSize}, Sigma = {Sigma}", kernelSize, sigma);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user