CImage:PixGELE


The PixGELE method returns the coordinates of the first pixel having a value above a target value or outside a range of values. If the pixel is not found, the coordinate 0, which is outside the image, is returned.

Syntax

x,y,z,... = CImage:PixGELE( nHighValue )

x,y,z,... = CImage:PixGELE( nHighValue, nLowValue )

where

    For a 2-D image, CRect specifies the column and row range for the search.

    nHighValue is the high target value, specified by a number or string.

    nLowValue is the low target value, specified by a number or string.

    x,y,z,... are the coordinates of the pixel.

    On success, x,y,z,... is returned (1 value per image dimension).

    On failure, 0,0,0,... is returned.

  

This method locates the first pixel meeting the criterion by searching the image serquentially, effectively treating it as a 1-dimensional data array. The first pixel with value at or beyond the limits stops the search. The related PixGE method finds a pixel value using only the >= criterion.

Example

The following script opens a 2-D image from the file sPath, then searches for the first pixel with <= -100 or >= +100. The search is limited to columns 100:200 and rows 250:350:

I = CImage:new()

-- Create a CImage

I:Open( sPath )

-- Open the image from sPath.

R = NewRect(100,200,250,350)

-- create a rectangle, columns 100:200 and rows 250:350

x,y = I:PixGELE(R,100,-100)

-- Find the first pixel with value >= 100 or <= -100

I:delete()

-- delete the CImage from memory

R:delete()

-- delete the CRect from memory

Related Topics

PixGE

CImage class