CImage:FiltRect


The FiltRect method smooths an image by applying a filter kernel having equal weights in a rectangular shape.

Syntax

bSuccess = CImage:FiltRect( cols, rows )

bSuccess = CImage:FiltRect( cols, rows, CRect )

where

    cols is the column length of the filter kernel.

    rows is the row length of the filter kernel.

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

    bSuccess is the returned success code. On success it is true, otherwise false.

  

This method smooths the image using a rectangle shaped filter kernel having equal weights. By comparison, FiltBinomial uses an elliptical shape with binomial coefficient weights. Both of these filters are elongated parallel to the x or y axis. Conversely, the FiltGaussian and FiltEllipse methods can be rotated to a specified angle.

Example

Suppose an image is displayed in a CImageView named V. The following script smooths the region [100:300, 400:800] using a 25x25 Rectangle filter:

I = V:GetImage()

-- attach the current displayed image

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

-- setup the rectangle to process

I:FiltRect(25,25,R)

-- apply the filter

V:Update()

-- update the display after the scale

R:delete()

-- done with the CRect

Related Topics

FiltBinomial

FiltEllipse

FiltGaussian

CImage class