CImage:SetRegionVal
The SetRegionVal method sets the pixel values inside a rectangular region to a specified value and noise. In comparison, the SetRegionValExclude method sets the pixels outside a rectangular region.
bResult = CImage:SetRegionVal( CRect, value, sigma ) |
The region is specified by a CRect, using 1-based coordinates.
value is the value to assign to the region.
sigma is the sigma for a Gaussian random noise distribution.
On success, true is returned.
On failure, false is returned.
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.
The following script opens an image from the file at sPath, then assigns the value 1800.5 to all pixels inside the rectangle defined by columns 100:200 and rows 250:350:
|
-- Create a CImage |
|
-- Open the image from sPath. |
|
-- create a rectangle |
|
-- Set new pixel values inside the rectangle |
|
-- save the modified image |
CImage class, SetRegionValExclude, AddNoise, SetVal, FiltClipHigh
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.