前言
opencv矩阵结构为:cv::Mat,或者cv::Mat_等,当需要与eigen的矩阵结构相互转换时主要使用函数:cv::eigen2cv和cv::cv2eigen.
code
Eigen::MatrixXd tmp1(values.rows, values.cols); cv::cv2eigen(values, tmp1); Eigen::MatrixXd tmp2(this->weights.rows, this->weights.cols); cv::cv2eigen(this->weights, tmp2); Eigen::MatrixXd tmp = tmp1 * tmp2; cv::Mat out; cv::eigen2cv(tmp, out); out.convertTo(out, CV_32FC1);
include
#include <eigen3/Eigen/Dense>
#include <opencv2/core/eigen.hpp>
参考
1. opencv_Mat_eigen;
完