ArithmeticOperationWithImage
Performs a pointwise arithmetic operation between two images.
Access to parameter description
The arithmetic operator to apply between both input images $I_1$ and $I_2$ can be selected from:
See also
See related example
Access to parameter description
The arithmetic operator to apply between both input images $I_1$ and $I_2$ can be selected from:
- Addition
- Subtraction
- Multiply
- Division
- Minimum or maximum
See also
See related example
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > arithmeticOperationWithImage( std::shared_ptr< iolink::ImageView > inputImage1, std::shared_ptr< iolink::ImageView > inputImage2, ArithmeticOperationWithImage::ArithmeticOperator arithmeticOperator, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype. arithmetic_operation_with_image(input_image1: idt.ImageType, input_image2: idt.ImageType, arithmetic_operator: ArithmeticOperationWithImage.ArithmeticOperator = ArithmeticOperationWithImage.ArithmeticOperator.ADD, output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype. public static IOLink.ImageView ArithmeticOperationWithImage( IOLink.ImageView inputImage1, IOLink.ImageView inputImage2, ArithmeticOperationWithImage.ArithmeticOperator arithmeticOperator = ImageDev.ArithmeticOperationWithImage.ArithmeticOperator.ADD, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage1 |
The first input image.
The supported types for the first input image are grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||
inputImage2 |
The second input image, must have same dimensions as the first input.
The supported types for the second input image are grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | nullptr | |||||||||||||
arithmeticOperator |
The arithmetic operator to apply.
|
Enumeration | ADD | ||||||||||||||
outputImage |
The output image.
The output image dimensions are forced to the same values as the inputs. The output image type is deduced from the inputs. |
Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
input_image1 |
The first input image.
The supported types for the first input image are grayscale, binary, label, and color. |
image | Binary, Label, Grayscale or Multispectral | None | |||||||||||||
input_image2 |
The second input image, must have same dimensions as the first input.
The supported types for the second input image are grayscale, binary, label, and color. |
image | Binary, Label, Grayscale or Multispectral | None | |||||||||||||
arithmetic_operator |
The arithmetic operator to apply.
|
enumeration | ADD | ||||||||||||||
output_image |
The output image.
The output image dimensions are forced to the same values as the inputs. The output image type is deduced from the inputs. |
image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
inputImage1 |
The first input image.
The supported types for the first input image are grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | null | |||||||||||||
inputImage2 |
The second input image, must have same dimensions as the first input.
The supported types for the second input image are grayscale, binary, label, and color. |
Image | Binary, Label, Grayscale or Multispectral | null | |||||||||||||
arithmeticOperator |
The arithmetic operator to apply.
|
Enumeration | ADD | ||||||||||||||
outputImage |
The output image.
The output image dimensions are forced to the same values as the inputs. The output image type is deduced from the inputs. |
Image | null |
Object Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); ArithmeticOperationWithImage arithmeticOperationWithImageAlgo; arithmeticOperationWithImageAlgo.setInputImage1( polystyrene ); arithmeticOperationWithImageAlgo.setInputImage2( polystyrene ); arithmeticOperationWithImageAlgo.setArithmeticOperator( ArithmeticOperationWithImage::ArithmeticOperator::ADD ); arithmeticOperationWithImageAlgo.execute(); std::cout << "outputImage:" << arithmeticOperationWithImageAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) arithmetic_operation_with_image_algo = imagedev.ArithmeticOperationWithImage() arithmetic_operation_with_image_algo.input_image1 = polystyrene arithmetic_operation_with_image_algo.input_image2 = polystyrene arithmetic_operation_with_image_algo.arithmetic_operator = imagedev.ArithmeticOperationWithImage.ADD arithmetic_operation_with_image_algo.execute() print("output_image:", str(arithmetic_operation_with_image_algo.output_image))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); ArithmeticOperationWithImage arithmeticOperationWithImageAlgo = new ArithmeticOperationWithImage { inputImage1 = polystyrene, inputImage2 = polystyrene, arithmeticOperator = ArithmeticOperationWithImage.ArithmeticOperator.ADD }; arithmeticOperationWithImageAlgo.Execute(); Console.WriteLine( "outputImage:" + arithmeticOperationWithImageAlgo.outputImage.ToString() );
Function Examples
auto polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = arithmeticOperationWithImage( polystyrene, polystyrene, ArithmeticOperationWithImage::ArithmeticOperator::ADD ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.arithmetic_operation_with_image(polystyrene, polystyrene, imagedev.ArithmeticOperationWithImage.ADD) print("output_image:", str(result))
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.ArithmeticOperationWithImage( polystyrene, polystyrene, ArithmeticOperationWithImage.ArithmeticOperator.ADD ); Console.WriteLine( "outputImage:" + result.ToString() );