我在哪里可以找到C#的非锐化掩码?

时间:2021-12-31 15:04:12

I have been trying to find a code snippet to do an unsharp mask in C# but cant find one that works or is complete. I found a PHP version but I would like to find one in C# before I go through all the hard work converting this from PHP.

我一直试图找到一个代码片段来在C#中做一个非锐化的掩码,但是找不到一个有效或完整的掩码。我找到了一个PHP版本,但我想在C#中找到一个,然后才能完成从PHP转换所有这些工作。

I am just a beginner. Can anyone point me in the right direction?

我只是个初学者。谁能指出我正确的方向?

5 个解决方案

#1


The AForge.NET Framework includes many image processing filters and support plugging your own. You can see it in action in their own Image Processing Lab application.

AForge.NET Framework包含许多图像处理过滤器并支持自己插入。您可以在自己的图像处理实验室应用程序中查看它。


UPDATE: AForge.NET has a convolution-based sharpen filter (see convolution filters), but there's no mention of an unsharp mask filter per se. Then again, you can use the Gaussian blur filter and subtract the result from the original image, which is basically what the unsharp mask filter does. Or maybe the basic sharpen is enough for your needs.

更新:AForge.NET有一个基于卷积的锐化滤波器(参见卷积滤波器),但是没有提到一个非锐化的掩码滤波器本身。然后,您可以使用高斯模糊滤镜并从原始图像中减去结果,这基本上是非锐化蒙版滤镜的作用。或者基本的锐化可能足以满足您的需求。


UPDATE: Looked further, and AForge.NET does have a Gaussian sharpen which seems to be an implemenation of an unsharp mask filter, and you can control some parameters.

更新:进一步看,AForge.NET确实有高斯锐化,这似乎是一个非锐化掩码过滤器的实现,你可以控制一些参数。

#2


Would you care to use FFTs? Transform, remove or accentuate high freqs to taste, invert the transform, recombine with the original if desired? Hardly any licensing issues there, as FFT libraries abound.

你愿意使用FFT吗?如果需要,转换,移除或强调高频率的味道,反转变换,与原始频率重新组合?由于FFT库比比皆是,因此几乎没有任何许可问题。

Alternately, you can make up masks by hand, varying size and constants as you like, then convolve them with your image pixels (nested 'for' loops ...).

或者,您可以手工制作蒙版,根据需要改变大小和常数,然后将它们与图像像素进行卷积(嵌套'for'循环...)。

Here's a 3x3x1 mask as a text file with its dimensions given before the values:

这是一个3x3x1掩码作为文本文件,其值在值之前给出:

//3x3x1

// x size

// x大小

3

// y size

//大小

3

//z size

1

//z = 0

// z = 0

2 3 2

2 3 2

3 5 3

3 5 3

2 3 2

2 3 2

//end

This can be extended to 3 dimensions (hence the z size being given).

这可以扩展到3维(因此给出z大小)。

#3


The latest version of the open source C# Image Library has an unsharp mask filter (as well as gaussian blur, brightness/contrast etc) and is very easy to use.

最新版本的开源C#图像库具有非锐化掩模滤镜(以及高斯模糊,亮度/对比度等),并且非常易于使用。

You'll find a tutorial how to apply an unsharp mask here.

您将在此处找到如何应用非锐化蒙版的教程。

#4


See if this blog entry helps you in the right direction:

看看此博客条目是否可以帮助您找到正确的方向:

http://anand-vinay.blogspot.com/2008/01/unsharp-mask-in-cnet.html

Edit: Okay that blog entry did not work, sorry for the bad link.

编辑:好的,博客条目不起作用,抱歉链接不好。

I did find a complete application that you can download with source which has the code that I think you are looking for.

我找到了一个完整的应用程序,您可以使用源码下载,其中包含我认为您正在寻找的代码。

http://www.ctyeung.com/Csharp/index.html

#5


Christian Graus's Image Processing for Dummies with C# part 2 contains source code, and an explanation of how you can do unsharpen (assuming you mean smoothing). The whole series is an excellent introduction to image processing with GDI (in C#) and requires no external libraries.

Christian Graus使用C#第2部分对Dummies进行图像处理包含源代码,并解释如何进行unsharpen(假设您的意思是平滑)。整个系列是使用GDI(在C#中)进行图像处理的绝佳介绍,不需要外部库。

#1


The AForge.NET Framework includes many image processing filters and support plugging your own. You can see it in action in their own Image Processing Lab application.

AForge.NET Framework包含许多图像处理过滤器并支持自己插入。您可以在自己的图像处理实验室应用程序中查看它。


UPDATE: AForge.NET has a convolution-based sharpen filter (see convolution filters), but there's no mention of an unsharp mask filter per se. Then again, you can use the Gaussian blur filter and subtract the result from the original image, which is basically what the unsharp mask filter does. Or maybe the basic sharpen is enough for your needs.

更新:AForge.NET有一个基于卷积的锐化滤波器(参见卷积滤波器),但是没有提到一个非锐化的掩码滤波器本身。然后,您可以使用高斯模糊滤镜并从原始图像中减去结果,这基本上是非锐化蒙版滤镜的作用。或者基本的锐化可能足以满足您的需求。


UPDATE: Looked further, and AForge.NET does have a Gaussian sharpen which seems to be an implemenation of an unsharp mask filter, and you can control some parameters.

更新:进一步看,AForge.NET确实有高斯锐化,这似乎是一个非锐化掩码过滤器的实现,你可以控制一些参数。

#2


Would you care to use FFTs? Transform, remove or accentuate high freqs to taste, invert the transform, recombine with the original if desired? Hardly any licensing issues there, as FFT libraries abound.

你愿意使用FFT吗?如果需要,转换,移除或强调高频率的味道,反转变换,与原始频率重新组合?由于FFT库比比皆是,因此几乎没有任何许可问题。

Alternately, you can make up masks by hand, varying size and constants as you like, then convolve them with your image pixels (nested 'for' loops ...).

或者,您可以手工制作蒙版,根据需要改变大小和常数,然后将它们与图像像素进行卷积(嵌套'for'循环...)。

Here's a 3x3x1 mask as a text file with its dimensions given before the values:

这是一个3x3x1掩码作为文本文件,其值在值之前给出:

//3x3x1

// x size

// x大小

3

// y size

//大小

3

//z size

1

//z = 0

// z = 0

2 3 2

2 3 2

3 5 3

3 5 3

2 3 2

2 3 2

//end

This can be extended to 3 dimensions (hence the z size being given).

这可以扩展到3维(因此给出z大小)。

#3


The latest version of the open source C# Image Library has an unsharp mask filter (as well as gaussian blur, brightness/contrast etc) and is very easy to use.

最新版本的开源C#图像库具有非锐化掩模滤镜(以及高斯模糊,亮度/对比度等),并且非常易于使用。

You'll find a tutorial how to apply an unsharp mask here.

您将在此处找到如何应用非锐化蒙版的教程。

#4


See if this blog entry helps you in the right direction:

看看此博客条目是否可以帮助您找到正确的方向:

http://anand-vinay.blogspot.com/2008/01/unsharp-mask-in-cnet.html

Edit: Okay that blog entry did not work, sorry for the bad link.

编辑:好的,博客条目不起作用,抱歉链接不好。

I did find a complete application that you can download with source which has the code that I think you are looking for.

我找到了一个完整的应用程序,您可以使用源码下载,其中包含我认为您正在寻找的代码。

http://www.ctyeung.com/Csharp/index.html

#5


Christian Graus's Image Processing for Dummies with C# part 2 contains source code, and an explanation of how you can do unsharpen (assuming you mean smoothing). The whole series is an excellent introduction to image processing with GDI (in C#) and requires no external libraries.

Christian Graus使用C#第2部分对Dummies进行图像处理包含源代码,并解释如何进行unsharpen(假设您的意思是平滑)。整个系列是使用GDI(在C#中)进行图像处理的绝佳介绍,不需要外部库。