zoukankan      html  css  js  c++  java
  • OpenCV Mat 四则运算符实现矩阵运算

    Mat 数据类型可以直接利用某些数学四则运算符进行矩阵的运算.

    如下解释:

      OpenCV referance manual  P461

    Matrix Expressions
    This is a list of implemented matrix operations that can be combined in arbitrary complex expressions
    (here A, B stand for matrices (Mat), s for a scalar (Scalar),
    for a real-valued scalar
    (double)):
    addition, subtraction, negation: A B; A s; s A; A
    scaling: A*
    , A/

    per-element multiplication and division: A.mul(B), A/B, α/A
    matrix multiplication: A*B
    transposition: A.t() At
    matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
    A.inv([method]) A1, A.inv([method])*B X : AX = B
    comparison: A T B; A 6= B; A T
    ; A 6=
    . The result of comparison is 8-bit single channel
    mask, which elements are set to 255 (if the particular element or pair of elements satisfy the
    condition) and 0 otherwise.
    bitwise logical operations: A & B, A & s, A | B, A | s, A ˆB, A ˆs, ˜A
    element-wise minimum and maximum: min(A, B), min(A,
    ), max(A, B), max(A,

    )
    element-wise absolute value: abs(A)
    cross-product, dot-product: A.cross(B), A.dot(B)

    any function of matrix or matrices and scalars that returns a matrix or a scalar, such as
    cv::norm, cv::mean, cv::sum, cv::countNonZero, cv::trace, cv::determinant, cv::repeat
    etc.
    matrix initializers (eye(), zeros(), ones()), matrix comma-separated initializers, matrix
    constructors and operators that extract sub-matrices (see Mat description).§

    Mat_<destination_type>() constructors to cast the result to the proper type.
    Note, however, that comma-separated initializers and probably some other operations may require
    additional explicit Mat() or Mat_<T>() constuctor calls to resolve possible ambiguity.

  • 相关阅读:
    Apache 配置多站点访问「为项目分配二级域名」
    php封装的mysqli类完整实例
    PHP实现链式操作的三种方法详解
    php实现简单链式操作mysql数据库类
    PHP PDO_MYSQL 链式操作 非链式操作类
    23个数据库常用查询语句
    微信小程序表单弹窗实例
    ES6 && ECMAScript2015 新特性
    ES6新语法概览
    sql将两个日期之间的日子全列出来
  • 原文地址:https://www.cnblogs.com/xiangwengao/p/2408110.html
Copyright © 2011-2022 走看看