Convolute Method
Syntax
CWIMAQVision.Convolute SourceImage, DestImage, BorderMethod, Kernel [, MaskImage]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Applies a linear filter to an image by convolving the image with a filtering kernel.
Remarks
This method modifies the source image. If you need the original source image, create a copy of the image using the CWIMAQVision.Copy method before using this method.
Use this method with image types U8, I16, and SGL. The source and the destination images must be the same type of image. MaskImage must be a U8 image. The convolution matrix must have an odd width and height. The source image must have been created with a border capable of using the size of the convolution matrix. A 3 x 3 matrix must have a minimum border of 1, a 5 x 5 matrix must have a minimum border of 2, and so on. The border size of the destination image is not important.
This functions is optimized for MMX.
Parameters
SourceImage As CWIMAQImage
The image to process.
DestImage As CWIMAQImage
The resulting image.
BorderMethod As CWIMAQBorderMethods
The method used to fill the border of the image before processing it.
Kernel As CWIMAQKernel
The convolution matrix.
MaskImage As Variant
[Optional] A CWIMAQImage object that contains the mask applied to the source image. MaskImage specifies the region of the source image in which the method applies the convolution. The method applies the convolution to only those source pixels whose corresponding mask pixels are non-zero. Do not set this parameter if you want the method to convolve the entire image.
Example
Dim i As New CWIMAQImage Dim k As New CWIMAQKernel ' Perform a convolution using a gradient filter on the image in Viewer1. ' Store the result in i. k.LoadKernel cwimaqKernelGradient, 3, 2 CWIMAQVision1.Convolute CWIMAQViewer1.Image, i, cwimaqBorderCopy, k