ConvertImage
Changes the data type and interpretation of an image.
Access to parameter description
The ConvertImage algorithm changes the arithmetic format of the input image to an output image. Conversion follows the C convention, and no overflow is checked.
When converting to a binary image type, non-zero gray level values are changed to 1, and zero gray level values stay unchanged.
The type of the output image is set by an enumerate as detailed in the Data Type Management section.
The available formats are:
For conversion from Complex to Scalar, the output is set to the real part of the input image.
Note: The complex is mainly for internal usage. Most of ImageDev algorithms do not acccept a complex image as input for now.
See also
See related example
Access to parameter description
The ConvertImage algorithm changes the arithmetic format of the input image to an output image. Conversion follows the C convention, and no overflow is checked.
When converting to a binary image type, non-zero gray level values are changed to 1, and zero gray level values stay unchanged.
The type of the output image is set by an enumerate as detailed in the Data Type Management section.
The available formats are:
- 8-bit unsigned integer
- 8-bit signed integer
- 16-bit unsigned integer
- 16-bit signed integer
- 32-bit unsigned integer
- 32-bit signed integer
- 32-bit real floating-point
- 64-bit real floating-point
- 32-bit complex floating-point
- 64-bit complex floating-point
- Binary
- 8-bit label
- 16-bit label
- 32-bit label
For conversion from Complex to Scalar, the output is set to the real part of the input image.
Note: The complex is mainly for internal usage. Most of ImageDev algorithms do not acccept a complex image as input for now.
See also
See related example
Function Syntax
This function returns the outputImage output parameter.
// Function prototype. std::shared_ptr< iolink::ImageView > convertImage( std::shared_ptr< iolink::ImageView > inputImage, ConvertImage::OutputType outputType, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype. convert_image( input_image, output_type = ConvertImage.OutputType.SIGNED_INTEGER_16_BIT, output_image = None )
This function returns the outputImage output parameter.
// Function prototype. public static IOLink.ImageView ConvertImage( IOLink.ImageView inputImage, ConvertImage.OutputType outputType = ImageDev.ConvertImage.OutputType.SIGNED_INTEGER_16_BIT, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Class Name | ConvertImage |
---|
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||||||||||||||||||
outputType |
The output image data type.
|
Enumeration | SIGNED_INTEGER_16_BIT | ||||||||||||||||||||||||||||||
outputImage |
The output image. | Image | nullptr |
Object Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); ConvertImage convertImageAlgo; convertImageAlgo.setInputImage( foam ); convertImageAlgo.setOutputType( ConvertImage::OutputType::UNSIGNED_INTEGER_8_BIT ); convertImageAlgo.execute(); std::cout << "outputImage:" << convertImageAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) convert_image_algo = imagedev.ConvertImage() convert_image_algo.input_image = foam convert_image_algo.output_type = imagedev.ConvertImage.UNSIGNED_INTEGER_8_BIT convert_image_algo.execute() print( "output_image:", str( convert_image_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); ConvertImage convertImageAlgo = new ConvertImage { inputImage = foam, outputType = ConvertImage.OutputType.UNSIGNED_INTEGER_8_BIT }; convertImageAlgo.Execute(); Console.WriteLine( "outputImage:" + convertImageAlgo.outputImage.ToString() );
Function Examples
auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" ); auto result = convertImage( foam, ConvertImage::OutputType::UNSIGNED_INTEGER_8_BIT ); std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip")) result = imagedev.convert_image( foam, imagedev.ConvertImage.UNSIGNED_INTEGER_8_BIT ) print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" ); IOLink.ImageView result = Processing.ConvertImage( foam, ConvertImage.OutputType.UNSIGNED_INTEGER_8_BIT ); Console.WriteLine( "outputImage:" + result.ToString() );