• opencvinvert求逆矩阵


    逆矩阵定义:看 https://www.cnblogs.com/liming19680104/p/15631550.html

    #include<opencv2/opencv.hpp>
    #include<iostream>
    #include  <vector>
    
    
    int main(int argc, char** argv) {
    
        cv::Mat A = (cv::Mat_<double>(3, 3) << 1, 2, 3, 2, 2, 1, 3, 4, 3);
        std::cerr << A << std::endl << std::endl;
        cv::Mat B;
        cv::invert(A, B);  //求逆矩阵
        //参数1:输入,浮点型(32位或者64位)的M×N的矩阵,当参数3的使用方法
        //          为DECOMP_CHOLESKY DECOMP_LU DECOMP_EIG时函数功能为求逆,此时需保证M=N
        //参数2:输出,与输入矩阵类型一致的N×M的矩阵
        //参数3:提供4种可选择的方法:
        //       DECOMP_CHOLESKY(基于CHOLESKY分解的方法)
        //       DECOMP_LU(基于LU分解的方法)
        //       DECOMP_EIG(基于特征值分解的方法)
        //       DECOMP_SVD(基于奇异值分解的方法)
    
        std::cerr << B << std::endl << std::endl;
        cv::Mat C;
        C = A * B;
        std::cerr << C << std::endl << std::endl;
    
        cv::waitKey(0);
        return 0;
    }

  • 相关阅读:
    原型设计 + 用户规格说明书
    第三次作业
    MathExam第二次作业
    第一次随笔
    冲鸭第一的合作
    功能规格说明书
    测试与优化
    结对编程
    高分小学计算器
    现实与梦
  • 原文地址:https://www.cnblogs.com/liming19680104/p/15600147.html
Copyright © 2020-2023  润新知