CImage:FiltGaussian
The FiltGaussian method smooths an image by applying a filter kernel having Gaussian weights in an elliptical shape. The filter can be rotated.
bResult = CImage:FiltGaussian( sigma, ratio, angle, CRect=nil ) |
sigma is the kernel major axis length, in pixels.
ratio is ratio of minor to major axes, which is 1.0 or less.
angle is the rotation angle in degrees.
CRect is the rectangle defining the area to process. If omitted, it defaults to nil and the entire image is processed.
On success, this method returns true.
On failure, this method returns false.
This method smooths the image using an elliptical shaped filter kernel having Gaussian weights. By comparison, FiltEllipse uses an elliptical shape with equal weights.
This filter is specified in terms of its major axis. Be wary of the apparent small size of the filter based on its sigma value. The filter extends to 2.5 x sigma along the semi-major axis. Therefore specifying sigma=3 produces a filter kernel 2 x 3 x 2.5 = 15 pixels wide. Note that the processing time increases in proportion to the product filter width x filter height; processing a 15x15 kernel takes 9 times longer than processing a 5x5 kernel.
Suppose an image is displayed in a CImageView named V. The following script smooths the region [100:300, 400:800] using a 10x5 Gaussian filter rotated 45 degrees:
|
-- attach the current displayed image |
|
-- setup the rectangle to process |
|
-- apply the filter |
|
-- update the display after the scale |
|
-- done with the CRect |
CImage class, FiltEllipse, FiltBinomial, FiltRect
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.