These pages are auto-generated from self-documenting comments embedded in class files.
For more information on breve and steve, refer to the breve homepage.

Abstract : Image

This class is included as part of the file Image.tz.
To use this class in a simulation, include the line "@use Image."

Class description:

The Image class provides an interface to work with images and textures. The individual pixels of the image can be read or changed by the simulation as desired.

The image class can read rendered images from the screen using the method read-pixels, so that agents in the 3D world can have access to real rendered data. In addition, the method get-pixel-pointer can be used to provide a pointer to the RGBA pixel data so that plugins can access and analyze image data. This could be used, among other things, to implement agent vision.

Class methods:

Loading and creating Images

Getting information about the size and format of an image

Getting the value of pixels

Setting the value of pixels

Reading Pixels from the Screen

Getting a Pointer to Pixel Data

Writing an image to a file


get-alpha-pixel at-x x (int) at-y y (int)

Returns the alpha channel pixel at the image coordinates (x, y). The pixel value is given on a scale from 0.0 to 1.0.


get-blue-pixel at-x x (int) at-y y (int)

Returns the blue pixel at the image coordinates (x, y). The pixel value is given on a scale from 0.0 to 1.0.


get-compression-size

Compresses the image and returns the compression size. Useful for generating simple complexity measures based on image compression.


get-green-pixel at-x x (int) at-y y (int)

Returns the green pixel at the image coordinates (x, y). The pixel value is given on a scale from 0.0 to 1.0.


get-height

Returns the width of the image.


get-pixel-pointer

Returns a pointer to the pixels this image is holding in RGBA format. The size of the buffer is 4 * height * width. This data is provided for plugin developers who wish to read or write pixel data directly.


get-red-pixel at-x x (int) at-y y (int)

Returns the red pixel at the image coordinates (x, y). The pixel value is given on a scale from 0.0 to 1.0.


get-rgb-pixel at-x x (int) at-y y (int)

Returns the red, green and blue components of the pixel at image coordinates (x, y) as a vector.


get-width

Returns the width of the image.


load from imageFile (string)

Loads an image from the file imageFile.


read-depth at-x x (int) at-y y (int) linearize lin (int) max-dist dist (float)

Reads the depth into this Image from the rendered image on the screen. The resulting image can be written to a file or analyzed if desired. This is only supported in graphical versions of breve. The linearize option (if true) linearizes the depth buffer to a maximum distance so that for each pixel, the value corresponds to the distance from the centre of the camera. Values above the maximum distance (max-dist) are set to the maximum distance. If linearize is false, then this returns the raw depth buffer. This is considerably faster, but the values are not linear in the distance.


read-pixels at-x x (int) at-y y (int)

Reads pixels into this Image from the rendered image on the screen. The resulting image can be written to a file or analyzed if desired. This is only supported in graphical versions of breve.


set-alpha-pixel to alphaPixel (float) at-x x (int) at-y y (int)

Sets the alpha pixel value at coordinates (x, y) to alphaPixel. alphaPixel should be a value between 0.0 and 1.0.


set-blue-pixel to bluePixel (float) at-x x (int) at-y y (int)

Sets the blue pixel value at coordinates (x, y) to bluePixel. bluePixel should be a value between 0.0 and 1.0.


set-green-pixel to greenPixel (float) at-x x (int) at-y y (int)

Sets the green pixel value at coordinates (x, y) to greenPixel. greenPixel should be a value between 0.0 and 1.0.


set-red-pixel to redPixel (float) at-x x (int) at-y y (int)

Sets the red pixel value at coordinates (x, y) to redPixel. redPixel should be a value between 0.0 and 1.0.


set-rgb-pixel to pixelVector (vector) at-x x (int) at-y y (int)

Sets the red, green and blue pixel values at image coordinates (x, y) from the values in pixelVector.


set-size width imageWidth (int) height imageHeight (int)

Creates an empty image buffer with width imageWidth and length imageLength.


write to imageFile (string)

Write the image to imageFile. The image is written as a PNG file, so imageFile should end with .PNG.


write-16-bit-grayscale to imageFile (string)

Write the image to imageFile. The image is written as a PNG file, so imageFile should end with .PNG.


Documentation created Sun Oct 7 19:13:02 2007