CImage:SetRegionValExclude


The SetRegionValExclude method sets the pixel values outside a rectangular region to a specified value and noise. In comparison, the SetRegionVal method sets the pixels inside a rectangular region.

Syntax

bResult = CImage:SetRegionValExclude( CRect, value, sigma )

bullet.gif    The region is specified by a CRect, using 1-based coordinates.

bullet.gif    value is the value to assign to the region.

bullet.gif    sigma is the sigma for a Gaussian random noise distribution.

bullet.gif    On success, true is returned.

bullet.gif    On failure, false is returned.

Remarks

This method replaces the pixel values by a single value and Gaussian random noise. To set only the pixel value, pass sigma=0. To add only noise, use set value=0 or use the AddNoise method.

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

Example

The following script opens an image from the file at sPath, then assigns the value 1800.5 to all pixels outside 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(100,200,250,350)

-- create a rectangle

I:SetRegionValExclude( R,1800.5, 0 )

-- Set new pixel values outside the rectangle

I:Save()

-- save the modified image

Related Topics

CImage class, SetRegionVal, AddNoise, SetVal, FiltClipHigh


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