Syntax
Document.KernelFilter (Type [, ThresholdOrKernelSize[, MinPixel, MaxPixel, ShrinkPixels, FadePixels ]] )
Parameters
KernelFilterType Type - specifies the type of kernel filter to be applied
mxHighPassKF (0) : standard high pass filter fot a 3x3 neighbourhood
mxHighPassMoreKF (1) : standard high pass filter for a 5x5 neighbourhood
mxLowPassKF (2) : standard low pass filter for a 3x3 neighbourhood
mxLowPassMoreKF (3) : standard low pass filter for a 5x5 neighbourhood
mxDeadPixelKF (4) : dead pixel filter: replaces every pixel darker by Threshold than its darkest neighbour with the median of its surrounding pixels
mxHotPixelKF (5) : hot pixel filter: replaces every pixel brighter by Threshold than its brightest neighbour with the median of its surrounding pixels
mxAverageKF (6) : "boxcar" lowpass filter, replaces every pixel by the neigbbourhood average
mxMedianKF (7) : replaces every pixel by the neigbbourhood median
mxDilationKF (8) : replaces every pixel by the neigbbourhood maximum
mxErosionKF (9) : replaces every pixel by the neigbbourhood minimum
mxUserKF (10) : performs a user kernel filter operation. The user matrix is selected using the ThresholdOrKernelSize parameter.
mxGaussianBlur (11) : performs a Gaussian blur on the image, using a precomputed kernel whose size is approximately six times the blur radius
VARIANT ThresholdOrKernelSize - [optional] specifies the Threshold percentage for identifying Dead or Hot pxiels, the neighbourhood size (3, 5, or 7) for Average, Median, Dilation and Erosion filters, and the user kernel number for the User Kernel filter. For the Gaussian Blur filter, this parameter specifies the blur radius in pixels, which must be in the range 0.0 to 5.0.
VARIANT MinPixel - [optional] Minimum value of pixels to be filtered
VARIANT MaxPixel - [optional] Maximum value of pixels to be filtered
VARIANT ShrinkPixels - [optional] Additional distance criterion for pixels to be filtered: a pixel within this distance of a pixel less than MinPixel or greater than MaxPixel is not affected by the filter
VARIANT FadePixels - [optional] Distance at the boundary between protected and filtered pixels over which the effect of the filter is blended
Returns
Nothing
Remarks
Applies a selected kernel filter to the image. A kernel filter is one which replaces every pixel with a function of its own value and those of the pixels in a fixed-size, symmetrical neighbourhood (or "kernel") surrounding it. Ten different kernel filters are provided, selected by the value of parameter Type. Low Pass, Low Pass More, High Pass, and High Pass More use no other control parameters; Dead Pixel and Hot Pixel filters use a threshold to restrict which pixels are affected; Average, Median, Dilation, and Erosion accept a variable kernel size, and User filter accepts a number selecting which kernel is used (select 0 for the current default as set in the user interface, 1 through 10 for user kernels 1 through 12). The ThresholdOrKernelSize parameter can be omitted when using one of the Low or High pass filters.
The MinPixel, MaxPixel, ShrinkPixels and FadePixels are all optional, but either all or none must be specified. They correspond to the control parameters of the Pixel Range Restriction subdialog of the Kernel Filter dialog. MinPixel and MaxPixel should be VARIANTs of subtype Single (or convertible to Single); ShrinkPixels and FadePixels should be VARIANTs of subtype Long (or convertible to Long). If the restrictions are set so stringently that no pixels qualify for filtering, KernelFilter throws an exception.
This method is equivalent to the Kernel Filters command.