CImage:Get


The Get method returns the pixel value at the specified image coordinates. The value is returned as a number, even for an RGB data type. For an RGB image, the pixel value is converted to a number using the standard color to luminance conversion. To fetch the color channel values, use the Gets method which returns a string containing the separate color channel values.

Syntax

nVal = CImage:Get( x[] )

nVal = CImage:Get( x )

nVal = CImage:Get( x, y )

nVal = CImage:Get( 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:Get(53,400)

-- Return the pixel value at x,y

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

-- print the pixel value

Related Topics

Gets

Getn

Getr

Set

CImage class