ImageTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Graphics : Image Processing : ImageTools Package : ImageTools/Create

ImageTools

  

Create

  

create an image

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

Create( height, width, layers, data, opts)

Parameters

height

-

(optional) {nonnegint, range(integer)}; the height of the image in pixels

width

-

(optional) {nonnegint, range(integer)}; the width of the image in pixels

layers

-

(optional) 1,3,4, 1..3, or 1..4; the layers in the image

data

-

(optional); data with which to initialize the image

opts

-

(optional) equation(s) of the form option = value; specify options for the Create command

Options

• 

background = color

  

Specifies the initial background color of the image. Valid values for color are black, white, a numeric value, and a list of 3 or 4 numeric values. 0 corresponds to black, and 1 to white. The default is black.

• 

channels = 1, 3, or 4

  

Specifies the number of color channels. A value of 1 results in a monochrome image. Values of 3 and 4 produce RGB and RGBA images, respectively. The default is 1 (monochrome). If the data parameter is specified, this option is ignored.

• 

copy = truefalse

  

Specifies what happens when the data parameter is already an rtable of a suitable format. If true, then a new rtable is created and the data is copied into it. If false and the order of data matches the specified order, data becomes the image rtable returned by Create. If the data is not in a form suitable to being an image rtable, a new rtable is always created, regardless of the setting of the copy option. The default is false.

• 

format = Array, Matrix

  

Specifies whether the created image is an Array or Matrix. A Matrix is possible only for grayscale images. The default is Array.

• 

order = C_order, Fortran_order

  

Specifies how the data is stored in memory. See Fortran_order. Unlike rtable, the default is C_order.

• 

fit = truefalse

  

If true, scales all layers so that the intensity is between 0 and 1.  Calls FitIntensity. The default is false.

Description

• 

The Create command creates an image.

• 

The optional height and width parameters specify the image height and width dimensions, in pixels. If an integer, then the index ranges from one to that value. If a range of integers, then that is used for the index range.

• 

The optional layers parameter specifies the number of layers in the image.  There may be 1, 3, or 4 layers in an image. The layers parameter is equivalent to the channels option. If specified as a range, the left side of the range must be 1.

Initialization Data

  

The optional data parameter specifies data that is used to initialize the image. It can be a 2D or 3D Array, a Matrix, a list of numeric lists, a list of lists of numeric lists, a procedure, a list of procedures, a set of equations of the form index=value, or a table.

• 

If data is an Array or Matrix (instances of rtables), the resulting image rtable is an Array or Matrix, respectively. The order is inherited from the input rtable.

  

If the input rtable has datatype=float[8], storage=rectangular and no indexing functions, the rtable becomes the image rtable (that is, no copy is made) unless the copy=true option is specified.

• 

If data is a list of numeric lists, the number of elements in the main list determines the number of rows in the image, and the number of elements in the first sublist determines the number of columns. The result is a 2D Array, giving a single-channel (grayscale) image. Each sublist becomes a row in the image, and each value in the sublist becomes one pixel in that row. If any subsequent sublists are longer than the first, the extra values are ignored. Shorter sublists are padded with the value specified by the background option described below.

• 

If data is a list of lists of numeric lists, the number of elements in the outer list determines the number of rows in the image, the number of elements in the first sublist determines the number of columns, and the number of elements in the first sub-sublist determines the number of layers (color channels). The treatment of mismatched subsequent sublists is as in the previous case.

• 

If data is a procedure, a set, or a table, the size of the image is set by the height, width and layers parameters.

  

If data is a procedure, it is called for each location in the image, being passed either a (row,column) pair for a grayscale image, or a (row,column,layer) triple for a color image. It is expected to return the intensity value for that location (usually in the range 0..1).

  

If data is a set, it must contain equations of the form index=value, where index is a (row,column) pair, or a (row,column,layer) triple, and value is the intensity for that location.  Unspecified entries are initialized according to the background option described below.

  

If data is a table, the indices in the image that correspond to entries in the table are initialized to those values. Unspecified locations in the image are initialized according to the background option described below.

• 

If data is a list of procedures, the size of the image is set by the height and width parameters, and the number of layers corresponds to the number of procedures in the list. The i-th procedure in the list generates the intensities for layer i. Each procedure is passed a (row,column) pair for each location in the image and is expected to return the intensity value of that layer at that location.

Examples

withImageTools:

imgCreate480,640

img:= 1..480 x 1..640 ArrayData Type: float8Storage: rectangularOrder: C_order

(1)

img1,1

0.

(2)

imgCreate240,320,channels=1,background=white,order=Fortran_order

img:= 1..240 x 1..320 ArrayData Type: float8Storage: rectangularOrder: Fortran_order

(3)

img1,1

1.

(4)

imgCreate160,160,channels=1,r,c→evalhfsinrc320

img:= 1..160 x 1..160 ArrayData Type: float8Storage: rectangularOrder: C_order

(5)

img1,1,img2,2

0.00312499491373946,0.0124996744817098

(6)

See Also

ImageTools

ImageTools[FitIntensity]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam