Pixel Mask File CImage:FiltClipLow

CImage:FiltClipHigh


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

Syntax

bResult = CImage:FiltClipHigh( nClipValue, nNewValue, CRect=nil )

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

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

bullet.gif    The region is specified by a CRect, with 1-based coordinates and may be nil.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, false is returned.

Remarks

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 pixel 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 above 32000 with 32767. The clipping region is constrained to the rectangle defined by columns 100:200 and rows 250:350:

I = new_image()

-- Create a CImage

I:Open( sPath )

-- Open the image from sPath.

R = new_rect()

-- create a rectangle

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

-- columns 100:200, rows 250:350

I:FiltClipHigh(32000,32767,R)

-- Clip values above 32000

I:Save()

-- save the image

I:delete()

-- delete the CImage from memory

R:delete()

-- delete the CRect from memory

Related Topics

CImage class, FiltClipLow, ApplyPixelMask


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