*Offset*The Offset parameter is added to the resulting color value to "push" its value off by that amount. The embossing kernel uses a value of 128 to push the colors into the extreme. This is what gives the grayed metallic background effect since the resulting values often go over the 255 limit and therefore get clamped.

*Scale*The Scale parameter is used to give each filter item a dividing value. Since each filter item is an integer, you use this value to give the effect of decimal precision. For example, if you need an item to have the values range between +1 and -1 we would give a scale value of a multiple of ten. If you need the item’s value to be .12, you would specify 12 as the filter item value and a scale of 100. The blurring kernel uses a scale of 100 since its items are all decimal values.

*Kernel*The Kernel parameter must be a 2 dimensional array of integers that contain the actual filter kernel values.

How does it work? You can mentally think of the filter matrix as a mask that moves over each pixel in the image with the target pixel represented by the matrix’s center value. First the center is multiplied by its corresponding matrix value. Then, each of the neighboring pixels is multiplied by their coefficients and is added to the target pixels multiplied value. You can see how math intensive this process must be!

Have fun with your filters. If you come up with some cool kernels, Email them to us and we may include it as a built-in kernel in our next release. Or if you just want to collect and trade them with others, post it on our ImageMan Online Forum.

Filtering is only supported on 16, 24, and 32 bit images. For all other images, use the IncreaseTo method to increase the color depth to an appropriate bitdepth.

Copy Code | |
---|---|

' Filter an image using a 3x3 Emboss kernel Dim Kernel(2, 2) As Integer Kernel(0, 0) = -1 Kernel(0, 1) = 0 Kernel(0, 2) = 0 Kernel(1, 0) = 0 Kernel(1, 1) = 0 Kernel(1, 2) = 0 Kernel(2, 0) = 0 Kernel(2, 1) = 0 Kernel(2, 2) = 1 ' Apply the filter with an offset of 128 ImageControl1.FilterLow 128, 0, Kernel ImageControl1.Refresh |