CImage:DivFlatNorm CImage:SubBiasFrame

CImage:SetMaskedValue


The SetMaskedValue method assigns a new value to pixels at coordinates stored in a pixel mask file. One application of this method is for repairing small small defects in the form of points and single-pixel wide lines.

Syntax

bResult = CImage:SetMaskedValue( value, sMaskFile, CRect=nil )

bullet.gif    value is a number or string specifying the replacement value.

bullet.gif    sMaskFile is the name of the text file containing the pixel mask.

bullet.gif    The rectangular region to repair is specified by a CRect, with 1-based coordinates. If omitted, the entire image is repaired.

bullet.gif    On success, this method returns true.

bullet.gif    On failure, false is returned.

Remarks

This method replaces pixels with a new value specified by the value argument. The target coordinates are loaded from a Pixel Mask File. The related ApplyPixelMask method replaces pixels with a locally computed neighborhood value rather than a fixed value.

Example

Assume that a pixel mask file named sMaskFile exists. The following script sets pixel values to -1000 at coordinates listed in the pixel mask file. The CRect argument is not used so that the entire image is available. Note: The entire image could also be used with the CRect argument after calling CRect:SetToImage:

I = new_image()

-- Create a CImage

I:Open( sPath )

-- Open the image from sPath.

I:SetMaskedValue(-1000,sMaskFile)

-- apply the pixel mask

I:Save()

-- save the image

I:delete()

-- delete the CImage from memory

Related Topics

CImage class, ApplyPixelMask, Pixel Mask File


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