CImage:Getn


The Getn method returns the pixel value at the specified image coordinates of an image having numeric data type. To fetch the pixel value for an RGB image, use the Getr or Gets method. To return the value from an image of any data type as a numeric value, use the general Get method.

Syntax

nVal = CImage:Getn( x[] )

nVal = CImage:Getn( x )

nVal = CImage:Getn( x, y )

nVal = CImage:Getn( x, y, z )

where

    x[] is a coordinate array.

    x,y, z are column, row, and plane pixel coordinates, respectively, and may be passed as numbers or strings.

    nVal is a number.

Example

The following script shows an image at path sPath being opened and the pixel value at column 53, row 400 being printed to a standard text window:

I = CImage:new()

-- Create a CImage

I:Open( sPath )

-- Open the image from file path sPath.

n = I:Getn(53,400)

-- Return the pixel value at x,y

Printf("value=%lg\n",n)

-- print the numeric pixel value

Related Topics

Get

Getr

Gets

Set

CImage class