CImage:CreatePixelMask
The CreatePixelMask method creates a pixel mask file containing the coordinates of pixels that exceed an upper or lower threshold. Compared with CreatePixelMaskHigh and CreatePixelMaskLow, this method tests both thresholds.
bSuccess = CImage:CreatePixelMask( sMask, vHigh, vLow ) bSuccess = CImage:CreatePixelMask( sMask, vHigh, vLow, CRect ) where |
sMask is the name of the text file where the pixel mask will be saved.
vHigh is the high threshold value, and may be a number or a string.
vLow is the low value threshold, and may be a number or a string.
CRect is the target rectangle, If nil, then the entire image is searched.
bSuccess is the returned success code. On success it is true, otherwise false.
This method produces a text file consisting of pixel coordinate pairs, one per line, in the form column, row. This format is described in the topic Pixel Mask File. To examine only the upper threshold or lower threshold use one of the other methods, CreatePixelMaskHigh or CreatePixelMaskLow.
The following script makes a pixel mask containing the coordinates of pixel values above 32000 and below -32000 in the central 50% of the image:
|
-- Create a CImage |
|
-- Open the image from sPath. |
|
-- create a rectangle |
|
-- get the image size |
|
-- central 50% of columns and rows |
|
-- set the threshold values |
|
-- create the pixel mask |