Arithmetical Operations
This group contains pointwise arithmetical operators.
- AbsoluteValue: Computes the absolute value of an image.
- AbsoluteMaximumWithImage: Computes the maximum between the absolute values of two images.
- ArithmeticOperationWithImage: Performs a pointwise arithmetic operation between two images.
- ArithmeticOperationWithValue: Performs a pointwise arithmetic operation between an image and a value.
- BlendWithImage: Produces a linear combination between two images.
- BlendWithValue: Produces a linear combination between an image and a constant value.
- DirectionalBlending2d: Combines two images following a direction axis.
- CombineByMask: Produces a combination of two images in a complementary way.
- ImageFormula: Computes a new image by applying a user-defined formula on one, two, or three input images.
- EigenDecomposition2d: Performs the singular value decomposition (SVD) of a 2D tensor field image.
- EigenDecomposition3d: Performs the singular value decomposition (SVD) of a 3D tensor field image.
The Arithmetical Operations group contains operations like sum, difference, blending, minimum
or maximum between two images or between an image and a constant.
In the following tables:
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} $$
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} $$
$$ \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} $$
$$ \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} $$
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:
- The row header indicates the type of the first input image.
- The column header indicates the type of the second input image or of the operand value.
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} $$