HALCON Reference Manual / Image / Type-Conversion Operators

convert_image_type (Operator)

Name

convert_image_type — Convert the type of an image.

Synopsis

convert_image_type(Image : ImageConverted : NewType : )

Description

convert_image_type converts images of an arbitrary type into an arbitrary new image type. If the conversion is done from a larger to a smaller gray value range (e.g., from 'int4' to 'byte'), too large or too small values are simply “clipped.” It is therefore advisable to adapt the range of gray values by calling scale_image before calling this operator. For images of type complex, only the real part is converted. The imaginary part is ignored. This facilitates an efficient conversion of images that have been transformed back from the frequency domain. Such images always have an imaginary part of 0.

Attention

If the source and destination image type are identical, no new image matrix is allocated.

Parameters

Image (input_object) (multichannel-)image(-array) object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex)
Image whose image type is to be changed.

ImageConverted (output_object) (multichannel-)image(-array) object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex)
Converted image.

NewType (input_control) string (string)
Desired image type (i.e., type of the gray values).
Default value: 'byte'
List of values: 'int1', 'int2', 'uint2', 'int4', 'int8', 'byte', 'real', 'direction', 'cyclic', 'complex'

Result

convert_image_type returns 2 (H_MSG_TRUE) if all parameters are correct. If the input is empty the behavior can be set via set_system('no_object_result',<Result>). If necessary, an exception is raised.

Parallelization Information

convert_image_type is reentrant and automatically parallelized (on tuple level, channel level, domain level).

Possible Predecessors

scale_image

See also

scale_image, abs_image

Module

Foundation


HALCON Reference Manual / Image / Type-Conversion Operators
Version 9.0.2 Copyright © 1996-2010 MVTec Software GmbH