CImage:AddNoise
The AddNoise method adds noise to the pixel values inside a rectangular region.
bResult = CImage:AddNoise( CRect, sigma ) |
This method adds Gaussian random noise to the pixel values. The noise may be positive or negative relative to the existing pixel value. To set a pixel value plus noise, rather than add noise to the existing value, use SetRegionVal.
The following script fragment opens an image from the file at sPath, then add noise with a Gaussian sigma of 7.6 to all pixels in columns 100:200 and rows 250:350:
|
-- Create a CImage |
|
-- Open the image from sPath. |
|
-- create a rectangle |
|
-- columns 100:200, rows 250:350 |
|
-- add Gaussian noise |
|
-- save the image |
|
-- delete the CImage from memory |
|
-- delete the CRect from memory |