HALCON Reference Manual 10.0.2
Table of Contents / Matrix / Creation ClassesClassesClasses | | | Operators

create_matrixcreate_matrixcreate_matrixCreateMatrixCreateMatrix (Operator)

Name

create_matrixcreate_matrixcreate_matrixCreateMatrixCreateMatrix — Create a matrix.

Signature

create_matrix( : : Rows, Columns, Value : MatrixID)

Herror create_matrix(const Hlong Rows, const Hlong Columns, double Value, Hlong* MatrixID)

Herror T_create_matrix(const Htuple Rows, const Htuple Columns, const Htuple Value, Htuple* MatrixID)

Herror create_matrix(const HTuple& Rows, const HTuple& Columns, const HTuple& Value, Hlong* MatrixID)

void HMatrix::CreateMatrix(const HTuple& Rows, const HTuple& Columns, const HTuple& Value)

void HOperatorSetX.CreateMatrix(
[in] VARIANT Rows, [in] VARIANT Columns, [in] VARIANT Value, [out] VARIANT* MatrixID)

void HMatrixX.CreateMatrix(
[in] Hlong Rows, [in] Hlong Columns, [in] VARIANT Value)

static void HOperatorSet.CreateMatrix(HTuple rows, HTuple columns, HTuple value, out HTuple matrixID)

public HMatrix(int rows, int columns, HTuple value)

public HMatrix(int rows, int columns, double value)

void HMatrix.CreateMatrix(int rows, int columns, HTuple value)

void HMatrix.CreateMatrix(int rows, int columns, double value)

Description

The operator create_matrixcreate_matrixcreate_matrixCreateMatrixCreateMatrix creates a new MatrixMatrixMatrixMatrixmatrix with RowsRowsRowsRowsrows rows and ColumnsColumnsColumnsColumnscolumns columns and returns the matrix handle MatrixIDMatrixIDMatrixIDMatrixIDmatrixID. Access to the elements of the matrix is possible e.g. with the operator get_full_matrixget_full_matrixget_full_matrixGetFullMatrixGetFullMatrix. The parameter ValueValueValueValuevalue is a string or a tuple of floating point or integer numbers. Integer numbers are converted to floating point numbers automatically.

If ValueValueValueValuevalue = 'identity'"identity""identity""identity""identity", RowsRowsRowsRowsrows and ColumnsColumnsColumnsColumnscolumns must have the identical values and an identity matrix is created.

Example:


  Rows = 3      Columns = 3      Value = 'identity'

                 /  1  0  0  \
  ->    Matrix = |  0  1  0  |
                 \  0  0  1  /

If the parameter ValueValueValueValuevalue contains a single value, all elements of the matrix are filled with this value.

Example:


  Rows = 3      Columns = 3      Value = 7

               /  7.0  7.0  7.0  \
  ->  Matrix = |  7.0  7.0  7.0  |
               \  7.0  7.0  7.0  /

If ValueValueValueValuevalue contains as many values as the main diagonal, all elements of the main diagonal are set to the values of the parameter ValueValueValueValuevalue (i.e., the number of elements in ValueValueValueValuevalue is identical).

Example:


  Rows = 3      Columns = 4      Value = [3, 7, 1]

                /  3.0  0   0   0  \
  ->   Matrix = |   0  7.0  0   0  |
                \   0   0  1.0  0  /

It is also possible to set all elements of the matrix with different values. In this case the parameter ValueValueValueValuevalue must contain all values in a row-major order, i.e., stored line by line. In addition, the number of elements of ValueValueValueValuevalue must be identical to the number of all elements of the matrix, i.e., RowsRowsRowsRowsrows * ColumnsColumnsColumnsColumnscolumns.

Example:


  Rows = 3      Columns = 3      Value = [3,1,-2,-5,7,2,-9,-4,1]

                /   3.0   1.0  -2.0  \
  ->   Matrix = |  -5.0   7.0   2.0  |
                \  -9.0  -4.0   1.0  /

It should be noted that in the examples there are differences in the meaning of the values of the output matrices: If a value is shown as an integer number, e.g., 0 or 1, the value of this element is per definition this certain value. If the number is shown as a floating point number, e.g., 0.0 or 1.0, the value is computed by the operator.

Parallelization

Parameters

RowsRowsRowsRowsrows (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Number of rows of the matrix.

Default value: 3

Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100

Restriction: Rows >= 1

ColumnsColumnsColumnsColumnscolumns (input_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Number of columns of the matrix.

Default value: 3

Suggested values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 30, 50, 100

Restriction: Columns >= 1

ValueValueValueValuevalue (input_control)  number(-array) HTupleHTupleVARIANTHtuple (real / integer / string) (double / int / long / string) (double / Hlong / char*) (double / Hlong / BSTR) (double / Hlong / char*)

Values for initializing the elements of the matrix.

Default value: 0

Suggested values: 0, 1, 'identity'"identity""identity""identity""identity"

MatrixIDMatrixIDMatrixIDMatrixIDmatrixID (output_control)  matrix HMatrix, HTupleHMatrix, HTupleHMatrixX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Matrix handle.

Result

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

Possible Successors

set_full_matrixset_full_matrixset_full_matrixSetFullMatrixSetFullMatrix, clear_matrixclear_matrixclear_matrixClearMatrixClearMatrix, clear_all_matricesclear_all_matricesclear_all_matricesClearAllMatricesClearAllMatrices

Module

Foundation


Table of Contents / Matrix / Creation ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH