CImage:SetRegionVal
The SetRegionVal method sets the pixel values inside a rectangular region.
bResult = CImage:SetRegionVal( CRect, value, sigma ) |
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 data 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 in columns 100:200 and rows 250:350:
|
-- Create a CImage |
|
-- Open the image from sPath. |
|
-- create a rectangle |
|
-- Set the new pixel value |
|
-- save the modified image |