LowPass Method
Syntax
CWIMAQVision.LowPass SourceImage, DestImage [, XFilterSize = 3] [, YFilterSize = 3] [, Tolerance = 40.0] [, MaskImage]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Calculates the interpixel variation between the pixel being processed and those pixels surrounding it. If the pixel being processed has a variation greater than a specified percentage, it is set to the average pixel value as calculated from the neighboring pixels.
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 U8, I16, and SGL images. MaskImage must be a U8 image.
The source and destination images must be the same type of image.
The filter modifies the border of the source image. The connected source image must have been created with a border capable of supporting 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 function is optimized for MMX.
Parameters
SourceImage As CWIMAQImage
The input image.
DestImage As CWIMAQImage
The resulting image.
XFilterSize As Variant
[Optional] The size of the horizontal matrix axis. This number must be odd.
This parameter has a default value of 3.
YFilterSize As Variant
[Optional] The size of the vertical matrix axis. This number must be odd.
This parameter has a default value of 3.
Tolerance As Variant
[Optional] The maximum percentage variation allowed.
This parameter has a default value of 40.0.
MaskImage As Variant
[Optional] A CWIMAQImage object that indicates the region of the image where the convolution is applied. The method processes only those pixels in the image whose corresponding pixels in the mask are non-zero. Do not set this parameter if you want to filter the entire image.
Example
Dim i As New CWIMAQImage Dim maskImage As New CWIMAQImage ' Apply a low-pass filter to a portion of the image in Viewer1 ' defined by regions selected on Viewer1. ' Store the result in i. CWIMAQVision1.RegionsToMask maskImage, CWIMAQViewer1.Regions CWIMAQVision1.LowPass CWIMAQViewer1.Image, i, , , , _ maskImage