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.

Syntax

bResult = CImage:FiltGaussian( sigma, ratio, angle, CRect=nil )

bullet.gif    sigma is the kernel major axis length, in pixels.

bullet.gif    ratio is ratio of minor to major axes, which is 1.0 or less.

bullet.gif    angle is the rotation angle in degrees.

bullet.gif    CRect is the rectangle defining the area to process. If omitted, it defaults to nil and the entire image is processed.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, this method returns false.

Remarks

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.

Example

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:

I = V:GetImage()

-- attach the current displayed image

R = new_rect(100,300,400,800)

-- setup the rectangle to process

I:FiltGaussian(10,0.5,45,R)

-- apply the filter

V:Update()

-- update the display after the scale

R:delete()

-- done with the CRect

Related Topics

CImage class, FiltEllipse, FiltBinomial, FiltRect


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.