create_image ( : Image : Type, Width, Height, PixelPointer : )

Create an image from a pointer to the pixels.

The operator create_image creates an image of the size Width * Height. The pixels in PixelPointer are stored line-sequentially. The type of the given pixels (PixelPointer) must correspond to the name of the pixels (Type). The storage for the new image is newly created by HORUS Thus, the storage on the PixelPointer can be released after the call. Since the type of the parameter PixelPointer is generic (long) a cast has to be used for the call.


Parameters

Image (output_object)
image -> object
Created image with new image matrix.

Type (input_control)
string -> string
Pixel type
Default value: 'byte'
List of values: 'int1', 'int2', 'int4', 'byte', 'real', 'direction', 'cyclic'

Width (input_control)
extent.x -> integer
Width of image
Default value: 512
Suggested values: 128, 256, 512, 1024
Range of values: 1 <= Width <= 512 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Width >= 1

Height (input_control)
extent.y -> integer
Height of image
Default value: 512
Suggested values: 128, 256, 512, 1024
Range of values: 1 <= Height <= 512 (lin)
Minimum increment: 1
Recommended increment: 10
Restriction: Height >= 1

PixelPointer (input_control)
integer -> integer
Pointer to first gray value


Example
void NewImage(ObjType *new)
{
  unsigned char  image[768*525];
  int            r,c;
  for (r=0; r<525; r++)
    for (c=0; c<768; c++)
      image[r*768+c] = c % 255;
  create_image(new,"byte",768,525,(long)image);
}

Result

If the parameter values are correct, the operator create_image returns the value TRUE. Otherwise an exception is raised.


Possible Predecessors

new_image__, get_image_pointer__


Alternatives

create_image3, new_image__, get_image_pointer__


See also

reduce_domain, paint_grey__, paint_region__, set_greyval__



Copyright © 1996-1997 MVTec Software GmbH