HALCON Reference Manual / Matrix / Arithmetic Operators

add_matrix (Operator)

Name

add_matrix — Add two matrices.

Synopsis

add_matrix( : : MatrixAID, MatrixBID : MatrixSumID)

Description

The operator add_matrix computes the sum of the input matrices MatrixA and MatrixB given by the matrix handles MatrixAID and MatrixBID. Both matrices must have identical dimensions. A new matrix MatrixSum is generated with the result. The operator returns the matrix handle MatrixSumID of the matrix MatrixSum. Access to the elements of the matrix is possible e.g. with the operator get_full_matrix. The formula for the calculation of the result is:

  MatrixSum = MatrixA + MatrixB.

Example:

            /   3.0   1.0  -2.0  \                /   2.0   8.0  -3.0  \
  MatrixA = |  -5.0   7.0   2.0  |      MatrixB = |  -4.0  -1.0   5.0  |
            \  -9.0  -4.0   1.0  /                \   2.0  -4.0   7.0  /

                   /   5.0   9.0  -5.0  \
  ->   MatrixSum = |  -9.0   6.0   7.0  |
                   \  -7.0  -8.0   8.0  /

Parameters

MatrixAID (input_control) matrix (integer)
Matrix handle of the input matrix A.

MatrixBID (input_control) matrix (integer)
Matrix handle of the input matrix B.

MatrixSumID (output_control) matrix (integer)
Matrix handle with the sum of the input matrices.

Result

If the parameters are valid, the operator add_matrix returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Parallelization Information

add_matrix is reentrant and processed without parallelization.

Possible Predecessors

create_matrix

Possible Successors

get_full_matrix, get_value_matrix

Alternatives

add_matrix_mod

See also

sub_matrix, sub_matrix_mod

Module

Foundation


HALCON Reference Manual / Matrix / Arithmetic Operators
Version 9.0.2 Copyright © 1996-2010 MVTec Software GmbH