ImageDev

Arithmetical Operations

This group contains pointwise arithmetical operators.
The Arithmetical Operations group contains operations like sum, difference, blending, minimum or maximum between two images or between an image and a constant.

Rules for Arithmetic Image Type

There are four rules governing output image types for arithmetic operations. The aim is to provide the smallest type without loss of precision.
In the following tables:

Operand interpretation

In the case of ArithmeticOperationWithValue, the type of the output image is deduced from the type of the input image and the smallest type able to contain the operand without loss of precision.

Basic Rule


This rule is used for addition, subtraction and division operations.
Some operators with a single input also use this rule by taking the same type for both row and column header. For instance, GradientOperator2d and GradientOperator3d also follow this rule.

$$ \begin{array}{|c||c|c|c|c|c|c|c|c|} \hline Basic Rule & \textbf{DOUBLE} & \textbf{FLOAT} & \textbf{UINT32} & \textbf{INT32} & \textbf{UINT16} & \textbf{INT16} & \textbf{UINT8} & \textbf{INT8} \\ \hline \hline \textbf{DOUBLE} & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE \\ \hline \textbf{FLOAT} & DOUBLE & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT \\ \hline \textbf{UINT32} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT32 & INT32 & INT32 \\ \hline \textbf{INT32} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT32 & INT32 & INT32 \\ \hline \textbf{UINT16} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT32 & INT32 & INT32 \\ \hline \textbf{INT16} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT16 & INT16 & INT16 \\ \hline \textbf{UINT8} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT16 & INT16 & INT16 \\ \hline \textbf{INT8} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT16 & INT16 & INT16 \\ \hline \end{array} $$

Promotion Rule


This rule is used for multiplication operation.

$$ \begin{array}{|c||c|c|c|c|c|c|c|c|} \hline Promotion Rule & \textbf{DOUBLE} & \textbf{FLOAT} & \textbf{UINT32} & \textbf{INT32} & \textbf{UINT16} & \textbf{INT16} & \textbf{UINT8} & \textbf{INT8} \\ \hline \hline \textbf{DOUBLE} & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE \\ \hline \textbf{FLOAT} & DOUBLE & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT \\ \hline \textbf{UINT32} & DOUBLE & FLOAT & UINT32 & INT32 & UINT32 & INT32 & UINT32 & INT32 \\ \hline \textbf{INT32} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT32 & INT32 & INT32 \\ \hline \textbf{UINT16} & DOUBLE & FLOAT & UINT32 & INT32 & UINT32 & INT32 & UINT32 & INT32 \\ \hline \textbf{INT16} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT16 & INT16 & INT16 \\ \hline \textbf{UINT8} & DOUBLE & FLOAT & UINT32 & INT32 & UINT32 & INT16 & UINT16 & INT16 \\ \hline \textbf{INT8} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT16 & INT16 & INT16 \\ \hline \end{array} $$

Rule for minimum operation


$$ \begin{array}{|c||c|c|c|c|c|c|c|c|} \hline Minimum Rule & \textbf{DOUBLE} & \textbf{FLOAT} & \textbf{UINT32} & \textbf{INT32} & \textbf{UINT16} & \textbf{INT16} & \textbf{UINT8} & \textbf{INT8} \\ \hline \hline \textbf{DOUBLE} & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE \\ \hline \textbf{FLOAT} & DOUBLE & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT \\ \hline \textbf{UINT32} & DOUBLE & FLOAT & UINT32 & INT32 & UINT16 & INT16 & UINT8 & INT8 \\ \hline \textbf{INT32} & DOUBLE & FLOAT & INT32 & INT32 & INT32 & INT32 & INT32 & INT32 \\ \hline \textbf{UINT16} & DOUBLE & FLOAT & UINT16 & INT32 & UINT16 & INT16 & UINT8 & INT8 \\ \hline \textbf{INT16} & DOUBLE & FLOAT & INT16 & INT32 & INT16 & INT16 & INT16 & INT16 \\ \hline \textbf{UINT8} & DOUBLE & FLOAT & UINT8 & INT32 & UINT8 & INT16 & UINT8 & INT8 \\ \hline \textbf{INT8} & DOUBLE & FLOAT & INT8 & INT32 & INT8 & INT16 & INT8 & INT8 \\ \hline \end{array} $$

Rule for maximum operation


$$ \begin{array}{|c||c|c|c|c|c|c|c|c|} \hline Maximum Rule & \textbf{DOUBLE} & \textbf{FLOAT} & \textbf{UINT32} & \textbf{INT32} & \textbf{UINT16} & \textbf{INT16} & \textbf{UINT8} & \textbf{INT8} \\ \hline \hline \textbf{DOUBLE} & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE & DOUBLE \\ \hline \textbf{FLOAT} & DOUBLE & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT & FLOAT \\ \hline \textbf{UINT32} & DOUBLE & FLOAT & UINT32 & UINT32 & UINT32 & UINT32 & UINT32 & UINT32 \\ \hline \textbf{INT32} & DOUBLE & FLOAT & UINT32 & INT32 & UINT16 & INT32 & INT32 & INT32 \\ \hline \textbf{UINT16} & DOUBLE & FLOAT & UINT32 & UINT16 & UINT16 & UINT16 & UINT16 & UINT16 \\ \hline \textbf{INT16} & DOUBLE & FLOAT & UINT32 & INT32 & UINT16 & INT16 & UINT8 & INT16 \\ \hline \textbf{UINT8} & DOUBLE & FLOAT & UINT32 & INT32 & UINT16 & UINT8 & UINT8 & UINT8 \\ \hline \textbf{INT8} & DOUBLE & FLOAT & UINT32 & INT32 & UINT16 & INT16 & UINT8 & INT8 \\ \hline \end{array} $$