CImage:FiltClipLow


The FiltClipLow method replaces values below a threshold value with a different value. In other words, values below the threshold are "clipped" and replaced with another value.

Syntax

bSuccess = CImage:FiltClipLow( nClipValue, nNewValue )

bSuccess = CImage:FiltClipLow( nClipValue, nNewValue, CRect )

where

    nClipValue is the threshold value, specified by a number or string.

    nNewValue is the replacement value, specified by a number or string.

    CRect is a CRect object that specifies the region using 1-based coordinates.

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

  

This method examines the value of each pixel inside CRect. If value < nClipValue then the pixel is replaced with nNewValue. If CRect is omitted or passed as nil, then the entire image is processed.

If the image has a numeric data type and you pass an rgb string for either value, the rgb string is converted to an equivalent numeric intensity.

Example

The following script opens an image from the file at sPath and replaces values below 0 with 0. The clipping region is constrained to the rectangle defined by columns 100:200 and rows 250:350:

I = CImage:new()

-- Create a CImage

I:Open( sPath )

-- Open the image from sPath.

R = NewRect()

-- create a rectangle

R:Set( 100, 200, 250, 350 )

-- columns 100:200, rows 250:350

I:FiltClipLow( 0, 0, R )

-- Clip values below 0

I:Save()

-- save the image

Related Topics

FiltClipHigh

ApplyPixelMask

CImage class