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.

  • 相关阅读:
    关于GDI+的图片质量
    断点续传的Demo
    offic2007 ,offic2010安装失败 1935错误处理方案
    Easy Slider幻灯片 API
    Lazyload.js延迟加载效果
    MVC3中 多种跳转方式总结
    MVC中 DropDownList编辑默认选中的使用
    ASP.NET Session的七点认识
    easyui 的datagrid的自适应宽度的问题
    Linux常用文件操作高频使用命令
  • 原文地址:https://www.cnblogs.com/xiangwengao/p/2408110.html
Copyright © 2011-2022 走看看