Page 1 of 1

ImageMagick C# - convolution.

Posted: 2019-02-02T03:51:09-07:00
by eitanmiz
Hello,
I am doing convolution in C# core by using ImageMagick.Convolve() function.

When I doing the convolution manually, I got totaly different result.

The library is Magick.NET-Q16-x64.

I am using this library for 12 bits depth.

When convolution is over 4095 (2^12 - 1) or less than zero, I adjusted the value to the range of 0-4095.

If I doing manualy the convolution (like the formula - https://en.wikipedia.org/wiki/Kernel_(image_processing) ):
I got totaly different result (I had also tried to flip the upper-left corner with the right-bottom corner - Doing all the fliping combinations, like what is bottom of kernel - multiply it of top of the relative pixel of the image, etc.)

I thing that there are parameters that influent the Convolve(), but I don't know what they are. I have tried changing "FillColor", "BackgroundColor", but it is not the values).
How ImageMagick calculate the result for the current pixel? I didn't figure out how.

Also - If there is another limits (such as range of pixels of 30-3700) what is the right way doing the convolution for that limit?

I would like some code sample for that solution.

Thanks.