English 中文(简体)
Coding UnsharpMask without Fourier functions
原标题:

I am doing some image processing code in C#, but I cant use any libraries or GNU like code.

The UnsharpMask function depends on Gaussian blur which in turn depends on Fourier Transforms. I wrote code for all this and things are working, but to make a long story short, I need to remove the FFT functions. Is there any way to perform unsharp mask in another way that perhaps does not need FFT?

最佳回答

I found a solution to fit my needs.

I tried several quick and dirty blurring algorithms and found both Box Blur and Stack Blur to be sufficient. Stack Blur has a cleaner blur then Box Blur and is several times faster then Gaussian. So I can use either one in place of Gaussian.

So now I can get rid of all the FFT code mess and replace it with something much more manageable. This solution might not be for everyone, but since UnsharpMask is based on blurring, I did not feel that it was too exact of a science.

By the way Gimp s Gaussian blur seems to be avoiding FFTs as well.

问题回答

The Fourier transform part of a Gaussian blur is just an efficient way of doing the convolution with a Gaussian kernel. You can do it using straight forward convolution with a Gaussian kernel of the appropriate standard deviation and size (an odd size kernel around 5-6 times the standard deviation is about right).

See Convolution on Wikipedia.

I believe that even if you can t use any libraries or GNU thingy, you can look at their implementation and try to reproduce similar code for your requirements ?

openCV function list. check out the function details here and then the implementation details in the header files. http://opencv.willowgarage.com/documentation/genindex.html

Also if you are interested in C# based implementation I would suggest the following http://aforgenet.com/framework/





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签