CImage:FiltBinomial


The FiltBinomial method smooths an image by applying a filter kernel having binomial coefficient weights.

Syntax

bSuccess = CImage:FiltBinomial( cols, rows )

bSuccess = CImage:FiltBinomial( 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 an elliptical filter kernel having binomial coefficient weights such as 1,2,1 or 1,4,6,4,1. For large size, of order 10 pixels or more this approximates a Gaussian.

Setting cols = rows makes the filter asymmetric in the column and row directions but the filter cannot be rotated to an intermediate angle. For a rotated filter kernel, use FiltGaussian or FiltEllipse

Example

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

I = V:GetImage()

-- attach the current displayed image

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

-- setup the rectangle to process

I:FiltBinomial( 5, 5, R )

-- apply the filter

V:Update()

-- update the display after the scale

Related Topics

FiltGaussian

FiltEllipse

FiltRect

CImage class